Tornado代码部署

发布于 2024-11-30 07:49:25 字数 574 浏览 2 评论 0原文

是否有针对基于龙卷风的 Web 应用程序部署的规范代码部署策略。我们当前的配置是在NginX后面运行4个tornado进程? (我们的具体用例是在 EC2 后面。)

我们目前已经有了一个运行良好的解决方案,我们可以启动四个龙卷风进程并将 PID 保存到 /tmp/ 中的文件中。部署新代码后,我们通过 Fabric 运行以下序列:

  1. 从 prod 分支执行 git pull。
  2. 从负载平衡器上卸下机器。
  3. 等待所有航班转机结束后睡觉。
  4. 杀死pid文件中的所有龙卷风并删除所有*.pyc文件。
  5. 重新启动龙卷风。
  6. 将机器连接回负载平衡器。

我们从中获得了一些灵感: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:

  1. Do a git pull from the prod branch.
  2. Remove the machine from the load balancer.
  3. Wait for all in flight connections to finish with a sleep.
  4. Kill all the tornadoes in the pid file and remove all *.pyc files.
  5. Restart the tornadoes.
  6. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

熟人话多 2024-12-07 07:49:25

我们运行Tornado+Nginx,并以supervisord作为supervisor。

示例配置(名称已更改)

[program:server]
process_name = server-%(process_num)s
command=/opt/current/vrun.sh /opt/current/app.py --port=%(process_num)s
stdout_logfile=/var/log/server/server.log
stderr_logfile=/var/log/server/server.err
numprocs = 6
numprocs_start = 7000

我还没有找到重新启动事物的“最佳”方法,我最终可能要做的是让 Nginx 有一个“活动”文件,该文件已更新,让 HAProxy 知道我们正在搞乱配置然后稍等一下,交换一下内容,然后重新启用所有内容。

我们正在使用 Capistrano(我们有一个积压任务需要转移到 Fabric),但我们不是处理删除 *.pyc 文件,而是将 /opt/current 符号链接到发布标识符。

We run Tornado+Nginx with supervisord as the supervisor.

Sample configuration (names changed)

[program:server]
process_name = server-%(process_num)s
command=/opt/current/vrun.sh /opt/current/app.py --port=%(process_num)s
stdout_logfile=/var/log/server/server.log
stderr_logfile=/var/log/server/server.err
numprocs = 6
numprocs_start = 7000

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.

烙印 2024-12-07 07:49:25

我还没有在生产中部署 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文