Our app is in prod mode now.
How can I update the server code?
Issue: It might have a chance that someone is accessing a server or doing some CRUD. It may impact the data and we have some payment-related things as well.
CodePudding user response:
A reasonably easy and straight-forward way is a blue-green deployment. (Unlike what the Wikipedia article says, the instances don't need to be physical servers, just app instance listening on multiple ports on the same server, for instance. )
Assuming you'd be upgrading from version 1 to version 2:
- Your frontend load balancer (e.g. ELB) directs traffic to version 1.
- You deploy version 2.
- You configure ELB to start directing traffic to version 2 and stop directing to version 1.
- Once there is no traffic to version 1, you shut it down.
Extra care must of course be taken if version 2 involves e.g. database schema changes that aren't compatible with version 1.