3

I have an app that heavily relies on background processing and I would like to have the delayed_job workers on a separate Linode instance for performance reasons. I have found this really helpful post about being able to run DJ workers on a different server without having to boot Apache and it looks like that's how I'll be setting things up.

My question is how do I go about configuring Capistrano to deploy my app to both servers, only running the actual web facing end from one, and using the other one for DJ? Would I do something like this?

role :web, "domain.com"
role :app, "domain.com", "workers.domain.com"
role :db,  "domain.com", :primary => true
Community
  • 1
  • 1
dchuk
  • 31
  • 1
  • 3
  • Check out these two questions: http://stackoverflow.com/questions/7210715/before-after-hooks-for-only-particular-roles-for-library-provided-recipes http://stackoverflow.com/questions/4621817/rails-can-i-run-backgrounds-jobs-in-a-different-server – John Bachir Aug 26 '11 at 21:29

1 Answers1

1

You can set a separate server role for delayed jobs adding this to your recipe:

set :delayed_job_server_role, :utility

Then, attach this role to your worker (utility) server:

role :web, "domain.com"
role :app, "domain.com"
role :db,  "domain.com", :primary => true
role :utility, "workers.domain.com"

For more info: https://github.com/collectiveidea/delayed_job/wiki/Rails-3-and-Capistrano

aruanoc
  • 817
  • 1
  • 7
  • 9