supervisor-config-gen utility

Today I had to write lots of supervisor config files for many microservices running on an outdated OpenVZ kernel (aka doesn’t support docker/rkt).

I hate manually editing a bunch of files which have almost exactly the same content so I built this easy tool in bash.

Wut duz it do?

supervisor-config-gen will take your current directory, assume you have an executable run.sh file and create this neat general-purpose supervisor config inside the current dir

% cat shitty-app-supervisor.conf
[program:shitty-app]
command=/home/not-root/supervisor-config-gen/shitty-app/run.sh
directory=/home/not-root/supervisor-config-gen/shitty-app
process_name=%(program_name)s
numprocs=1
user=not-root
stopsignal=TERM
stopwaitsecs=10
stopasgroup=true
killasgroup=true
autostart=true
autorestart=true
redirect_stderr=true
redirect_stdout=true
stdout_logfile=/home/not-root/logs/supervisord/%(program_name)s-out.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=10
stderr_logfile=/home/not-root/logs/supervisord/%(program_name)s-err.log
stderr_logfile_maxbytes=50MB

Now what?

To have supervisor read it, either move it to /etc/supervisor/config.d/

% sudo mv shitty-app-supervisor.conf /etc/supervisor/config.d/shitty-app-supervisor.conf

or create a symbolic link to it

% sudo ln -s $(pwd)/shitty-app-supervisor.conf /etc/supervisor/conf.d/shitty-app-supervisor.conf

Fuckin’ easy! xD

Check it out on github https://github.com/psyb0t/supervisor-config-gen