Deploying with running Gen Servers

Hello there!

I’ve not tested this yet but I imagine that deploying with a running gen server will just kill all the current ephemeral state in my app. This would be quite unfortunate - is there a methodology of running two versions of the API maybe - one for new requests and one for any currently running gen servers. That gets quite complicated quite quickly.

Maybe I should just use something like redis for state then rather than use the power of elixir because it will definitely be easier to do live deploys under such circumstances. I could just ignore this issue and have a 15 minute slot every day where no classes can be run.

This is the best I have found so far: Available choices to keep state across deployments? - Questions / Help - Elixir Programming Language Forum

I actually wonder if just having two logic servers is best and telling new clients on connection which version of the API they should join for new games. So have a simple “latest api” endpoint that is connected to before any requests are made and then Live 1 → Live 2 → Live 1. This will mean I can deploy as I like once and then need to wait for a class to finish before deploying again.

It’s better than a 15 minute slot that is for sure.

Another alternative could be that classes are written to DB on save and the channel is effectively wrapped in a “cached” channel where push/broadcast etc. are saved up until reconnection to a new node happens. This seems much more problematic and error prone that the client connecting to different APIs.