How to deploy changes without interruption of service?

I am going to start a project with Node , Express and Mongo, but there is one important issue that I must resolve first.

Say I have a working application . Sooner or later, I will encode again and want to deploy the changes . So far, I have only worked in development mode, so there is no need to do a ^ C and restart the server.

How about in production? Obviously, I cannot just destroy the server and all users at once. Is there a way to deploy changes without interrupting a service?

I studied systems like upstart and the like, but this does not solve the problem (or didnโ€™t I miss anything?). I am now considering creating resiliency, but someone must have done it in front of me ...

+4
source share
3 answers

Well, Iโ€™m probably going to take care of a reverse proxy, such as nginx: low memory capacity, able to handle many simultaneous connections and support switching to another resource when I finally have more than one server.

Using this nginx reverse proxy, I can start a new Node process with updated sources, switch to a new Node and switch to the old version.

It will also allow me to save the previous version of the application on the server, in case the new version comes out too soon ...

Links: http://nginx.org/en/docs/control.html

+1
source

Checkout Forever by NodeJitsu. It demonizes the process and automatically restarts the server when something fails. It also has the ability to watch your CWD, so if you do a "git pull" in your repo, your server restarts with a new code.

I have been using this in production as a model based on a traction server for more than a year and have practically no problems.

+1
source

If you care about availability, you need to run the service on several servers, preferably in different physical places. Many events, besides deployment, can shut down a single server. Thus, there is no problem, you take each server offline, deploy it and put it back.

If you don't care about accessibility, there is still no problem.

0
source

All Articles