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:

 
Setting Description
[group:groupname] Names a group of programs to be controlled by Supervisor.
programs A comma-separated list of programnames (see below) belonging to groupname.
   
[program:programname] Defines a program to be controlled by Supervisor.
command The command line that Supervisor will use to start the program.
directory The directory that the program will be started in.
environment A comma-separated list of environment variables that will be set in the program's process.
user The user account under which the program will be started.
priority Used 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.
startsecs The 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.
autostart Whether Supervisor should automatically start the program when it starts (e.g. on initial power up or following a reboot).
startretries The number of successive times Supervisor should attempt to start a program before giving up.
stdout_logfile The 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_stderr Whether 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.