如何在生产中部署应急人员? [英] How to deploy resque workers in production?

查看:83
本文介绍了如何在生产中部署应急人员?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GitHub团队最近发布了他们的使用Redis的后台处理应用程序:
http://github.com / defunkt / resque
http://github.com/blog/542 -introducing-resque

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 have it working locally, but I'm struggling to get it working in production. Has anyone got a:


  1. Capistrano配方来部署工人(控制工人数量,重新启动工人等)

  2. 将工作人员部署到与运行主应用程序的机器分开的机器上,这里需要什么设置?

  3. 为了在服务器上重新引导而幸免于难,redis它在cron中却没有运气)

  4. 您如何将resque-web(其出色的监视应用程序)用于部署?

  1. Capistrano recipe to deploy workers (control number of workers, restarting them, etc)
  2. Deployed workers to separate machine(s) from where the main app is running, what settings were needed here?
  3. gotten redis to survive a reboot on the server (I tried putting it in cron but no luck)
  4. how did you work resque-web (their excellent monitoring app) into your deploy?

谢谢!

PS我在Github上发布了一个与此有关的问题,但尚未回复。希望有一些SO专家可以对此有所帮助,因为我在部署方面经验不足。谢谢!

P.S. I posted an issue on Github about this but no response yet. Hoping some SO gurus can help on this one as I'm not very experienced in deployments. Thank you!

推荐答案

Garrett的回答确实很有帮助,只是想发布更多详细信息。花了很多时间才把它弄对。。。

Garrett's answer really helped, just wanted to post a few more details. It took a lot of tinkering to get it right...

我也在用乘客,但是用的是nginx而不是Apache。

I'm using passenger also, but nginx instead of apache.

首先,不要忘了您需要安装sinatra,这使我花了一段时间。
sudo gem install sinatra

First, don't forget you need to install sinatra, this threw me for a while. sudo gem install sinatra

然后,您需要为要运行的东西创建目录,并且它必须有一个公共和tmp文件夹。它们可以是空的,但问题是git不会在存储库中保存空目录。该目录中必须至少包含一个文件,因此我制作了一些垃圾文件作为占位符。这是git中的怪异功能/错误。

Then you need to make a directory for the thing to run, and it has to have a public and tmp folder. They can be empty but the problem is that git won't save an empty directory in the repo. The directory has to have at least one file in it, so I made some junk files as placeholders. This is a weird feature/bug in git.

我使用的是resque插件,因此我在那里建立了目录(默认的config.ru在其中)。看来Garrett在他的rails_root中建立了一个新的 resque目录。任一个应该起作用。对我来说...

I'm using the resque plugin, so I made the directory there (where the default config.ru is). It looks like Garrett made a new 'resque' directory in his rails_root. Either one should work. For me...

cd MY_RAILS_APP/vendor/plugins/resque/
mkdir public 
mkdir tmp
touch public/placeholder.txt
touch tmp/placeholder.txt

然后我编辑了 MY_RAILS_APP / vendor / plugins / resque / config.ru ,看起来像这样:

Then I edited MY_RAILS_APP/vendor/plugins/resque/config.ru so it looks like this:

#!/usr/bin/env ruby
require 'logger'

$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/lib')
require 'resque/server'

use Rack::ShowExceptions

# Set the AUTH env variable to your basic auth password to protect Resque.
AUTH_PASSWORD = "ADD_SOME_PASSWORD_HERE"
if AUTH_PASSWORD
  Resque::Server.use Rack::Auth::Basic do |username, password|
    password == AUTH_PASSWORD
  end
end

run Resque::Server.new

不要忘记将 ADD_SOME_PASSWORD_HERE 更改为您要用来保护应用程序的密码。

Don't forget to change ADD_SOME_PASSWORD_HERE to the password you want to use to protect the app.

最后,我正在使用Nginx,所以这是我添加到我的nginx.conf中的内容。

Finally, I'm using Nginx so here is what I added to my nginx.conf

server {
  listen   80;
  server_name  resque.seoaholic.com;
  root /home/admin/public_html/seoaholic/current/vendor/plugins/resque/public;
  passenger_enabled on;
}

因此它会在您的部署中重新启动,可能在您的部署中这样.rb

And so it gets restarted on your deploys, probably something like this in your deploy.rb

run "touch #{current_path}/vendor/plugins/resque/tmp/restart.txt"

我不确定这是否是最好的方法,我之前从未设置过机架/ sinatra应用程序。

I'm not really sure if this is the best way, I've never setup rack/sinatra apps before. But it works.

这只是为了使监视应用程序继续运行。接下来,我需要找出神的部分。

This is just to get the monitoring app going. Next I need to figure out the god part.

这篇关于如何在生产中部署应急人员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆