Skip to content

From supervisord

runwisp import supervisord converts a supervisord config into runwisp.toml. Each [program] becomes a RunWisp service.

Terminal window
runwisp import supervisord /etc/supervisor/supervisord.conf -o runwisp.toml
runwisp validate

Pass 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:app
directory=/srv/app
user=www-data
startsecs=10
startretries=5
stopsignal=INT
environment=DJANGO_SETTINGS="prod",LOG_LEVEL=info
stdout_logfile=/var/log/web.log
[program:worker]
command=/srv/app/worker --idx %(process_num)s
numprocs=4

you get:

[services.web]
run = "/usr/bin/gunicorn app:app"
working_dir = "/srv/app"
user = "www-data"
healthy_after = "10s"
restart_attempts = 5
stop_signal = "SIGINT"
[services.web.env]
DJANGO_SETTINGS = "prod"
LOG_LEVEL = "info"
[services.worker]
run = "/srv/app/worker --idx %(process_num)s"
instances = 4

A 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.

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:

Terminal window
sudo supervisorctl stop web worker # the programs you imported

Then remove them from supervisord’s config, so a reload or reboot doesn’t start them again:

Terminal window
sudo cp /etc/supervisor/supervisord.conf ~/supervisord.conf.backup
sudo $EDITOR /etc/supervisor/supervisord.conf # or the conf.d/ file
sudo supervisorctl reread && sudo supervisorctl update

When 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.

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.

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=true becomes a service with RunWisp’s default restart, which restarts after any exit. unexpected (supervisord’s default) becomes restart = "on_failure"; RunWisp counts any non-zero exit as a failure, where supervisord goes by exitcodes. false, no, off, and 0 mean the program runs once, so it becomes a task with run_on_start = true. Like under supervisord, it runs again whenever the daemon starts.
  • exitcodes. RunWisp treats exit 0 as success and anything else as failed. If your program exits non-zero on purpose, end its run with || true. failures controls which outcomes count for alerts.
  • %(...)s expansions. Only %(program_name)s is filled in. For %(process_num)s, use $RUNWISP_INSTANCE_INDEX in 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.