ECHO_SUPERVISORD_CONF(1)
π echo_supervisord_conf π
okay bestie, welcome to echo_supervisord_conf(1) β the Supervisor Configuration Documentation, aka the lore drop you've been waiting for π«Ά
β¨ NAME β¨
echo_supervisord_conf β Supervisor Configuration Documentation π
Supervisor is a client/server system that lets its users monitor and control a whole bunch of processes on UNIX-like operating systems. monitor AND control, bestie, both π
It shares some of the same goals as programs like launchd, daemontools, and runit. But β and this is the important part β unlike some of those programs, it is not meant to be run as a substitute for init as "process id 1". Nope. Instead it's meant to be used to control processes related to a project or a customer, and it's meant to start like any other program at boot time. it's giving "helpful coworker", not "literal operating system" π
π DOCUMENTATION π
π± Creating a Configuration File π±
Once the Supervisor installation has completed, run echo_supervisord_conf. This will print a "sample" Supervisor configuration file to your terminal's stdout. free config, no cap β¨
Once you see the file echoed to your terminal, reinvoke the command as:
echo_supervisord_conf > /etc/supervisord.conf
This won't work if you do not have root access. π
If you don't have root access, or you'd rather not put the supervisord.conf file in /etc/supervisord.conf, you can place it in the current directory like this:
echo_supervisord_conf > supervisord.conf
and start supervisord with the -c flag in order to specify the configuration file location.
For example: supervisord -c supervisord.conf. Using the -c flag actually is redundant in this case, because supervisord searches the current directory for a supervisord.conf before it searches any other locations for the file β but it will work. redundant but valid, we love a harmless flex π
Once you have a configuration file on your filesystem, you can begin modifying it to your liking. π
ποΈ Configuration File ποΈ
The Supervisor configuration file is conventionally named supervisord.conf. It is used by both supervisord and supervisorctl. π―
If either application is started without the -c option (the option which is used to tell the application the configuration filename explicitly), the application will look for a file named supervisord.conf within the following locations, in the specified order. It will use the first file it finds. π΅οΈββοΈ
$CWD/supervisord.conf$CWD/etc/supervisord.conf/etc/supervisord.conf../etc/supervisord.conf(Relative to the executable)../supervisord.conf(Relative to the executable)
NOTE: Some distributions have packaged Supervisor with their own customizations. These modified versions of Supervisor may load the configuration file from locations other than those described here. Notably, Ubuntu packages have been found that use /etc/supervisor/supervisord.conf. so check before you fight your config file, she might not even be the one being read π
π§Ύ File Format π§Ύ
supervisord.conf is a Windows-INI-style (Python ConfigParser) file. It has sections (each denoted by a [header]) and key / value pairs within the sections. The sections and their allowable values are described below. very structured, very demure πΈ
π Environment Variables π
Environment variables that are present in the environment at the time that supervisord is started can be used in the configuration file using the Python string expression syntax %(ENV_X)s:
[program:example]
command=/usr/bin/example --loglevel=%(ENV_LOGLEVEL)s
In the example above, the expression %(ENV_LOGLEVEL)s would be expanded to the value of the environment variable LOGLEVEL. dynamic config era β¨
NOTE: In Supervisor 3.2 and later, %(ENV_X)s expressions are supported in all options. In prior versions, some options support them, but most do not. See the documentation for each option below. version check, bestie π«Ά
π [unix_http_server] Section Settings π
The supervisord.conf file contains a section named [unix_http_server] under which configuration parameters for an HTTP server that listens on a UNIX domain socket should be inserted. If the configuration file has no [unix_http_server] section, a UNIX domain socket HTTP server will not be started. π«
The allowable configuration values are as follows. π
π
[unix_http_server] Section Values π
fileβ A path to a UNIX domain socket (e.g./tmp/supervisord.sock) on which supervisor will listen for HTTP/XML-RPC requests.supervisorctluses XML-RPC to communicate withsupervisordover this port. This option can include the value%(here)s, which expands to the directory in which the supervisord configuration file was found.- Default:
None. - Required: No.
- Introduced:
3.0
- Default:
chmodβ Change the UNIX permission mode bits of the UNIX domain socket to this value at startup.- Default:
0700 - Required: No.
- Introduced:
3.0
- Default:
chownβ Change the user and group of the socket file to this value. May be a UNIX username (e.g.chrism) or a UNIX username and group separated by a colon (e.g.chrism:wheel).- Default: Use the username and group of the user who starts
supervisord. - Required: No.
- Introduced:
3.0
- Default: Use the username and group of the user who starts
usernameβ The username required for authentication to this HTTP server.- Default: No username required.
- Required: No.
- Introduced:
3.0
passwordβ The password required for authentication to this HTTP server. This can be a cleartext password, or can be specified as a SHA-1 hash if prefixed by the string{SHA}. For example,{SHA}82ab876d1387bfafe46cc1c8a2ef074eae50cb1dis the SHA-stored version of the password"thepassword".- Note that hashed password must be in hex format.
- Default: No password required.
- Required: No.
- Introduced:
3.0
π§ [unix_http_server] Section Example π§
[unix_http_server]
file = /tmp/supervisor.sock
chmod = 0777
chown= nobody:nogroup
username = user
password = 123
π [inet_http_server] Section Settings π
The supervisord.conf file contains a section named [inet_http_server] under which configuration parameters for an HTTP server that listens on a TCP (internet) socket should be inserted. If the configuration file has no [inet_http_server] section, an inet HTTP server will not be started. π«
The allowable configuration values are as follows. π
π [inet_http_server] Section Values π
portβ A TCPhost:portvalue (e.g.127.0.0.1:9001) on which supervisor will listen for HTTP/XML-RPC requests.supervisorctlwill use XML-RPC to communicate withsupervisordover this port. To listen on all interfaces in the machine, use:9001or*:9001.- Default: No default.
- Required: Yes. (this one is mandatory, no skipping π ββοΈ)
- Introduced:
3.0
usernameβ The username required for authentication to this HTTP server.- Default: No username required.
- Required: No.
- Introduced:
3.0
passwordβ The password required for authentication to this HTTP server. This can be a cleartext password, or can be specified as a SHA-1 hash if prefixed by the string{SHA}. For example,{SHA}82ab876d1387bfafe46cc1c8a2ef074eae50cb1dis the SHA-stored version of the password"thepassword".- Note that hashed password must be in hex format.
- Default: No password required.
- Required: No.
- Introduced:
3.0
π¦ [inet_http_server] Section Example π¦
[inet_http_server]
port = 127.0.0.1:9001
username = user
password = 123
π [supervisord] Section Settings π
The supervisord.conf file contains a section named [supervisord] in which global settings related to the supervisord process should be inserted. These are as follows. the main character section, obviously π
β [supervisord] Section Values β
logfileβ The path to the activity log of thesupervisordprocess. This option can include the value%(here)s, which expands to the directory in which the supervisord configuration file was found.- Default:
$CWD/supervisord.log - Required: No.
- Introduced:
3.0
- Default:
logfile_maxbytesβ The maximum number of bytes that may be consumed by the activity log file before it is rotated (suffix multipliers like"KB","MB", and"GB"can be used in the value). Set this value to0to indicate an unlimited log size. unlimited log size? bold. iconic. but bold.- Default:
50MB - Required: No.
- Introduced:
3.0
- Default:
logfile_backupsβ The number of backups to keep around resulting from activity log file rotation. If set to0, no backups will be kept.- Default:
10 - Required: No.
- Introduced:
3.0
- Default:
loglevelβ The logging level, dictating what is written to thesupervisordactivity log. One ofcritical,error,warn,info,debug,trace, orblather. Note that at log leveldebug, thesupervisordlog file will record thestderr/stdoutoutput of its child processes and extended info info about process state changes, which is useful for debugging a process which isn't starting properly. See also:activity_log_levels.- Default:
info - Required: No.
- Introduced:
3.0
- Default:
pidfileβ The location in whichsupervisordkeeps its pid file. This option can include the value%(here)s, which expands to the directory in which the supervisord configuration file was found.- Default:
$CWD/supervisord.pid - Required: No.
- Introduced:
3.0
- Default:
umaskβ The umask of thesupervisordprocess.- Default:
022 - Required: No.
- Introduced:
3.0
- Default:
nodaemonβ If true,supervisordwill start in the foreground instead of daemonizing.- Default:
false - Required: No.
- Introduced:
3.0
- Default:
minfdsβ The minimum number of file descriptors that must be available beforesupervisordwill start successfully. A call tosetrlimitwill be made to attempt to raise the soft and hard limits of thesupervisordprocess to satisfyminfds. The hard limit may only be raised ifsupervisordis run as root.supervisorduses file descriptors liberally, and will enter a failure mode when one cannot be obtained from the OS, so it's useful to be able to specify a minimum value to ensure it doesn't run out of them during execution. This option is particularly useful on Solaris, which has a low per-process fd limit by default. Solaris girlies, this one's for you π- Default:
1024 - Required: No.
- Introduced:
3.0
- Default:
minprocsβ The minimum number of process descriptors that must be available beforesupervisordwill start successfully. A call tosetrlimitwill be made to attempt to raise the soft and hard limits of thesupervisordprocess to satisfyminprocs. The hard limit may only be raised ifsupervisordis run as root.supervisordwill enter a failure mode when the OS runs out of process descriptors, so it's useful to ensure that enough process descriptors are available uponsupervisordstartup.- Default:
200 - Required: No.
- Introduced:
3.0
- Default:
nocleanupβ Preventsupervisordfrom clearing any existingAUTOchild log files at startup time. Useful for debugging.- Default:
false
- Default:
- Required: No.
- Introduced: 3.0
childlogdir
The directory where all the AUTO child log files go to live their little lives. ποΈ And yes bestie, this one can include %(here)s, which expands out to the directory where the supervisord config file was found. So you can keep everything relative to your setup and it just works.
- Default: value of Python's
tempfile.get_tempdir() - Required: No.
- Introduced: 3.0
user
Tells supervisord to switch users to this UNIX user account before doing any meaningful processing. π«‘
Real talk though: it can only do the switch if supervisord was started as the root user. And if it can't switch users, it doesn't just die β it keeps going, but it writes a log message at the critical level saying it can't drop privileges. So like, check your logs, bestie. π
- Default: do not switch users
- Required: No.
- Introduced: 3.0
directory
When supervisord daemonizes, it switches to this directory. π This option can include the value %(here)s, which expands to the directory in which the supervisord configuration file was found.
- Default: do not
cd - Required: No.
- Introduced: 3.0
strip_ansi
Strips all ANSI escape sequences from child log files. So like, no more rainbow color codes cluttering up your log files. β¨ (Iconic for grep-ing, ngl.)
- Default:
false - Required: No.
- Introduced: 3.0
environment
A list of key/value pairs in the form KEY="val",KEY2="val2" that get placed into the supervisord process' environment (and as a result, into all of its child processes' environments too β it's giving generational inheritance π
). This option can include the value %(here)s, which expands to the directory in which the supervisord configuration file was found.
Values containing non-alphanumeric characters should be quoted (e.g. KEY="val:123",KEY2="val,456"). Otherwise, quoting the values is optional but recommended. To escape percent characters, simply use two (e.g. URI="/first%%20name").
Heads up: subprocesses will inherit the environment variables of the shell used to start supervisord β except for the ones overridden here and within the program'senvironmentoption. Seesubprocess_environment.
- Default: no values
- Required: No.
- Introduced: 3.0
identifier
The identifier string for this supervisor process, used by the RPC interface. πͺͺ That's its whole name tag, fr fr.
- Default:
supervisor - Required: No.
- Introduced: 3.0
π [supervisord] Section Example
Here's the whole vibe in one block, no notes:
[supervisord]
logfile = /tmp/supervisord.log
logfile_maxbytes = 50MB
logfile_backups=10
loglevel = info
pidfile = /tmp/supervisord.pid
nodaemon = false
minfds = 1024
minprocs = 200
umask = 022
user = chrism
identifier = supervisor
directory = /tmp
nocleanup = true
childlogdir = /tmp
strip_ansi = false
environment = KEY1="value1",KEY2="value2"
π [supervisorctl] Section Settings
Your config file can also hold settings for the supervisorctl interactive shell program. Bestie, it's a two-for-one. All the options are listed right below. π
π [supervisorctl] Section Values
serverurl
The URL that should be used to access the supervisord server, e.g. http://localhost:9001. And for UNIX domain sockets? You use unix:///absolute/path/to/file.sock. π
- Default:
http://localhost:9001 - Required: No.
- Introduced: 3.0
username
The username to pass to the supervisord server for use in authentication. This should be same as the username from the supervisord server configuration for the port or UNIX domain socket you're attempting to access. Match it up, okay? π«Ά
- Default: No username
- Required: No.
- Introduced: 3.0
password
The password to pass to the supervisord server for use in authentication. This should be the cleartext version of the password from the supervisord server configuration for the port or UNIX domain socket you're attempting to access.
π¨ Okay this is the important part: this value cannot be passed as a SHA hash. Unlike other passwords specified in this file, it must be provided in cleartext. No cap. So keep that file locked down, bestie.
- Default: No password
- Required: No.
- Introduced: 3.0
prompt
String used as the supervisorctl prompt. Make it cute, make it yours. πΈ
- Default:
supervisor - Required: No.
- Introduced: 3.0
history_file
A path to use as the readline persistent history file. If you enable this feature by choosing a path, your supervisorctl commands will be kept in the file, and you can use readline (e.g. arrow-up β¬οΈ) to invoke commands you performed in your last supervisorctl session. It's giving muscle memory but for your terminal.
- Default: No file
- Required: No.
- Introduced:
3.0a5
β¨ [supervisorctl] Section Example
[supervisorctl]
serverurl = unix:///tmp/supervisor.sock
username = chris
password = 123
prompt = mysupervisor
π [program:x] Section Settings
The configuration file must contain one or more program sections in order for supervisord to know which programs it should start and control. The header value is a composite value β it's the word "program", followed directly by a colon, then the program name. So a header value of [program:foo] describes a program with the name of "foo". That name is used within client applications that control the processes created as a result of this configuration.
π It is an error to create a program section that does not have a name. The name must not include a colon character or a bracket character. (Do not test this, bestie, it will not go well. π)
The value of the name is used as the value for the %(program_name)s string expression expansion within other values where specified.
NOTE:
A [program:x] section actually represents a "homogeneous process group" to supervisor (as of 3.0). The members of the group are defined by the combination of the numprocs and process_name parameters in the configuration.
By default, if numprocs and process_name are left unchanged from their defaults, the group represented by [program:x] will be named x and will have a single process named x in it. This provides a modicum of backwards compatibility with older supervisor releases, which did not treat program sections as homogeneous process group definitions.
But for instance, if you have a [program:foo] section with a numprocs of 3 and a process_name expression of %(program_name)s_%(process_num)02d, the "foo" group will contain three processes, named foo_00, foo_01, and foo_02. π₯ This makes it possible to start a number of very similar processes using a single [program:x] section. All logfile names, all environment strings, and the command of programs can also contain similar Python string expressions, to pass slightly different parameters to each process. So efficient, we love to see it.
π [program:x] Section Values
command
The command that will be run when this program is started. The command can be either absolute (e.g. /path/to/programname) or relative (e.g. programname). If it is relative, the supervisord's environment $PATH will be searched for the executable. Programs can accept arguments, e.g. /path/to/program foo bar. The command line can use double quotes to group arguments with spaces in them to pass to the program, e.g. /path/to/program/name -p "foo bar".
Note that the value of command may include Python string expressions, e.g. /path/to/programname --port=80%(process_num)02d might expand to /path/to/programname --port=8000 at runtime. String expressions are evaluated against a dictionary containing the keys group_name, host_node_name, process_num, program_name, here (the directory of the supervisord config file), and all supervisord's environment variables prefixed with ENV_.
β οΈ Controlled programs should themselves not be daemons, as supervisord assumes it is responsible for daemonizing its subprocesses (see nondaemonizing_of_subprocesses). Do not double-daemon, bestie, it's chaos.
- Default: No default.
- Required: Yes.
- Introduced: 3.0
process_name
A Python string expression that is used to compose the supervisor process name for this process. You usually don't need to worry about setting this unless you change numprocs. The string expression is evaluated against a dictionary that includes group_name, host_node_name, process_num, program_name, and here (the directory of the supervisord config file).
- Default:
%(program_name)s - Required: No.
- Introduced: 3.0
numprocs
Supervisor will start as many instances of this program as named by numprocs.
π Note that ifnumprocs>1, theprocess_nameexpression must include%(process_num)s(or any other valid Python string expression that includesprocess_num) within it. Don't forget, or it's giving broken.
- Default:
1 - Required: No.
- Introduced: 3.0
numprocs_start
An integer offset that is used to compute the number at which numprocs starts. π’
- Default:
0 - Required: No.
- Introduced: 3.0
priority
The relative priority of the program in the start and shutdown ordering. Lower priorities indicate programs that start first and shut down last at startup and when aggregate commands are used in various clients (e.g. "start all"/"stop all"). Higher priorities indicate programs that start last and shut down first. So like, low number = main character energy that shows up early. β¨
- Default:
999 - Required: No.
- Introduced: 3.0
autostart
If true, this program will start automatically when supervisord is started.
- Default:
true - Required: No.
- Introduced: 3.0
startsecs
The total number of seconds which the program needs to stay running after a startup to consider the start successful (moving the process from the STARTING state to the RUNNING state). Set to 0 to indicate that the program needn't stay running for any particular amount of time.
NOTE:
Even if a process exits with an "expected" exit code (seeexitcodes), the start will still be considered a failure if the process exits quicker thanstartsecs. So no, "but it exited cleanly!" doesn't save you here. π
- Default:
1 - Required: No.
- Introduced: 3.0
startretries
The number of serial failure attempts that supervisord will allow when attempting to start the program before giving up and putting the process into a FATAL state. See process_states for explanation of the FATAL state. Three strikes and you're out, literally. π
- Default:
3 - Required: No.
- Introduced: 3.0
autorestartβ do you want supervisord to automatically restart a process if it exits while it's in the RUNNING state? π This one takes one of three values:false,unexpected, ortrue.falseβ the process will not be autorestarted. That's it, that's the whole vibe, we're done here.unexpectedβ the process gets restarted when the program exits with an exit code that is not one of the exit codes associated with this process' configuration (peepexitcodesfor that list).trueβ the process will be unconditionally restarted when it exits, without regard to its exit code. No thoughts, head empty, just restart. π₯
NOTE:autorestartcontrols whether supervisord will autorestart a program if it exits after it has successfully started up (so the process is in the RUNNING state). supervisord has a different restart mechanism for when the process is starting up (the process is in the STARTING state). Those retries during process startup are controlled bystartsecsandstartretries. Different mechanism, different keys, don't mix them up bestie π
- Default:
unexpected - Required: No.
- Introduced: 3.0
exitcodesβ the list of "expected" exit codes for this program, used together withautorestart. π If theautorestartparameter is set tounexpected, and the process exits in any other way than as a result of a supervisor stop request, supervisord will restart the process if it exits with an exit code that is not defined in this list.- Default:
0,2 - Required: No.
- Introduced: 3.0
- Default:
stopsignalβ the signal used to kill the program when a stop is requested. β¨ This can be any ofTERM,HUP,INT,QUIT,KILL,USR1, orUSR2.- Default:
TERM - Required: No.
- Introduced: 3.0
- Default:
stopwaitsecsβ the number of seconds to wait for the OS to return aSIGCHILDto supervisord after the program has been sent astopsignal. β³ If this number of seconds elapses before supervisord receives aSIGCHILDfrom the process, supervisord will attempt to kill it with a finalSIGKILL. Yeah. It's giving "we tried asking nicely, now we're not asking." π- Default:
10 - Required: No.
- Introduced: 3.0
- Default:
stopasgroupβ iftrue, the flag causes supervisor to send the stop signal to the whole process group and implieskillasgroupistrue. π«Ά This is useful for programs, such as Flask in debug mode, that do not propagate stop signals to their children, leaving them orphaned. Not the orphans π- Default:
false - Required: No.
- Introduced:
3.0b1
- Default:
killasgroupβ iftrue, when resorting to sendSIGKILLto the program to terminate it, send it to its whole process group instead, taking care of its children as well. Useful e.g. with Python programs usingmultiprocessing. π₯ Family plan termination, no cap.- Default:
false - Required: No.
- Introduced:
3.0a11
- Default:
userβ instruct supervisord to use this UNIX user account as the account which runs the program. π The user can only be switched if supervisord is run as therootuser. If supervisord can't switch to the specified user, the program will not be started.
NOTE: The user will be changed usingsetuidonly. This does not start a login shell and does not change environment variables likeUSERorHOME. Seesubprocess_environmentfor details. So don't come crying to me about yourHOMEbeing weird, it's literally in the docs π
- Default: Do not switch users
- Required: No.
- Introduced: 3.0
redirect_stderrβ iftrue, cause the process'stderroutput to be sent back to supervisord on itsstdoutfile descriptor (in UNIX shell terms, this is the equivalent of executing/the/program 2>&1). π
NOTE: Do not setredirect_stderr=truein an[eventlistener:x]section. Eventlisteners usestdoutandstdinto communicate with supervisord. Ifstderris redirected, output fromstderrwill interfere with the eventlistener protocol. That's a whole mess, we don't do that. π
- Default:
false - Required: No.
- Introduced: 3.0, replaces 2.0's
log_stdoutandlog_stderr
stdout_logfileβ put processstdoutoutput in this file (and ifredirect_stderristrue, also placestderroutput in this file). π Ifstdout_logfileis unset or set toAUTO, supervisor will automatically choose a file location. If this is set toNONE, supervisord will create no log file.AUTOlog files and their backups will be deleted when supervisord restarts. π Thestdout_logfilevalue can contain Python string expressions that will evaluated against a dictionary that contains the keysgroup_name,host_node_name,process_num,program_name, andhere(the directory of the supervisord config file).
NOTE: It is not possible for two processes to share a single log file (stdout_logfile) when rotation (stdout_logfile_maxbytes) is enabled. This will result in the file being corrupted. Sharing is not caring here, bestie. π
- Default:
AUTO - Required: No.
- Introduced: 3.0, replaces 2.0's
logfile
stdout_logfile_maxbytesβ the maximum number of bytes that may be consumed bystdout_logfilebefore it is rotated (suffix multipliers like"KB","MB", and"GB"can be used in the value). π Set this value to0to indicate an unlimited log size. YOLO mode, as it were.- Default:
50MB - Required: No.
- Introduced: 3.0, replaces 2.0's
logfile_maxbytes
- Default:
stdout_logfile_backupsβ the number ofstdout_logfilebackups to keep around resulting from processstdoutlog file rotation. π If set to0, no backups will be kept.- Default:
10 - Required: No.
- Introduced: 3.0, replaces 2.0's
logfile_backups
- Default:
stdout_capture_maxbytesβ max number of bytes written to capture FIFO when process is in "stdout capture mode" (seecapture_mode). π¦ Should be an integer (suffix multipliers like"KB","MB"and"GB"can used in the value). If this value is0, process capture mode will be off.- Default:
0 - Required: No.
- Introduced: 3.0, replaces 2.0's
logfile_backups
- Default:
stdout_events_enabledβ iftrue,PROCESS_LOG_STDOUTevents will be emitted when the process writes to itsstdoutfile descriptor. β The events will only be emitted if the file descriptor is not in capture mode at the time the data is received (seecapture_mode).- Default:
0 - Required: No.
- Introduced:
3.0a7
- Default:
stderr_logfileβ put processstderroutput in this file unlessredirect_stderristrue. π Accepts the same value types asstdout_logfileand may contain the same Python string expressions.
NOTE: It is not possible for two processes to share a single log file (stderr_logfile) when rotation (stderr_logfile_maxbytes) is enabled. This will result in the file being corrupted. Again. We said what we said. π
- Default:
AUTO - Required: No.
- Introduced: 3.0
stderr_logfile_maxbytesβ the maximum number of bytes before logfile rotation forstderr_logfile. πΈ Accepts the same value types asstdout_logfile_maxbytes.- Default:
50MB - Required: No.
- Introduced: 3.0
- Default:
stderr_logfile_backupsβ the number of backups to keep around resulting from processstderrlog file rotation. β¨ If set to0, no backups will be kept.- Default:
10 - Required: No.
- Introduced: 3.0
- Default:
stderr_capture_maxbytesβ max number of bytes written to capture FIFO when process is in "stderr capture mode" (seecapture_mode). π§ Should be an integer (suffix multipliers like"KB","MB"and"GB"can used in the value). If this value is0, process capture mode will be off.- Default:
0 - Required: No.
- Introduced: 3.0
- Default:
stderr_events_enabledβ iftrue,PROCESS_LOG_STDERRevents will be emitted when the process writes to itsstderrfile descriptor. π The events will only be emitted if the file descriptor is not in capture mode at the time the data is received (seecapture_mode).- Default:
false - Required: No.
- Introduced:
3.0a7
- Default:
environmentβ a list of key/value pairs in the formKEY="val",KEY2="val2"that will be placed in the child process' environment. π The environment string may contain Python string expressions that will be evaluated against a dictionary containinggroup_name,host_node_name,process_num,program_name, andhere(the directory of the supervisord config file). Values containing non-alphanumeric characters should be quoted (e.g.KEY="val:123",KEY2="val,456"). Otherwise, quoting the values is optional but recommended. π Note that the subprocess will inherit the environment variables of the shell used to start"supervisord"except for the ones overridden here. Seesubprocess_environment.- Default: No extra environment
- Required: No.
- Introduced: 3.0
directoryβ a file path representing a directory to which supervisord should temporarilychdirbeforeexec'ing the child. π- Default: No
chdir(inherit supervisor's) - Required: No.
- Introduced: 3.0
- Default: No
umaskβ an octal number (e.g.002,022) representing theumaskof the process. π¦- Default: No special
umask(inherit supervisor's) - Required: No.
- Introduced: 3.0
- Default: No special
serverurlβ the URL passed in the environment to the subprocess process asSUPERVISOR_SERVER_URL(seesupervisor.childutils) to allow the subprocess to easily communicate with the internal HTTP server. π« If provided, it should have the same syntax and structure as the[supervisorctl]section option of the same name. If this is set toAUTO, or is unset, supervisor will automatically construct a server URL, giving preference to a server that listens on UNIX domain sockets over one that listens on an internet socket. β¨ UNIX sockets stay winning.- Default:
AUTO - Required: No.
- Introduced: 3.0
- Default:
π [program:x] Section Example π
Okay bestie, here's the whole thing assembled so you can see the vibe in one place π β every option, no notes:
[program:cat]
command=/bin/cat
process_name=%(program_name)s
numprocs=1
directory=/tmp
umask=022
priority=999
autostart=true
autorestart=unexpected
startsecs=10
startretries=3
exitcodes=0,2
stopsignal=TERM
stopwaitsecs=10
stopasgroup=false
killasgroup=false
user=chrism
redirect_stderr=false
stdout_logfile=/a/path
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
stderr_logfile=/a/path
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
stderr_events_enabled=false
environment=A="1",B="2"
serverurl=AUTO
πΈ [include] Section Settings πΈ
okay so bestie, your supervisord.conf file is allowed to have a whole section called [include] π. If it does? It must have exactly one single key named files β that's it, that's the only key. And what does that key do? The values inside it name other config files that get pulled in and included into the configuration. slay. β¨
π [include] Section Values π
filesβ a space-separated sequence of file globs, bestie π. Each glob can be absolute or relative. If it's relative, it's considered relative to wherever the config file that's including it lives. And a "glob"? It's a file pattern that matches a specified pattern according to the rules the Unix shell uses. Heads up: no tilde expansion is done, but*,?, and character ranges expressed with[]will be correctly matched. Also, recursive includes from included files are not supported β so no inception nonsense, periodt. π«- Default: No default (required)
- Required: Yes.
- Introduced: 3.0
π [include] Section Example π
[include]
files = /an/absolute/filename.conf /an/absolute/*.conf foo.conf config??.conf
π«Ά [group:x] Section Settings π«Ά
So it's often super useful to group "homogeneous" process groups (aka "programs") together into a "heterogeneous" process group, so you can control the whole squad as one unit from Supervisor's various controller interfaces. main character energy, honestly. π
To place programs into a group so you can treat them as a unit, you define a [group:x] section in your config file. Now, the group header value is a composite β listen carefully π: it's the word group, followed directly by a colon, then the group name. So a header value of [group:foo] describes a group with the name of foo. That name gets used within client applications that control the processes created as a result of this configuration. And it is an error to create a group section that doesn't have a name π. The name must not include a colon character or a bracket character.
For a [group:x], there must be one or more [program:x] sections elsewhere in your config file, and the group must refer to them by name in the programs value. no cap.
And here's the tea β: if "homogeneous" process groups (the ones represented by program sections) get placed into a "heterogeneous" group via the [group:x] section's programs line, then the homogeneous groups that are implied by the program section will not exist at runtime in supervisor. Instead, all the processes belonging to each of those homogeneous groups get placed into the heterogeneous group. Like, they get adopted fr fr.
For example, given the following group configuration:
[group:foo]
programs=bar,baz
priority=999
Given the above, at supervisord startup, the bar and baz homogeneous groups will not exist, and the processes that would have been under them will now be moved into the foo group. π
β [group:x] Section Values β
programsβ a comma-separated list of program names π. The programs that are listed become members of the group.- Default: No default (required)
- Required: Yes.
- Introduced: 3.0
priorityβ a priority number analogous to a[program:x]priority value, assigned to the group.- Default: 999
- Required: No.
- Introduced: 3.0
π¦ [group:x] Section Example π¦
[group:foo]
programs=bar,baz
priority=999
π₯ [fcgi-program:x] Section Settings π₯
okay okay okay, this one's a whole story, sit down bestie π. Supervisor can manage groups of FastCGI processes that all listen on the same socket. Until now, deployment flexibility for FastCGI was limited. To get full process management, you could use mod_fastcgi under Apache, but then you were stuck with Apache's inefficient concurrency model of one process or thread per connection π. In addition to requiring more CPU and memory resources, the process/thread per connection model can be quickly saturated by a slow resource, preventing other resources from being served. ugh. In order to take advantage of newer event-driven web servers such as lighttpd or nginx which don't include a built-in process manager, you had to use scripts like cgi-fcgi or spawn-fcgi. These can be used in conjunction with a process manager such as supervisord or daemontools but require each FastCGI child process to bind to its own socket. The disadvantages of this are: unnecessarily complicated web server configuration, ungraceful restarts, and reduced fault tolerance. With fewer sockets to configure, web server configurations are much smaller if groups of FastCGI processes can share sockets. Shared sockets allow for graceful restarts because the socket remains bound by the parent process while any of the child processes are being restarted. Finally, shared sockets are more fault tolerant because if a given process fails, other processes can continue to serve inbound connections. β¨
With integrated FastCGI spawning support, Supervisor gives you the best of both worlds. You get full-featured process management with groups of FastCGI processes sharing sockets without being tied to a particular web server. It's a clean separation of concerns, allowing the web server and the process manager to each do what they do best. iconic behavior tbh π
NOTE: π§ The socket manager in Supervisor was originally developed to support FastCGI processes but it is not limited to FastCGI. Other protocols may be used as well with no special configuration. Any program that can access an open socket from a file descriptor (e.g. withsocket.fromfdin Python) can use the socket manager. Supervisor will automatically create the socket, bind, and listen before forking the first child in a group. The socket will be passed to each child on file descriptor number0(zero). When the last child in the group exits, Supervisor will close the socket.
All the options available to [program:x] sections are also respected by fcgi-program sections. π«Ά
π [fcgi-program:x] Section Values π
[fcgi-program:x] sections have a single key which [program:x] sections do not have. just the one, bestie.
socketβ the FastCGI socket for this program, either TCP or UNIX domain socket πΈ. For TCP sockets, use this format:tcp://localhost:9002. For UNIX domain sockets, useunix:///absolute/path/to/file.sock. String expressions are evaluated against a dictionary containing the keys"program_name"and"here"(the directory of the supervisord config file).- Default: No default.
- Required: Yes.
- Introduced: 3.0
socket_ownerβ for UNIX domain sockets, this parameter can be used to specify the user and group for the FastCGI socket π. May be a UNIX username (e.g.chrism) or a UNIX username and group separated by a colon (e.g.chrism:wheel).- Default: Uses the user and group set for the fcgi-program
- Required: No.
- Introduced: 3.0
socket_modeβ for UNIX domain sockets, this parameter can be used to specify the permission mode π.- Default:
0700 - Required: No.
- Introduced: 3.0
- Default:
Consult [program:x] Section Settings for other allowable keys, delta the above constraints and additions. π
π [fcgi-program:x] Section Example π
[fcgi-program:fcgiprogramname]
command=/usr/bin/example.fcgi
socket=unix:///var/run/supervisor/%(program_name)s.sock
socket_owner=chrism
socket_mode=0700
process_name=%(program_name)s_%(process_num)02d
numprocs=5
directory=/tmp
umask=022
priority=999
autostart=true
autorestart=unexpected
startsecs=1
startretries=3
exitcodes=0,2
stopsignal=QUIT
stopasgroup=false
killasgroup=false
stopwaitsecs=10
user=chrism
redirect_stderr=true
stdout_logfile=/a/path
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_events_enabled=false
stderr_logfile=/a/path
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_events_enabled=false
environment=A="1",B="2"
serverurl=AUTO
π [eventlistener:x] Section Settings π
Supervisor lets you define specialized homogeneous process groups ("event listener pools") right inside the config file π. These pools contain processes that are meant to receive and respond to event notifications from supervisor's event system. Go see events for an explanation of how events work and how to implement programs that can be declared as event listeners. iykyk.
Note that all the options available to [program:x] sections are respected by eventlistener sections except for stdout_capture_maxbytes and stderr_capture_maxbytes β because event listeners cannot emit process communication events, see capture_mode. π
π [eventlistener:x] Section Values π
[eventlistener:x] sections have a few keys which [program:x] sections do not have. β¨
buffer_sizeβ the event listener pool's event queue buffer size. When a listener pool's event buffer is overflowed (as can happen when an event listener pool cannot keep up with all of the events sent to it), the oldest event in the buffer is discarded. πeventsβ a comma-separated list of event type names that this listener is "interested" in receiving notifications for (seeevent_typesfor a list of valid event type names). πresult_handlerβ apkg_resourcesentry point string that resolves to a Python callable. The default value issupervisor.dispatchers:default_handler. Specifying an alternate result handler is a very uncommon thing to need to do, and as a result, how to create one is not documented. π€·
Consult [program:x] Section Settings for other allowable keys, delta the above constraints and additions. π
π§ [eventlistener:x] Section Example π§
[eventlistener:theeventlistenername]
command=/bin/eventlistener
process_name=%(program_name)s_%(process_num)02d
numprocs=5
events=PROCESS_STATE
buffer_size=10
directory=/tmp
umask=022
priority=-1
autostart=true
autorestart=unexpected
startsecs=1
startretries=3
exitcodes=0,2
stopsignal=QUIT
stopwaitsecs=10
stopasgroup=false
killasgroup=false
user=chrism
redirect_stderr=false
stdout_logfile=/a/path
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_events_enabled=false
stderr_logfile=/a/path
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_events_enabled=false
environment=A="1",B="2"
serverurl=AUTO
π [rpcinterface:x] Section Settings π
ngl bestie, adding rpcinterface:x settings in the config file is only useful for people who wish to extend supervisor with additional custom behavior. it's giving advanced. π§
In the sample config file, there is a section which is named [rpcinterface:supervisor]. By default it looks like the following. β¬οΈ
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
The [rpcinterface:supervisor] section must remain in the configuration for the standard setup of supervisor to work properly. No cap. If you don't want supervisor to do anything it doesn't already do out of the box, this is all you need to know about this type of section. Periodt. π
However, if you wish to add rpc interface namespaces in order to customize supervisor, you may add additional [rpcinterface:foo] sections, where "foo" represents the namespace of the interface (from the web root), and the value named by supervisor.rpcinterface_factory is a factory callable which should have a function signature that accepts a single positional argument supervisord and as many keyword arguments as required to perform configuration. Any extra key/value pairs defined within the [rpcinterface:x] section will be passed as keyword arguments to the factory. Slay. β¨
Here's an example of a factory function, created in the __init__.py file of the Python package my.package.
from my.package.rpcinterface import AnotherRPCInterface
def make_another_rpcinterface(supervisord, **config):
retries = int(config.get('retries', 0))
another_rpc_interface = AnotherRPCInterface(supervisord, retries)
return another_rpc_interface
And a section in the config file meant to configure it.
[rpcinterface:another]
supervisor.rpcinterface_factory = my.package:make_another_rpcinterface
retries = 1
β¨ [rpcinterface:x] Section Values β¨
supervisor.rpcinterface_factoryβ pkg_resources "entry point" dotted name to your RPC interface's factory function.- Default: N/A
- Required: No.
- Introduced: 3.0
πΈ [rpcinterface:x] Section Example πΈ
[rpcinterface:another]
supervisor.rpcinterface_factory = my.package:make_another_rpcinterface
retries = 1
π¦ Glossary π¦
daemontoolsβ A process control system by D.J. Bernstein.launchdβ A process control system used by Apple as process 1 under Mac OS X.runitβ A process control system.Superlanceβ A package which provides various event listener implementations that plug into Supervisor which can help monitor process memory usage and crash status:http://pypi.python.org/pypi/superlance.umaskβ Abbreviation of user mask: sets the file mode creation mask of the current process. Seehttp://en.wikipedia.org/wiki/Umask.
π AUTHOR π
This man page was created by Orestis Ioannou <orestis@oioannou.com> using the official documentation.
π COPYRIGHT π
2004-2015, Agendaless Consulting and Contributors
Okay that's the whole vibe. This page is ECHO_SUPERVISORD_CONF(1), version 3.2.0, dated December 10, 2015. Bye bestie, go configure something iconic. π
β¨π¦
π¦ where this page comes from
- debian bookworm: supervisor 4.2.5-1 Β· BSD-derived
- debian trixie: supervisor 4.2.5-3 Β· BSD-derived
- ubuntu jammy: supervisor 4.2.1-1ubuntu1 Β· BSD-derived
- ubuntu noble: supervisor 4.2.5-1 Β· BSD-derived
- ubuntu noble: supervisor 4.2.5-1ubuntu0.1 Β· BSD-derived
- ubuntu questing: supervisor 4.2.5-3
- ubuntu resolute: supervisor 4.3.0-1 Β· BSD-derived
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms