We're using pm2 [1] for this if anyone's interested.
Writing Dockerfiles for Node.js Web Apps
11–20 of 37 posts
Re: Writing Dockerfiles for Node.js Web Apps
#12Re: Writing Dockerfiles for Node.js Web Apps
#13I'm surprised they haven't included a process manager for the production build. In my experience it allows for much easier 0-sec downtime updates and load balancing. We're using pm2 [1] for this if anyone's interested. [1] https://github.com/Unitech/pm2
Re: Writing Dockerfiles for Node.js Web Apps
#14Docker recreates many of the benefits the Java platform has had from the start (in addition to some other aspects but that's the main selling pont). So, if you have a non-Java application Docker might indeed be a worthwhile choice. The thing is, even with Java platform-independence and deployment standardization for web apps / SaaS-type applications has always been a minor selling point.
Those features are certainly important if you need to rapidly provision and scale your application on many different machines in a distributed environment you don't completely control.
In reality, for many applications today this simply isn't the case though. The main motivator behind that feature after all was the concept of desktop applications that are deployed to each user individually.
So, with Docker we now indiscriminately add an additional layer of complexity on top of existing applications regardless of the actual problems this might solve.
Re: Writing Dockerfiles for Node.js Web Apps
#15I'm surprised they haven't included a process manager for the production build. In my experience it allows for much easier 0-sec downtime updates and load balancing. We're using pm2 [1] for this if anyone's interested. [1] https://github.com/Unitech/pm2
If you use container orchestration platforms like Kubernetes, this is not required, as restarts load balancing etc. are handled by the orchestrator.
Re: Writing Dockerfiles for Node.js Web Apps
#16> Using an appropriate base image (carbon for dev, alpine for production). Isn't using the same container everywhere the actual selling point for containers?
Re: Writing Dockerfiles for Node.js Web Apps
#17Earlier quoted context omitted.
If you use container orchestration platforms like Kubernetes, this is not required, as restarts load balancing etc. are handled by the orchestrator.
Does Kubernetes support graceful reload of containers, with 0 downtime? I'd be very interested if so.
Re: Writing Dockerfiles for Node.js Web Apps
#18Earlier quoted context omitted.
If you use container orchestration platforms like Kubernetes, this is not required, as restarts load balancing etc. are handled by the orchestrator.
Does Kubernetes support graceful reload of containers, with 0 downtime? I'd be very interested if so.
Re: Writing Dockerfiles for Node.js Web Apps
#19Earlier quoted context omitted.
If you use container orchestration platforms like Kubernetes, this is not required, as restarts load balancing etc. are handled by the orchestrator.
Does Kubernetes support graceful reload of containers, with 0 downtime? I'd be very interested if so.
One scenario is that when you rollout a new version, the old container will only be killed when new one is up and running. If there are many replicas running, Kubernetes will replace them with new versions one by one. And all of this behaviour is highly configurable.
[1] https://kubernetes.io/docs/tutorials/kubernetes-basics/updat...
Re: Writing Dockerfiles for Node.js Web Apps
#20Nice post, and very close to my experiences with Dockerfiles for node. To the author: could you elaborate on the differences between carbon and alpine base images please? I can obviously go look this up, but this was the one part of the guide that was new to me. Your description wasn't enough to give me a complete understanding, so perhaps you could explain a bit more about carbon and alpine? Thanks.
carbon is the latest LTS (Long Term Support) version of Node. Instead of using the latest version, which can have breaking changes and possible drop of support in the future, it is recommended to use LTS version just to ensure using a stable + well supported version. alpine base images are generally used to cut down the image size for production, because they are very minimal and works well for most use-cases. But yo…