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.
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.