Skip to main content

A plugin for Supervisor that allows starting up services after dependent services have reached specific states. Based on ordered-startup-supervisord by Jason Corbett

Project description

Dependency 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 in supervisor.conf as an event listener.

[eventlistener:dependentstartup]
command=python -m supervisord_dependent_startup
autostart=true
autorestart=unexpected
startretries=0
exitcodes=0,3
events=PROCESS_STATE

Service configuration options

There are three configuration options for a service ([program:*]) to control how it is processed by supervisord-dependent-startup

dependent_startup

Mark this service to be handled by supervisord-dependent-startup. This must be set to true for all services that depend on other services or is being depended on by other services.

Type bool
Required yes
Note When setting this to true, autostart must be set to false

dependent_startup_wait_for

Specify the services this service depends on before in can be started.

Type str
Required no
Format dependent_startup_wait_for=<parent-service>:<state[,state[..]]> [..]
Note state must one or more comma separated values of: starting, running, backoff, stopping, exited, fatal
Example with one dependency

To have a service named child depend on a service parent: dependent_startup_wait_for=parent:running

Example with two dependencies

Multiple dependencies are separated by a white space. To have a service named child depend on the services parent1 and parent2: dependent_startup_wait_for=parent1:running parent2:running

dependent_startup_inherit_priority

Specify if the service should inherit its priority from the services it depends on.

Type bool
Required no
Example dependent_startup_inherit_priority=true

Building and testing

Run tests

python setup.py test

Create source dist

python setup.py sdist

Run tests and code syntax check

tox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

supervisord-dependent-startup-1.3.2.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

supervisord_dependent_startup-1.3.2-py2.py3-none-any.whl (31.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file supervisord-dependent-startup-1.3.2.tar.gz.

File metadata

  • Download URL: supervisord-dependent-startup-1.3.2.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.14

File hashes

Hashes for supervisord-dependent-startup-1.3.2.tar.gz
Algorithm Hash digest
SHA256 540d642c56c5c784a02ae9c1ceb79bff788f222a7fbc3df3316f0df00f8171cb
MD5 2e245784e86f42184498a63b84f4ddfe
BLAKE2b-256 0728de04cdf8b4ff939d696534c5af409da43fe0e9aa583cbfe02493a6a8771f

See more details on using hashes here.

File details

Details for the file supervisord_dependent_startup-1.3.2-py2.py3-none-any.whl.

File metadata

  • Download URL: supervisord_dependent_startup-1.3.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 31.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.14

File hashes

Hashes for supervisord_dependent_startup-1.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6dc4c84911b8b2ad1db7eb27f45d76b60ff847feb90b2f91691dbf47370fc1bc
MD5 3f6da9970f493e8832d76238fb8a3d75
BLAKE2b-256 651d4e2b1a94f66977c7e885e169988a223498ea9b49575d0b6524a6744db230

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page