Tornado代码部署
是否有针对基于龙卷风的 Web 应用程序部署的规范代码部署策略。我们当前的配置是在NginX后面运行4个tornado进程? (我们的具体用例是在 EC2 后面。)
我们目前已经有了一个运行良好的解决方案,我们可以启动四个龙卷风进程并将 PID 保存到 /tmp/ 中的文件中。部署新代码后,我们通过 Fabric 运行以下序列:
- 从 prod 分支执行 git pull。
- 从负载平衡器上卸下机器。
- 等待所有航班转机结束后睡觉。
- 杀死pid文件中的所有龙卷风并删除所有*.pyc文件。
- 重新启动龙卷风。
- 将机器连接回负载平衡器。
我们从中获得了一些灵感:http://agiletesting。 blogspot.com/2009/12/deploying-tornado-in-production.html
还有其他完整的解决方案吗?
Is there a canonical code deployment strategy for tornado-based web application deployment. Our current configuration is 4 tornado processes running behind NginX? (Our specific use case is behind EC2.)
We've currently got a solution that works well enough, whereby we launch the four tornado processes and save the PIDs to a file in /tmp/. Upon deploying new code, we run the following sequence via fabric:
- Do a git pull from the prod branch.
- Remove the machine from the load balancer.
- Wait for all in flight connections to finish with a sleep.
- Kill all the tornadoes in the pid file and remove all *.pyc files.
- Restart the tornadoes.
- Attach the machine back to the load balancer.
We've taken some inspiration from this: http://agiletesting.blogspot.com/2009/12/deploying-tornado-in-production.html
Are there any other complete solutions out there?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们运行Tornado+Nginx,并以supervisord作为supervisor。
示例配置(名称已更改)
我还没有找到重新启动事物的“最佳”方法,我最终可能要做的是让 Nginx 有一个“活动”文件,该文件已更新,让 HAProxy 知道我们正在搞乱配置然后稍等一下,交换一下内容,然后重新启用所有内容。
我们正在使用 Capistrano(我们有一个积压任务需要转移到 Fabric),但我们不是处理删除 *.pyc 文件,而是将 /opt/current 符号链接到发布标识符。
We run Tornado+Nginx with supervisord as the supervisor.
Sample configuration (names changed)
I've yet to find the "best" way to restart things, what I'll probably finally do is have Nginx have a "active" file which is updated letting HAProxy know that we're messing with configuration then wait a bit, swap things around, then re-enable everything.
We're using Capistrano (we've got a backlog task to move to Fabric), but instead of dealing with removing *.pyc files we symlink /opt/current to the release identifier.
我还没有在生产中部署 Tornado,但我一直在使用 Gevent + Nginx 并一直在使用 Supervisord 进行流程管理 - 启动/停止/重新启动、日志记录、监控 -supervisorctl 对此非常方便。就像我说的,这不是一个部署解决方案,但也许是一个值得使用的工具。
I haven't deployed Tornado in production, but I've been playing with Gevent + Nginx and have been using Supervisord for process management - start/stop/restart, logging, monitoring - supervisorctl is very handy for this. Like I said, not a deployment solution, but maybe a tool worth using.