Setup supervisor (non-root)
Install
Assuming Phyton package installer being present (DF supported):
pip3.6 install supervisor --user --upgrade
The --user flag must be set in order to store below ~/.local instead of default destination, which requires sudo.
The --upgrade flag ensures, if already installed, to fetch latest release.
Configuration
Create storages:
mkdir -p $HOME/.supervisor/etc/conf.d/supervisor $HOME/.supervisor/tmp
chmod 2750 $HOME/.supervisor $HOME/.supervisor/tmp
Copy configuration boilerplate:
echo_supervisord_conf > $HOME/.supervisor/etc/supervisord.conf
Customize configuration:
[unix_http_server]
# custom override
file=/path/to/home/.supervisor/tmp/supervisor.sock
chown=<user>:<group>
username=<username>
password=<password>
[supervisord]
# custom override
logfile=/path/to/home/.supervisor/tmp/supervisord.log
;loglevel=trace ; add this for enhanced logging (recommended)
pidfile=/path/to/home/.supervisor/tmp/supervisord.pid
childlogdir=/path/to/home/.supervisor/tmp
[supervisorctl]
# custom override
serverurl=unix:///path/to/home/.supervisor/tmp/supervisor.sock
username=<username>
password=<password>
# custom override/activation
[include]
files = conf.d/supervisor/*.conf
The [include] section is disabled by default, don't forget to remove leading ; on this line.
At DF hosting, the <user> for chown is not the current login ssh-*, but the original from unix build,
e.g. re143265.
The password can be cleartext, or can be specified as a SHA-1 hash if prefixed by the string {SHA}.
More information can be found at https://supervisord.org/configuration.html#unix-http-server-section-values.
Scripts
On change any configuration below /path/to/home/.supervisor/conf.d/supervisor/*.conf
$HOME/.local/bin/supervisorctl -c $HOME/.supervisor/etc/supervisord.conf reread
$HOME/.local/bin/supervisorctl -c $HOME/.supervisor/etc/supervisord.conf update
Start (initial/one time, if no .sock was given)
$HOME/.local/bin/supervisord -c $HOME/.supervisor/etc/supervisord.conf
Stop (through ctl)
$HOME/.local/bin/supervisorctl -c $HOME/.supervisor/etc/supervisord.conf stop all
Restart (through ctl)
$HOME/.local/bin/supervisorctl -c $HOME/.supervisor/etc/supervisord.conf restart all
It can happen (rarely) that server hangs up.
In case that Restart did not succeed, remove the /path/to/home/.supervisor/tmp/supervisor.sock
and perform an initial start. That should do the trick 🤞.