[supervisord]
logfile={{ control_server_configuration.supervisor_log_file }}
logfile_maxbytes=1MB
logfile_backups=3
loglevel=info
pidfile={{ control_server_configuration.supervisor_run_directory }}/supervisor.pid
umask=022
nodaemon=false
nocleanup=false

[unix_http_server]
file={{ control_server_configuration.supervisor_run_directory }}/supervisor.sock
username=
password=
chmod=0700

[supervisorctl]
serverurl=unix://{{ control_server_configuration.supervisor_run_directory }}/supervisor.sock
username=
password=

[rpcinterface:supervisor]
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface

[program:control-server]
command={{ venv_bin_dir }}/uwsgi --ini {{ control_server_configuration.uwsgi_configuration_file }}
stopsignal=INT
numprocs=1
stdout_logfile={{ control_server_configuration.control_server_stdout_log_file }}
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=3
stderr_logfile={{ control_server_configuration.control_server_stderr_log_file }}
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=3
autostart=true
autorestart=true
startsecs=5
startretries=10
environment=OLD_PATH="%(ENV_PATH)s",PATH="{{venv_bin_dir}}:%(ENV_PATH)s"

[program:agent]
command={{ venv_bin_dir }}/celery worker -A packy_agent.celery_app.app --concurrency 8 --loglevel=info
numprocs=1
stdout_logfile={{ control_server_configuration.agent_stdout_log_file }}
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=5
stderr_logfile={{ control_server_configuration.agent_stderr_log_file }}
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=5
autostart=true
autorestart=true
startsecs=5
environment=OLD_PATH="%(ENV_PATH)s",PATH="{{venv_bin_dir}}:%(ENV_PATH)s"

[program:watchdog]
command={{ venv_bin_dir }}/packy-watchdog
numprocs=1
stdout_logfile={{ control_server_configuration.watchdog_stdout_log_file }}
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=3
stderr_logfile={{ control_server_configuration.watchdog_stderr_log_file }}
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=3
autostart=true
autorestart=true
startsecs=5
startretries=20
environment=OLD_PATH="%(ENV_PATH)s",PATH="{{venv_bin_dir}}:%(ENV_PATH)s"

{% if is_inside_docker_container %}
[program:nginx]
command=/usr/sbin/nginx -g "daemon off;"
stdout_events_enabled=true
stderr_events_enabled=true
{% endif %}
