如何在启动时自动创建 resque Worker? [英] How do I create a resque worker automatically at bootup?

查看:61
本文介绍了如何在启动时自动创建 resque Worker?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我正在制作我的第一个 ruby​​ 应用程序.谁知道把所有东西都转移到生产"上是如此复杂.到目前为止,我一直在努力配置乘客,让它在启动时运行,然后让 redis 在启动时运行.

Ok, I'm making my first ruby app. Who know moving everything over to 'production' is so fugging complicated. So far I've struggled my way through configuring passenger, getting it to run on startup, then getting redis to run on startup.

我的最后一个任务是在启动时添加 1 个工人.现在,我必须通过 ssh 进入并运行我的 rake 命令 rake workers:start.显然,当我想关闭 ssh 时,这不好.所以我真的不知道下一步是什么或什么.

My last task is on startup to add 1 worker. Right now, I have to ssh in and run my rake command rake workers:start. Obviously this is no good when I want to close ssh.. so I just dont really know how or what the next step is.

我尝试将 resque 默认配置复制到 config.ru 并且它只是因为错误而炸毁了乘客.我还研究了一些人提到的 resque-pool,但那是我无法理解的.

I tried copying resque default config to config.ru and it just blows up Passenger with errors. I also looked into resque-pool which some people mentioned but that is over my head.

我所要做的就是在启动时添加 1 个工人.这不是那么严重的应用程序,在这一点上最好是简单的.

all i have to do is add 1 worker on bootup. This isnt that serious of an app so simpler would be best at this point.

推荐答案

在生产环境中你应该使用 god观看您的流程.即使这个项目很小,我也强烈建议您投入时间并进行设置.

In production you should be using god to watch your processes. Even if this project is a small one, I strongly recommend investing your time and setting it up.

另一个重要的必须Capistrano.

所以,如果你使用的是 God,这里有一个 配置文件 对你有帮助.

So, if you were using god, here's a config file that would help you.

您也可以尝试在系统启动时使用 /etc/init.d//etc/init 中的适当脚本来安排 rake resque:work/ 或其他(取决于您使用的系统).我前段时间尝试过这个,但我放弃了(不记得为什么).

You could also try scheduling rake resque:work at system startup, using a proper script in /etc/init.d/ or /etc/init/ or another (depends on what system you use). I tried this some time ago and I gave up (don't remember why).

我知道这不是您现在正在寻找的答案.但是想象一下:如果一切都设置好了,那么部署下一个版本就像在你的开发机器上运行 rake deploy 一样简单.它将负责从存储库中提取代码、运行迁移、重新启动工作程序和网络服务器等等.

I understand that this my answer isn't exactly what you're looking for right now. But imagine this: if everything is set up, then deploying next version is as easy as running rake deploy on your development machine. And it will take care of pulling your code from repository, running migrations, restarting workers and webservers and what not.

这篇关于如何在启动时自动创建 resque Worker?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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