Supevisord Functions

Tasks for configuring processes which will be managed by Supervisord.

supervisor_command(command)

This is a simple way to execute a supervisorctl command on the remote server similar to the service_command().

upload_supervisor_app_conf(app_name, template_name=None, context=None)

Uploads a configuration to /etc/supervisor/conf.d/<app_name>.conf for managing a new process. If the template_name is not given it will look for templates named supervisor/<app_name>.conf and if not found it will use the supervisor/base.conf included with this project. The app_name parameter is passed in the context and additional context can be provided with the context parameter.

The default supervisor/base.conf is shown below.

[program:{% block name %}{{ app_name }}{% endblock %}]
{% block main %}
command={% block command %}{% endblock %}
{%- if directory -%}directory={{ directory }}{% endif %}
{%- if run_user -%}user={{ run_user }}{% endif %}
{% endblock %}
{% block logging %}
stdout_logfile={{ log_dir|default('/var/log') }}/%(program_name)s.log
redirect_stderr=true
stderr_logfile={{ log_dir|default('/var/log') }}/%(program_name)s.error.log
{% endblock %}
{% block additional %}
{% endblock %}
remove_supervisor_app(app_name)

Deletes the /etc/supervisor/conf.d/<app_name>.conf configuration.

upload_celery_conf(command='celeryd', app_name=None, template_name=None, context=None)

A wrapper around upload_supervisor_app_conf() for managing a Celery process such as celeryd or celerybeat. The app_name defaults to the command and both are pass in the context. A default supervisor/celery.conf is included which will be used instead of supervisor/base.conf if supervisor/<app_name>.conf is not found.

The default supervisor/celery.conf is shown below.

{% extends "supervisor/base.conf" %}

{% block name %}{{ command }}{% endblock %}

{% block command %}{{ bin_dir|default('/usr/local/bin') }}/{{ command }} {{ args }}{% endblock %}

{% block additional %}
stopwaitsecs=60
{% endblock %}
upload_gunicorn_conf(command='gunicorn', app_name=None, template_name=None, context=None)

A wrapper around upload_supervisor_app_conf() for managing a Gunicorn process such as gunicorn or gunicorn_django. The app_name defaults to the command and both are pass in the context. A default supervisor/gunicorn.conf is included which will be used instead of supervisor/base.conf if supervisor/<app_name>.conf is not found.

The default supervisor/gunicorn.conf is shown below.

{% extends "supervisor/base.conf" %}

{% block name %}{{ app_name|default('gunicorn') }}{% endblock %}

{% block command %}{{ bin_dir|default('/usr/local/bin') }}/{{ command|default('gunicorn') }} {{ args }}{% endblock %}

Project Versions

Previous topic

Postgres Functions

Next topic

RabbitMQ Functions

This Page