Perform simultaneous or asynchronous tasks with Capistrano

I have several lengthy process restarts in my deploy.rb , for example:

  • rake assets:precompile
  • script/delayed_job restart
  • rake sunspot:solr:stop , rake sunspot:solr:start

All of these processes must occur, but not necessarily one after another.

I was wondering if I could run assets:precompile and delayed_job restart at the same time, since they should not happen one after another, and I could speed up my deployment time by executing them asynchronously.

I have completed some Google searches, but I can’t find anything.

+4
source share
1 answer

This is not a feature that capistrano supports.

I was looking for a solution and found something in the Google Capistrano groups . The suggestion was to use Capistrano to run a ruby ​​script that runs tasks in parallel using native Ruby thread support.

If you read the post, one of the authors will ask why these tasks should be performed in parallel, because you can introduce race conditions and other non-deterministic behavior that can make the deployment process more fragile.

0
source

All Articles