fadion / Maneuver

Easily deploy Laravel projects via FTP or SFTP, using Git for versioning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include vendors to deploy

bashmach opened this issue · comments

Hi, Fadion!
First of all, big thanks for the tool. This looks super useful for automatically deploy of laravel applications to servers without SSH access.
But I see one very important issue - how to deal with vendors? It's horribly wrong to have them added to the repository, but in the same time I can't see now a way to deploy them with other project files.
I'm going to add this ability and send you PR, but first I decided to find out your opinion.

The issue has been opened up, but I haven't had the time to deal with it.

A solution would be adding an --with-vendor option when deploying to force upload /vendor. Another solution, suggested by a member, would be to automatically upload /vendor when composer.json is changed in the commit. This is totally open for discussion, so please let me know what you think.

@banago your input on the issue would be quite valuable.

Over at PHPloy we have implemented this option to address this:

--others               Uploads files even if they are excluded in .gitignore

However, it seems like this will upload everything, not only the vendor directory. That will be easy to implement on Maneuver too.

Though I reckon there is a better option. I think reversing the implementation of the skip[] option as ˙include[]` to allow users to determine exactly what they needed included.

--with-vendor would work just fine too, since this is a Laravel specific package and that will address 80% of the needs hopefully.

As for me, I would like to implement a solution when Maneuver check composer.lock for changes and if so, will add new/changed vendors to upload list. But currently I have no idea how to fetch only changed vendors. Hope to find a solution in the nearest future.

Any update on this issue? would be very useful to have

I've left it open to suggestions for any good and simple solution.

Personally haven't find a way that:

  1. Doesn't overcomplicate the project. Manually managing the changes of vendor files is pointless and complicated. I'm not reinventing version control.
  2. Adding a --with-vendor option would work and would be easy to implement, but I highly doubt it's usability. Pushing a million files in the vendor folder just because one has updated one or two packages, just doesn't make sense to me.

Perhaps a --with-vendor[folder1, folder2,..., etc] option? One would need to manually specify which vendor folders to deploy, but imo this is still preferable to the alternative.

Maybe we can have some way of making a hash of every subfoler of the vender folder. Or sub-sub folder if needed. When requested with --vender download the hashes file from the server. Recalculate the local version upload the folders were the hash does not match. Upload the new hashes to the server.

Does not need to be hashes. Could be anything that detects folder changes and is comparable.

Anyone any workaround i could use for now?

@banago / @fadion I would like to know if u think this is doable?

@fadion Would u accept a solution like this?

Just like there's 'ignored' in config/maneuver.php, there should be 'included' - for files that will be included even if they're in .gitignore.

Another solution, suggested by a member, would be to automatically upload /vendor when composer.json is changed in the commit. This is totally open for discussion, so please let me know what you think.

I think this is a good idea, but if vendor/ isn't added to git, you'd need some mechanism to check which files have changed and upload only those.

Would be probably best to somehow have a separate git repository in vendor/

Another solution that doesn't involve using git for vendor/ would be to have (after initial vendor deployment) a txt file on the server that would look like

composer 8mo7mhi6j0s4sblncvg1
fadion 8tig0g6llr43uwftugcz
laravel whddzja17e96a542meb7

Folder name, hash of contents. Maneuver would

  1. Check for folders that are missing on the server: add them
  2. Check for folders that are on the server but not on the local machine: delete them from server
  3. Check for folders whose hash doesn't match: reupload the whole folder

This could be done more efficiently by tracking specifically what has changed inside the folder, but that's too complex. Uploading a big folder to the server is in any case better than uploading entire vendor/.