Skip to content

Instantly share code, notes, and snippets.

@rgov
Last active December 12, 2022 23:52
Show Gist options
  • Save rgov/55d8c7d800f4d72fe1aa7e585a7261dc to your computer and use it in GitHub Desktop.
Save rgov/55d8c7d800f4d72fe1aa7e585a7261dc to your computer and use it in GitHub Desktop.
Example of using supervisord in a container
FROM debian:buster
# Install system dependencies
RUN apt update \
&& apt install -y \
supervisor \
&& rm -rf /var/lib/apt/lists/*
COPY supervisord.conf /etc/supervisor/supervisord.conf
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
[supervisord]
nodaemon=true
[program:proc_a]
command=python3 -m http.server
directory=/website
[program:proc_b]
command=/usr/bin/b
# Shut down supervisord if any process exits
# https://stackoverflow.com/a/64398319
[eventlistener:shutdown]
command=bash -c "echo READY; read LINE; echo Got event: $LINE >&2; kill -SIGQUIT $PPID"
events=PROCESS_STATE_STOPPED,PROCESS_STATE_EXITED,PROCESS_STATE_FATAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment