部署后如何使Nginx和乘客自动重新启动 [英] How do i make nginx and passenger restart automatically after a deploy

查看:88
本文介绍了部署后如何使Nginx和乘客自动重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在虚拟专用服务器上部署了Rails应用.

I currently have a rails app deployed on a virtual private server.

我使用Capistrano,Nginx和passenger在服务器上运行rails应用程序.

I use Capistrano, Nginx and passenger to run my rails app on the server.

出于某种原因,我在进行上限部署:更新后就无法在网站上显示更新的代码.

For some reason I can never get the updated code to display on the site after i have done a cap deploy:update.

部署进行得很好,甚至可以通过Vim在实时服务器上看到代码,但是如果我导航到实时站点,它将不会显示.

The deploy happens fine and the code is even seen on the live server via Vim but if I navigate to the live site it won't display.

我当前的解决方法是重新引导服务器,并在服务器启动后启动nginx和passenger.

My current workaround is rebooting the server, starting nginx and passenger after the server boots back up.

我担心的是,如果在我部署并重新启动时有人登录到该站点,它将把他们赶出该站点.

my concern is if someone is logged on to the site when i deploy and restart, it will knock them off the site.

有人有什么想法

推荐答案

如果从rails根目录运行touch tmp/restart.txt,乘客将重新启动该应用程序.您不必重启nginx.在restart.txt文件的时间戳更改之后,Passenger将为下一个请求重新启动.如果您的应用需要花一些时间才能启动,则可能需要在触摸文件后立即发出请求来强制执行此操作.

If you run touch tmp/restart.txt from your rails root directory, passenger will restart the app. You shouldn't have to restart nginx. After the timestamp of the restart.txt file changes, Passenger will restart for the next request. If your app takes a while to boot, you may want to force this by making a request immediately after touching the file.

您不必担心将某人踢出网站,如果有正在处理的请求,它也不会重新启动服务器.

You don't need to worry about kicking someone off the site, it won't restart the server if there is a request in process.

这篇关于部署后如何使Nginx和乘客自动重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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