Where to put the "before" and "after" in the Capistrano recipe?

Stupid question, but do we have a broken Capistrano recipe and I want to check that we are using after and before incorrectly?

Do these tasks complete before and after tasks in the namespace block :deploy or outside? I see examples here .

This is an excerpt from the problematic deploy.rb:

 namespace :deploy do task :start do ; end task :stop do ; end task :restart, :roles => :app, :except => { :no_release => true } do run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" end # copy database.yml into project task :copy_database_config do production_db_config = "/Library/RoRconfig/#{application}.yml" run "cp #{production_db_config} #{current_release}/config/database.yml" `puts "replaced database.yml with live copy"` end task :pipeline_precompile do run "cd #{release_path}; RAILS_ENV=production rake assets:precompile" end after "deploy:update_code", "deploy:pipeline_precompile" ### <--- before "deploy:finalize_update", "deploy:copy_database_config" ### <--- end 
+6
source share
1 answer

I am using a setting similar to:

 after :deploy, "deploy:update_code", "deploy:pipeline_precompile" before :deploy, "deploy:finalize_update", "deploy:copy_database_config" namespace :deploy do task :start do ; end task :stop do ; end task :restart, :roles => :app, :except => { :no_release => true } do run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" end # copy database.yml into project task :copy_database_config do production_db_config = "/Library/RoRconfig/#{application}.yml" run "cp #{production_db_config} #{current_release}/config/database.yml" `puts "replaced database.yml with live copy"` end task :pipeline_precompile do run "cd #{release_path}; RAILS_ENV=production rake assets:precompile" end end 
+4
source

Source: https://habr.com/ru/post/894562/


All Articles