Search code examples
ruby-on-railsresque

Rails 5 - Running Resque on a Separate Machine


I understand how to setup a machine to run Resque with the environment, etc. What I cannot find, is now to point a Web (etc) server to (use) a queue on a separate machine.

For example, I am using Resque to handle mail (with the resque_mailer gem). Resque::Mailer is included in my ApplicationMailer setup, and everything works fine all running on one machine. But, I do not wish to use the resources of the Web machine for the background-processes.

How do I tell the ApplicationMailer, or configure Resque::Mailer, so that the request is routed to another machine on the internal network?


Solution

  • The answer was - you don't have to do anything other than ensure the system that is generating the work (the 1st machine) can reach the Redis instance, so it can update the queue there.

    The 2nd machine, which carries-out the jobs, also only needs to be able to find the Redis server, which it will check to find new jobs to do.

    The Redis server can be anywhere reachable by the two machines - on the 1st, 2nd, or a 3rd machine - in the context of this example.