Nodejs deploy in production

5

What are the best practices for doing deploy in production of a Node.JS application?

I would like to know how the deploy in production of API's Node.JS is done today. My application is now dockerized and running in the local environment.

I would also like to know if I should use Nginx inside the container and either deploy my server on it or simply upload my Node image, which is already running today.

    
asked by anonymous 18.03.2017 / 17:14

1 answer

0

In general, there are some good practices to follow, below I'll list them:

1) Build, if you are using some transpiler, such as Babel or TS, it is recommended to buildar for JS in the version of your server.

2) Do not use Process Manager, such as PM2 or Nodemon, as they manage processes and open processes, I recommend that you use Kubernetes or Docker Swarm to cluster the application, they are more considerate and efficient in this regard, unless you have a application of a single server instance.

3) Have a loadbalancer

4) Avoid exposing your API publicly, always keep exposed Balancer forward,

5) Avoid clustering within your native Node application, it tends to consume more resources and generate complexity.

6) Make a URL even if not exposed to the health check audience, basically a URL that checks if all the services your application depends on are available or even your application.

References link

    
03.01.2019 / 15:14