Configuring Supervisor

Supervisor is a process control system used by the IzoT SDK to monitor and control the processes of an IzoT Server or IzoT application. It is configured by a set of *.conf files in the $IZOT/etc/supervisor directory.

Following is an example configuration file (this one is for the IzoT Server processes):

# IzoT Server Group 
[group:server] 
programs=network,api 
# IzoT Server - Network Server (LonBridge) 			prog = server:network 
[program:network] 
command="/home/debian/izot-sdk/bin/LonBridge" 
directory=/home/debian/izot-sdk/etc/lonbridge 
environment=LD_LIBRARY_PATH="/home/debian/izot-sdk/lib" 
user=debian 
priority=100 
startsecs=30 
autostart=false 
startretries=30 
stdout_logfile=/home/debian/izot-sdk/etc/supervisor/server-network.log 
redirect_stderr=true 
# IzoT Server - REST API Server (via Gunicorn) 		prog = server:api 
[program:api] 
command="/home/debian/izot-sdk/bin/python3" "/home/debian/izot-sdk/izot/server/manage.py" run_gunicorn localhost:8000 directory=/home/debian/izot-sdk/izot/server 
environment=IZOT="/home/debian/izot-sdk",PYTHONPATH="/home/debian/izot-sdk" 
user=debian 
priority=200 
startsecs=30 
autostart=false 
startretries=30 
stdout_logfile=/home/debian/izot-sdk/etc/supervisor/server-api.log 
redirect_stderr=true

where​

SettingDescription
[group:groupname]Names a group of programs to be controlled by Supervisor.
programsA comma-separated list of programnames (see below) belonging to groupname.
[program:programname]Defines a program to be controlled by Supervisor.
commandThe command line that Supervisor will use to start the program.
directoryThe directory that the program will be started in.
environmentA comma-separated list of environment variables that will be set in the program's process.
userThe user account under which the program will be started.
priorityUsed to determine the order that Supervisor (auto-)starts the program relative to other auto-start programs. A lower value program will be started before a higher value program.
startsecsThe number of seconds that Supervisor will wait after starting a program before determining whether it started successfully. This time should be large enough for the program to initialize completely.
autostartWhether Supervisor should automatically start the program when it starts (e.g., on initial power up or following a reboot).
startretriesThe number of successive times Supervisor should attempt to start a program before giving up.
stdout_logfileThe path to a logfile that will receive the standard output from the program. Note that Supervisor-started programs do not run with an attached terminal so output is usually discarded.
redirect_stderrWhether Supervisor should also redirect the standard error stream from program to the stdout_logfile.

For further details on these and other settings, see the Supervisor Documentation.