2

We are using Symfony2 on a AWS Beanstalk Application. For the Deployment we adjusted the Deployment-Script to do a composer install after the application has been uploaded.

Eventhough this works theoretically, it has some downsides - mainly the constantly increasing deployment-time (which sometimes results in server timeouts) and increasing dependencies on the availability of other servers.

I have read that some people copy the vendor/* to a tmp-dir and move it back after the deployment to speed-up the deployment.

It's definetely helpful but we are updating our composer.json quite often so we still have to have a composer install in our deployment-process. We believe that the best approach is to include all dependencies (vendor/*) as files in the repo and skip the composer install during the deployment.

Unfortunately most libraries are included as git-submodules and AWS does not support submodules (all files have to be in the repo).

So here comes my question:

What is the best way to remove all git-submodules and commit the real files instead?

I have tried combining:

git submodules --recursive foreach

with How do I remove a submodule? but without succes.

Community
  • 1
  • 1
HKandulla
  • 1,101
  • 12
  • 17

1 Answers1

1

You can try this workflow:

  • create a new release folder
  • checkout the latest version of your code in the new folder
  • copy "vendor" from the currently active release folder into new release folder
  • run "composer.phar install"

This way, composer will only update the libraries that have changed between releases.

I use it successfully with capistrano (there is also a Symfony specific version called capifony) that can help you out. Especially because it can keep a clone of your git repository so pushing out new releases is much faster, and deployments and rollbacks are one-liner away.

Goran Jurić
  • 1,829
  • 13
  • 17