I configured Capifony to deploy to my remote servers and when I deploy project I get some error after capifony has execution an rolling back operation.
But after capifony executed symfony:composer:dump_autoload
action and consequently it dump chache and autoload files with new release path. After when I run symfony application I get error:
PHP Warning: include(): Failed opening '/var/www/vhosts/user/app/releases/20130805162052/src/Rocket/ApplicationBundle/RocketApplicationBundle.php' for inclusion (include_path='/........') in /var/www/vhosts/user/app/shared/vendor/composer/ClassLoader.php on line 185
So the question: how I can execute symfony:composer:dump_autoload
if deploy got any error
Something like this:
after "deploy:rolling_back_action", "symfony:composer:dump_autoload"
Can anyone help me?
EDIT:
I tried to redeclare namespace :deploy:update_code
and change on_rollback
action, in current deploying session if I getting any error this hook is work. but when executingsymfony:composer:dump_autoload
action in on_rollback event releas_path
is not current, and I can't his redeclare... Here is my code, when I tryed redeclare namespace:
namespace :deploy do
task :update_code, :except => { :no_release => true } do
on_rollback { my_namespace.rollback }
strategy.deploy!
finalize_update
end
end
namespace :my_namespace do
task :rollback, :except => { :no_release => true } do
run "rm -rf #{release_path}; true" #default capistrano action on rollback
#my custom actions
#run "cd "+shared_path+"/../current"
#run "php composer.phar dump-autoload"
set :release_path, shared_path+"/../current"
symfony.composer.dump_autoload
end
end
So far I have found a temporary solution to this problem - each time after deploy execute cap symfony:composer:dump_autoload
to update the paths and dump new autoload info, but it I don't like...
Can I reach the truth with re declare namespace or with other solutions?
you can continue the task if errors occur using something like this: