开发者

What happens to active user sessions when you redeploy an application?

I'm moving to ruby/rails from php, and one of the things I've always been curious about is that in php if I want to make a live change, I can simply edit the file, click save and it's active (assuming I'm editing on live env); no application redeploy or downtime for my users.

With rails, almost any change I make, requires the application to be redeployed (I think?).

When I make a redeployment of a live application, what happens to all the live user's sessions who are using the application, does it force them out and require them开发者_StackOverflow to re-login again? what if they refresh as the app is being re-deployed, do they see an error?

Sorry if this has an obvious answer, but I couldn't see it in my books/tutorial. Thank you


Rails store session in cookie (by default), so you don't loose it after deploy. And most actions are stateless, all you want are passed through params or url address (routes).

What your users see when you deploy depends on your server and strategy for deployment.


When you are running your rails application in PROD settings, you have to restart your server for the code to effect. You can choose to store session either in database, file store, cookie. Cookie has a limitation of how much size you can use. So the best way is to use database which will store your sessions across session restart.


Rails supports multiple ways to store sessions, including database and file store. In this case they won't have to re-login. You'll have to restart your server for the rails code changes to be deployed though, but that usually takes seconds.


You may take a look at production.rb environment for the line

config.cache_classes = true

If you have it set to false, you will (in some cases) be able to apply changes without redeployment (i.e. server restart).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜