I have a Flask application running on an Amazon Web Services EC2 Ubuntu Server. When I update the code, I use git to push the latest code to my EC2 instance. However, as users are signed in and are most likely in the middle of something, they are signed out and taken to the sign in page.
As I tend to deploy to my application often this can be an issue. Is there a way using either AWS or Flask on the ubuntu server to prevent this issue? I heard about Amazon's CodeDeploy however, it looks like it only works with Elastic Beanstalk instances.
What can I do? Thanks.
You should use two elastic beanstalk environments: development & production. Push all your immediate changes to the development environment for testing. When you are ready to update the production environment (maybe once a day), use elastic beanstalk's swap environment URLs functionality. This will then direct all users to the newly updated environments while minimizing downtime.
CodeDeploy works with regular EC2 instances and actually won't work with Elastic Beanstalk instances. Try reading up on the CodeDeploy user guide for more information on how to use CodeDeploy.
That still won't solve your actual problem, which is that you are storing session data in your webserver's local memory. If you need to start using multiple hosts behind a loadbalancer you will have the same problem even if you manage to save and reload the state between processes.
There are two options that make sense here:
You can definitely use CodeDeploy to help manage and deploy these different components, but I think you need to look at how you are persisting sessions first.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.