0
votes

I am trying to deploy my Symfony2 project to server with capifony but i got this error:

      * 2013-06-25 16:22:19 executing `symfony:assets:install'
--> Installing bundle's assets
  * executing "sh -c 'cd /home/user1/releases/20130625142202 && php app/console assets:install web --env=prod --no-debug'"
    servers: ["1xx"]
    [1xx] executing command
 ** [out :: 1xx] 
 ** [out :: 1xx] Warning: require(/home/user1/releases/20130625142202/app/../vendor/autoload.php): failed to open stream: No such file or directory in /home/user1/releases/20130625142202/app/autoload.php on line 14
 ** [out :: 1xx] 
 ** [out :: 1xx] Fatal error: require(): Failed opening required '/home/user1/releases/20130625142202/app/../vendor/autoload.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user1/releases/20130625142202/app/autoload.php on line 14
    command finished in 369ms
*** [deploy:update_code] rolling back

here is my output:

  • 2013-06-25 16:51:49 executing symfony:composer:get' <ul> <li>executing "if [ -e /home/user/releases/20130625145137/composer.phar ]; then echo 'true'; fi" servers: ["xx.xxx.xx.xx"] [xx.xxx.xx.xx] executing command command finished in 488ms --> Updating Composer</li> <li>executing "sh -c 'cd /home/user/releases/20130625145137 && php composer.phar self-update'" servers: ["xx.xxx.xx.xx"] [xx.xxx.xx.xx] executing command command finished in 377ms --> Updating Composer dependencies</li> <li>executing "sh -c 'cd /home/user/releases/20130625145137 && php composer.phar update --no-scripts --no-dev --verbose --prefer-dist --optimize-autoloader --no-progress'" servers: ["xx.xxx.xx.xx"] [xx.xxx.xx.xx] executing command command finished in 390ms</li> <li>2013-06-25 16:51:50 executingsymfony:bootstrap:build' --> Building bootstrap file
  • executing "if [ -e /home/user/releases/20130625145137/bin/build_bootstrap ]; then echo 'true'; fi" servers: ["xx.xxx.xx.xx"] [xx.xxx.xx.xx] executing command command finished in 336ms
  • executing "sh -c 'cd /home/user/releases/20130625145137 && test -f vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php && php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php app || echo 'vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php not found, skipped''" servers: ["xx.xxx.xx.xx"] [xx.xxx.xx.xx] executing command ** [out :: xx.xxx.xx.xx] vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php command finished in 392ms
  • 2013-06-25 16:51:51 executing symfony:composer:dump_autoload' --> Dumping an optimized autoloader</li> <li>executing "sh -c 'cd /home/user/releases/20130625145137 && php composer.phar dump-autoload --optimize'" servers: ["xx.xxx.xx.xx"] [xx.xxx.xx.xx] executing command command finished in 417ms</li> <li>2013-06-25 16:51:52 executingsymfony:assets:install' --> Installing bundle's assets
  • executing "sh -c 'cd /home/user/releases/20130625145137 && php app/console assets:install web --env=prod --no-debug'" servers: ["xx.xxx.xx.xx"] [xx.xxx.xx.xx] executing command ** [out :: xx.xxx.xx.xx] ** [out :: xx.xxx.xx.xx] Warning: require(/home/user/releases/20130625145137/app/../vendor/autoload.php): failed to open stream: No such file or directory in /home/user/releases/20130625145137/app/autoload.php on line 14 ** [out :: xx.xxx.xx.xx] ** [out :: xx.xxx.xx.xx] Fatal error: require(): Failed opening required '/home/user/releases/20130625145137/app/../vendor/autoload.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user/releases/20130625145137/app/autoload.php on line 14 command finished in 417ms * [deploy:update_code] rolling back
  • executing "rm -rf /home/user/releases/20130625145137; true" servers: ["xx.xxx.xx.xx"] [xx.xxx.xx.xx] executing command
1
provide your deploy.rb pleaseNicolai Fröhlich
please provide your composer.json ... looks like the autoloader isn't dumped and sensio/distribution-bundle isn't being downloaded aswell... vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php not found, skipped'Nicolai Fröhlich
As I see here, he doesnt do Install or Update with composer in any situationAntonio Peric
hm normally all of the last steps capifony is executing would not be needed ... if you ommit --no-scripts when composer is being executed it will already build the bootstrap, dump the assets ... namely what you configure in your composer.json under scripts ... and the optimized autoloader is being dumped there aswell ... no need to execute composer.phar dump-autoload --optimize a second time afterwardsNicolai Fröhlich
hm searching for --no-scripts in the whole capifony repository only returns one hit in the CHANGELOG.md ... Where does that come from during your deployment process? Well it makes sense if you execute the commands through capifony afterwards ... but i think it will most likely be easier to let composer handle the bootstrap-building and stuffNicolai Fröhlich

1 Answers

1
votes

Add this to your deploy.rb:

set :composer_options, "--no-dev --verbose --prefer-dist --optimize-autoloader --no-progress"

Make sure composer update or composer install is executed during the deployment process.

Otherwise vendor/autoload.php will not be created and therefore not be available.