How do you generally hand over the process working on a node deployed?

Behind a Load balancer, say ALB, there are two nodes clustered with Node.connect or some other ways. Thanks to the pg2 or so, the processes working on one node are able to access from the other node or vice versa.

In deploying, I usually stop the node with bin/app stop, copy the files, then restart with bin/app start. There is no problem as long as the other node is working, except for Channels or LiveView because those functions are stateful.

When you use those functions, generally how do you hand over the processes working on the node deployed, aka stopped and re-started?

An architecture I’d love to try out would run a thin web app layer in separate beam nodes from the business logic layer.

The web nodes can then be hot upgraded keeping the phoenix channel processes alive, while the business logic nodes use a regular rolling restart strategy.

Clients will still have to have to gracefully handle disconnections and reconnect, such as when mobile users network is disrupted, but it should avoid the case of all users connected to one node being disconnected at once.

1 Like

Thank you for your reply. It’ll be a little bit complicate architecture but seems to be a reasonable way. I’ll try to consider it.