loading...

re: Blue/Green Node.js Deploys with NGINX VIEW POST

FULL DISCUSSION
 

I think there was a great learning experience in all of this, but here are some resources to consider researching if you haven't:

  • Ansible - makes managing remote servers easier, especially the bit about running a script remotely
  • Haproxy - reverse proxy to use instead of nginx, might be better at swapping backends gracefully
  • Kubernetes (potentially too heavy for this use, but handles basically everything you built here)

Also just a note from the outside about the port switching: your solution chooses a random port and checks if it is available. You could apply this logic to the original idea of swapping between 2 ports. Port A is the default, check if Port A is available. If it is, use it. If it isn't, use Port B. No state to keep track of, you're just dynamically choosing whether to use the port or to use an alternate one.

 

Thank you. That's helpful. I particularly like your idea about how to get rid of the random port generation. That would remove the need for cleaning up the old code (because I would only ever have two copies of it on the machine, instead of up to 1,000) and would open the path to quick rollbacks.

 

That's a great point about the quick rollbacks. It would make the blue/green nature even better.

Code of Conduct Report abuse