My root capistrano has a task that dumps the database: cap production dump
or cap staging dump
will dump the database.
Now, I want to define a task in staging that will run this task on production.
I could do
desc 'Updates the database of acceptance with the latest production database'
task :update_db do
run_locally do
execute :cap, 'production', 'dump'
# move dump-file from production, via local, to acceptance
end
on roles(:db) do
execute :rake, 'db:data:load'
end
end
But running a cap task from a cap task via a shell feels ugly and fragile.
I found Calling a multistage capistrano task from within a capistrano task but that does not work, probably because its a solution for an old version of Capistrano.
Is there a way to run a certain capistrano task on a certain "stage" from within Capistrano?