Restarting nodejs application within Docker container

Hi, I’d like to have the ability to restart the nodejs application, if it ever crashed. Something like monit, but then using Docker/Resin.io. Do you support this feature?

Hey Robin,

Do you mean an automatic restart of a container if your main process crashes? We currently only support a manual restart, if you go to your application dashboard’s actions tab you’ll see a restart button. (see screen shot) However this will restart the containers across all the devices associated with that application.

You could also update a per device environment variable which would only restart that devices container.

Cheers,
Craig

Thanks Craig, that helps a lot. But I was indeed talking about my main process crashing on just one device. Ideally there should be a trigger that could restart it. Technically resin.io already knows when the process stopped (log will say “Application Stopped”), so it should be quite easy to integrate an auto-restart feature, right?

Either way, such a feature would be really nice to have.

Hey,

Its definitely in the roadmap but it’s still a while off. Our new images, which we will be released this week, will keep your container open and running even if you scripts throws an error. Meaning that you could run a monitoring service like mmonit.

Left me know if you need any help with implementation. :smile:

Ok perfect, thanks Craig.

Hey Robin,

Your question encouraged me to play around with node process manager (pm2) on a resin device. It maybe of interest if you haven’t already solved the problem.

You can read about it here

Cheers,
Craig