From supervisord
runwisp import supervisord converts a supervisord config into runwisp.toml.
Each [program] becomes a RunWisp service.
Convert the config
Section titled “Convert the config”runwisp import supervisord /etc/supervisor/supervisord.conf -o runwisp.tomlrunwisp validatePass the file path rather than piping it in. With a path, [include] files are
found and merged; piped input has no location to resolve them from.
Given:
[program:web]command=/usr/bin/gunicorn app:appdirectory=/srv/appuser=www-datastartsecs=10startretries=5stopsignal=INTenvironment=DJANGO_SETTINGS="prod",LOG_LEVEL=infostdout_logfile=/var/log/web.log
[program:worker]command=/srv/app/worker --idx %(process_num)snumprocs=4you get:
[services.web]run = "/usr/bin/gunicorn app:app"working_dir = "/srv/app"user = "www-data"healthy_after = "10s"restart_attempts = 5stop_signal = "SIGINT"
[services.web.env]DJANGO_SETTINGS = "prod"LOG_LEVEL = "info"
[services.worker]run = "/srv/app/worker --idx %(process_num)s"instances = 4A summary on stderr has one row per program, marked ✓ (mapped), ~
(changed, with the reason), ! (needs a fix), or - (already in your config).
Here, web is ~ because its log file setting was dropped, and worker is !
because %(process_num)s isn’t filled in.
If you already have a runwisp.toml, use --write instead of -o; see
Staging and promoting. All flags are
in the CLI reference.
Stop the programs in supervisord
Section titled “Stop the programs in supervisord”The import doesn’t stop supervisord or edit its config. If both run the same program, you get two copies fighting over ports or queues. Stop them first:
sudo supervisorctl stop web worker # the programs you importedThen remove them from supervisord’s config, so a reload or reboot doesn’t start them again:
sudo cp /etc/supervisor/supervisord.conf ~/supervisord.conf.backupsudo $EDITOR /etc/supervisor/supervisord.conf # or the conf.d/ filesudo supervisorctl reread && sudo supervisorctl updateWhen nothing is left, sudo systemctl disable --now supervisor stops
supervisord itself. You can move a few programs at a time; just never leave
one enabled in both.
How the pieces map
Section titled “How the pieces map”| supervisord | runwisp.toml | Notes |
|---|---|---|
[program:web] |
[services.web] |
|
command |
run |
%(program_name)s is filled in. |
directory |
working_dir |
|
user |
user |
The daemon must run as root to switch users. |
umask |
umask |
|
numprocs |
instances |
Each gets RUNWISP_INSTANCE_INDEX (from 0). |
startsecs |
healthy_after |
|
startretries |
restart_attempts |
|
stopsignal |
stop_signal |
INT becomes SIGINT. |
stopwaitsecs |
graceful_stop |
|
priority |
priority |
|
autostart |
autostart |
|
environment |
env |
|
autorestart |
restart |
false becomes a task. See below. |
exitcodes |
(dropped) | See below. |
stdout_logfile and similar |
(dropped) | RunWisp captures output for every run. |
[group:site] programs=web,… |
group = "site" on each member |
|
[include] files=conf.d/*.conf |
(followed and merged) | Relative to the config file. |
What needs a human
Section titled “What needs a human”Anything that can’t be mapped gets a # TODO in the TOML and a note on the
program’s row. Unknown keys are dropped and listed by name.
autorestart.autorestart=truebecomes a service with RunWisp’s defaultrestart, which restarts after any exit.unexpected(supervisord’s default) becomesrestart = "on_failure"; RunWisp counts any non-zero exit as a failure, where supervisord goes byexitcodes.false,no,off, and0mean the program runs once, so it becomes a task withrun_on_start = true. Like under supervisord, it runs again whenever the daemon starts.exitcodes. RunWisp treats exit0as success and anything else asfailed. If your program exits non-zero on purpose, end itsrunwith|| true.failurescontrols which outcomes count for alerts.%(...)sexpansions. Only%(program_name)sis filled in. For%(process_num)s, use$RUNWISP_INSTANCE_INDEXin the command. Others, like%(ENV_x)s, need a manual edit.- Log files. Dropped. To control log size and retention, see Logs.
- supervisord’s own sections (
[supervisord],[supervisorctl],[unix_http_server],[inet_http_server],[rpcinterface]) are skipped with a note. RunWisp’s own settings are in[daemon]. [eventlistener]and[fcgi-program]are not supported. They get a!row so you know to replace them another way.
Learn more
Section titled “Learn more”[services.*]- Tasks vs services
- From cron, for scheduled jobs