Reputation: 4356
I have a Docker container running Supervisor with 2 processes:
I want Supervisor to exit when one of these processes returns an error.
This is my configuration:
[supervisord]
nodaemon=true
loglevel=debug
logfile=/app/supervisord.log
pidfile=/var/run/supervisord.pid
childlogdir=/app
[program:django]
command=python manage.py runserver 0.0.0.0:8000
redirect_stderr=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
[program:celery]
command=celery -A myapp worker --beat --scheduler django --loglevel=debug
redirect_stderr=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
[eventlistener:processes]
command=bash -c "printf 'SUPERVISORD READY' && while read line; do kill -SIGQUIT $PPID; done < /dev/stdin"
events=PROCESS_STATE_STOPPED,PROCESS_STATE_EXITED,PROCESS_STATE_FATAL
When I have a fatal error that should normally make Docker exit, Supervisor tries to launch Django again and again.. while the goal is to exit.
What's missing here? I tried different other configurations but it's not working.
Upvotes: 1
Views: 1892
Reputation: 15738
As documented [autorestart
]
Default: unexpected
If unexpected, the process will be restarted when the program exits with an exit code that is not one of the exit codes associated with this process’ configuration (see exitcodes)
Upvotes: 1