What do you folks think is the best way to do process management? Right now I use honcho (Python foreman equivalent) inside the container to run processes. What I’m worried about is what would happen if the process dies due to some error. Do you think something like supervisord should be used (which is possible inside Docker) to enable auto-restarts? Will Resin’s supervisor auto-restart the Docker container in case it dies (i.e. the main CMD process dies – honcho in my case)?
I am not sure how possible this is with foreman, but that is mainly because I have never used it and I am not sure how to specify auto-restart there. I know thought you can use foreman export to send your process to another
manager e.g. supervisord, systemd, upstart. Supervisord and systemd will provide you with the possibility of specifying auto-restart in case your entry point will die (This is well documented here). Now because we use systemd in our O.S. we prefer this option when it comes to process management.
So, both options (i.e. superviord, systemd, maybe even honcho?) should provide you the auto-restart option, but we would recommend systemd as it will make our lives easier when it comes to support.
Not sure how helpful this is, but there’s also a demo on how to use resin with pm2: https://resin.io/blog/eternal-applications-with-pm2-and-resin-io/
Thanks, @alexandros, might be useful for some of the readers. I’m mostly in Python-land, so I’m trying to avoid bringing in too many tools from other languages.
I’ve been using supervisor myself, works great and isn’t that complicated to configure. With the Debian base image, just place your .ini -files to
/etc/supervisor/conf.d and start supervisord by calling
supervisord -n -c /etc/supervisor/supervisord.conf.
A basic example of a .ini file:
[program:my_application] user = root command = /app/my_application.py autostart = true autorestart = true startsecs = 5