A plugin for Supervisor that allows starting up services after dependent services have reached specific states. Based on ordered-startup-supervisord by Jason Corbett
Likely abandoned. No release or commit for years (last release over 7 years ago).
pip install supervisord-dependent-startupDependency support when starting Supervisor services
supervisord-dependent-startup is a plugin for
Supervisor that allows starting up services after
dependent services have reached specific states. This plugin is based on
ordered-startup-supervisord
by Jason Corbett.
The Problem
The problem can be seen in supervisor bug
#122. The priority order
in supervisor does determine startup order, but when autostart=true supervisor
doesn't wait for the previous process to be RUNNING in order to continue. What
is even harder is having initialization scripts that need to exit before
continuing. This software is meant to make this one use case easier.
How it works
This is an event listener for supervisor. This means it is run by supervisor on startup and supervisor will send it messages whenever a service reaches a particular process state. When configured it will wait till a supervisor subprocess gets to the configured state before starting dependent services.
Caveats
The plugin does not start groups. It can start services that are part of a group, but it won't directly start a group.
Installing
# From pypi
pip install supervisord-dependent-startup
# From github:
pip install -e git+https://github.com/bendikro/supervisord-dependent-startup.git#egg=supervisord-dependent-startup
Configuration
Configuration requires several things. First you need to configure
supervisord-dependent-startup as an event listener by adding the following to supervisor.conf:
[eventlistener:dependentstartup]
command=python -m supervisord_dependent_startup
autostart=true
autorestart=unexpected
startretries=0
exitcodes=0,3
events=PROCESS_STATE
A working /etc/supervisor.conf can look like this:
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
[supervisord]
logfile=/tmp/supervisord.log
loglevel=info
pidfile=/var/run/supervisord.pid
nodaemon=false
minfds=1024
minprocs=200
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock
[eventlistener:dependentstartup]
command=python -m supervisord_dependent_startup
autostart=true
autorestart=unexpected
startretries=0
exitcodes=0,3
events=PROCESS_STATE
[include]
files = /etc/supervisord.d/*.ini