How to deploy resque workers in production?

后端 未结 4 1780
悲哀的现实
悲哀的现实 2020-12-07 09:56

The GitHub guys recently released their background processing app which uses Redis: http://github.com/defunkt/resque http://github.com/blog/542-introducing-resque

I

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-07 10:19

    I just figured this out last night, for Capistrano you should use san_juan, then I like the use of God to manage deployment of workers. As for surviving a reboot, I am not sure, but I reboot every 6 months so I am not too worried.

    Although he suggest different ways of starting it, this is what worked easiest for me. (Within your deploy.rb)

    require 'san_juan'
    after "deploy:symlink", "god:app:reload"
    after "deploy:symlink", "god:app:start"
    

    To manage where it runs, on another server, etc, he covers that in the configuration section of the README.

    I use Passenger on my slice, so it was relatively easy, I just needed to have a config.ru file like so:

    require 'resque/server'
    
    run Rack::URLMap.new \
      "/" => Resque::Server.new
    

    For my VirtualHost file I have:

    
            ServerName resque.server.com
            DocumentRoot /var/www/server.com/current/resque/public
    
            
              AuthType Basic
              AuthName "Resque Workers"
              AuthUserFile /var/www/server.com/current/resque/.htpasswd
              Require valid-user
            
    
    

    Also, a quick note. Make sure you overide the resque:setup rake task, it will save you lots of time for spawning new workers with God.

    I ran into a lot of trouble, so if you need any more help, just post a comment.

提交回复
热议问题