dashersw / docker-node-pm2

A pm2 application container for docker.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make snippet up-start backed

BeOleg opened this issue · comments

What will happen if pm2 will crush?

PM2 is running in no-daemon mode, so the container would stop. You would need to run your containers with --restart=always so that the container restarts on failure.

Well, we would not like no induce a full restart, since we pull some configs on that boot of the container...
Is there a problem omitting the no-daemon option?
Thanks!

So... upstart won't work because of this:
moby/moby#1024

would it make sense to make pm2 backed by supervisord?

Omitting no-daemon would stop the container as soon as it launches, because PM2 would run in the background. Docker containers need a front-running application.

Actually, PM2 is at least as reliable as supervisord, from my personal experience. So I would trust it. If it would crash due to some unknown reason, it should be OK to restart the container.

Docker containers are supposed to be disposable: it shouldn't make much difference to restart them. If you need to run some tasks only when the container is started for the first time, I would suggest to solve them on your application code.

Alright, thanks.
Our problem is that currently our app runs on one node, and because of config pulling, the theoretical situation of restarting the container will cause several seconds of downtime, which is not exactly good for business.

Can you store the configuration locally? In case of a restart, you could reload the configuration locally for zero downtime and then fetch—and update if necessary.