I have been using Capifony to deploy my application and everything works fine. However, when there's an error during the deploy, it rolls back and the rollback fails.
*** [deploy:update_code] rolling back
* executing "sudo -p 'sudo password: ' rm -rf /var/www/capifony/releases/20150923104657; true"
servers: ["myserver"]
[myserver] executing command
command finished in 110ms
**failed: "sh -c 'sudo -p '\\''sudo password: '\\'' sh -c '\\''cd /var/www/capifony/releases/20150923104657 && SYMFONY_ENV=prod /usr/local/bin/composer.phar install --no-dev --verbose --prefer-dist --optimize-autoloader --no-progress'\\'''" on myserver**
Then the error on the browser is:
Compile Error: Symfony\Component\Debug\DebugClassLoader::loadClass(): Failed opening required '/mnt/app/www/capifony/releases/20150923104657/src/MyApp/CoreBundle/MyAppCoreBundle.php' (include_path='/mnt/app/www/capifony/shared/vendor/phpunit/phpunit-mock-objects:/mnt/app/www/capifony/shared/vendor/phpunit/php-file-iterator:/mnt/app/www/capifony/shared/vendor/phpunit/phpunit:/mnt/app/www/capifony/shared/vendor/symfony/yaml:.:/usr/share/php:/usr/share/pear')
From what I understand, it tries to do a composer install on the 20150923104657 release. However, this is the version it just deleted (rm -rf /var/www/capifony/releases/20150923104657). So it's normal that it fails. But I don't understand why it does that on this order.
Could anybody help me?
EDIT:
My Capfile:
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
require 'capifony_symfony2'
My deploy.rb:
set :application, "myapp"
set :deploy_to, "/var/www/capifony"
set :app_path, "app"
set :repository, "https://git-myapp@github.com/Myapp/myapp.git"
set :scm, :git
set :branch, "master"
set :model_manager, "doctrine"
set :symfony_env_prod, "prod"
#recette
role :web, "myserver"
role :app, "myserver", :primary => true
set :use_sudo, true
set :user, "ubuntu"
set :keep_releases, 10
set :assets_install, true
set :dump_assetic_assets, true
set :use_composer, true
set :composer_bin, "/usr/local/bin/composer.phar"
set :update_vendors, false # false = install mode
set :clear_controllers, false
set :shared_files, ["app/config/parameters.yml"]
set :shared_children, [app_path + "/logs", app_path + "/Resources/images/myimages", web_path + "/media", web_path + "/zip", web_path + "/temp", "vendor"]
set :deploy_via, :remote_cache
set :writable_dirs, ["app/cache", "app/logs" , "app/../web", "app/Resources/images/myimages"]
set :webserver_user, "www-data"
set :permission_method, :chown
set :use_set_permissions, true
logger.level = Logger::MAX_LEVEL
before "deploy", "maintenance_enable", "cron_stop", "permissions_capifony", "finalize_update"
after "deploy", "deploy:cleanup", "others_tasks", "cron_start"
before "symfony:cache:warmup", "symfony:doctrine:schema:update"
I can also add the detail of the tasks if it is necessary.