configuration.rst 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399
  1. Configuration File
  2. ==================
  3. The Supervisor configuration file is conventionally named
  4. :file:`supervisord.conf`. It is used by both :program:`supervisord`
  5. and :program:`supervisorctl`. If either application is started
  6. without the ``-c`` option (the option which is used to tell the
  7. application the configuration filename explicitly), the application
  8. will look for a file named :file:`supervisord.conf` within the
  9. following locations, in the specified order. It will use the first
  10. file it finds.
  11. #. :file:`$CWD/supervisord.conf`
  12. #. :file:`$CWD/etc/supervisord.conf`
  13. #. :file:`/etc/supervisord.conf`
  14. :file:`supervisord.conf` is a Windows-INI-style (Python ConfigParser)
  15. file. It has sections (each denoted by a ``[header]``) and key / value
  16. pairs within the sections. The sections and their allowable values
  17. are described below.
  18. .. note::
  19. Some distributions have packaged Supervisor with their own
  20. customizations. These modified versions of Supervisor may load the
  21. configuration file from locations other than those described here.
  22. Notably, Ubuntu packages have been found that use
  23. ``/etc/supervisor/supervisord.conf``.
  24. ``[unix_http_server]`` Section Settings
  25. ---------------------------------------
  26. The :file:`supervisord.conf` file contains a section named
  27. ``[unix_http_server]`` under which configuration parameters for an
  28. HTTP server that listens on a UNIX domain socket should be inserted.
  29. If the configuration file has no ``[unix_http_server]`` section, a
  30. UNIX domain socket HTTP server will not be started. The allowable
  31. configuration values are as follows.
  32. ``[unix_http_server]`` Section Values
  33. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. ``file``
  35. A path to a UNIX domain socket (e.g. :file:`/tmp/supervisord.sock`)
  36. on which supervisor will listen for HTTP/XML-RPC requests.
  37. :program:`supervisorctl` uses XML-RPC to communicate with
  38. :program:`supervisord` over this port. This option can include the
  39. value ``%(here)s``, which expands to the directory in which the
  40. :program:`supervisord` configuration file was found.
  41. *Default*: None.
  42. *Required*: No.
  43. *Introduced*: 3.0
  44. ``chmod``
  45. Change the UNIX permission mode bits of the UNIX domain socket to
  46. this value at startup.
  47. *Default*: ``0700``
  48. *Required*: No.
  49. *Introduced*: 3.0
  50. ``chown``
  51. Change the user and group of the socket file to this value. May be
  52. a UNIX username (e.g. ``chrism``) or a UNIX username and group
  53. separated by a colon (e.g. ``chrism:wheel``).
  54. *Default*: Use the username and group of the user who starts supervisord.
  55. *Required*: No.
  56. *Introduced*: 3.0
  57. ``username``
  58. The username required for authentication to this HTTP server.
  59. *Default*: No username required.
  60. *Required*: No.
  61. *Introduced*: 3.0
  62. ``password``
  63. The password required for authentication to this HTTP server. This
  64. can be a cleartext password, or can be specified as a SHA-1 hash if
  65. prefixed by the string ``{SHA}``. For example,
  66. ``{SHA}82ab876d1387bfafe46cc1c8a2ef074eae50cb1d`` is the SHA-stored
  67. version of the password "thepassword".
  68. Note that hashed password must be in hex format.
  69. *Default*: No password required.
  70. *Required*: No.
  71. *Introduced*: 3.0
  72. ``[unix_http_server]`` Section Example
  73. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  74. .. code-block:: ini
  75. [unix_http_server]
  76. file = /tmp/supervisor.sock
  77. chmod = 0777
  78. chown= nobody:nogroup
  79. username = user
  80. password = 123
  81. ``[inet_http_server]`` Section Settings
  82. ---------------------------------------
  83. The :file:`supervisord.conf` file contains a section named
  84. ``[inet_http_server]`` under which configuration parameters for an
  85. HTTP server that listens on a TCP (internet) socket should be
  86. inserted. If the configuration file has no ``[inet_http_server]``
  87. section, an inet HTTP server will not be started. The allowable
  88. configuration values are as follows.
  89. ``[inet_http_server]`` Section Values
  90. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  91. ``port``
  92. A TCP host:port value or (e.g. ``127.0.0.1:9001``) on which
  93. supervisor will listen for HTTP/XML-RPC requests.
  94. :program:`supervisorctl` will use XML-RPC to communicate with
  95. :program:`supervisord` over this port. To listen on all interfaces
  96. in the machine, use ``:9001`` or ``*:9001``.
  97. *Default*: No default.
  98. *Required*: Yes.
  99. *Introduced*: 3.0
  100. ``username``
  101. The username required for authentication to this HTTP server.
  102. *Default*: No username required.
  103. *Required*: No.
  104. *Introduced*: 3.0
  105. ``password``
  106. The password required for authentication to this HTTP server. This
  107. can be a cleartext password, or can be specified as a SHA-1 hash if
  108. prefixed by the string ``{SHA}``. For example,
  109. ``{SHA}82ab876d1387bfafe46cc1c8a2ef074eae50cb1d`` is the SHA-stored
  110. version of the password "thepassword".
  111. Note that hashed password must be in hex format.
  112. *Default*: No password required.
  113. *Required*: No.
  114. *Introduced*: 3.0
  115. ``[inet_http_server]`` Section Example
  116. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  117. .. code-block:: ini
  118. [inet_http_server]
  119. port = 127.0.0.1:9001
  120. username = user
  121. password = 123
  122. ``[supervisord]`` Section Settings
  123. ----------------------------------
  124. The :file:`supervisord.conf` file contains a section named
  125. ``[supervisord]`` in which global settings related to the
  126. :program:`supervisord` process should be inserted. These are as
  127. follows.
  128. ``[supervisord]`` Section Values
  129. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  130. ``logfile``
  131. The path to the activity log of the supervisord process. This
  132. option can include the value ``%(here)s``, which expands to the
  133. directory in which the supervisord configuration file was found.
  134. *Default*: :file:`$CWD/supervisord.log`
  135. *Required*: No.
  136. *Introduced*: 3.0
  137. ``logfile_maxbytes``
  138. The maximum number of bytes that may be consumed by the activity log
  139. file before it is rotated (suffix multipliers like "KB", "MB", and
  140. "GB" can be used in the value). Set this value to 0 to indicate an
  141. unlimited log size.
  142. *Default*: 50MB
  143. *Required*: No.
  144. *Introduced*: 3.0
  145. ``logfile_backups``
  146. The number of backups to keep around resulting from activity log
  147. file rotation. If set to 0, no backups will be kept.
  148. *Default*: 10
  149. *Required*: No.
  150. *Introduced*: 3.0
  151. ``loglevel``
  152. The logging level, dictating what is written to the supervisord
  153. activity log. One of ``critical``, ``error``, ``warn``, ``info``,
  154. ``debug``, ``trace``, or ``blather``. Note that at log level
  155. ``debug``, the supervisord log file will record the stderr/stdout
  156. output of its child processes and extended info info about process
  157. state changes, which is useful for debugging a process which isn't
  158. starting properly. See also: :ref:`activity_log_levels`.
  159. *Default*: info
  160. *Required*: No.
  161. *Introduced*: 3.0
  162. ``pidfile``
  163. The location in which supervisord keeps its pid file. This option
  164. can include the value ``%(here)s``, which expands to the directory
  165. in which the supervisord configuration file was found.
  166. *Default*: :file:`$CWD/supervisord.pid`
  167. *Required*: No.
  168. *Introduced*: 3.0
  169. ``umask``
  170. The :term:`umask` of the supervisord process.
  171. *Default*: ``022``
  172. *Required*: No.
  173. *Introduced*: 3.0
  174. ``nodaemon``
  175. If true, supervisord will start in the foreground instead of
  176. daemonizing.
  177. *Default*: false
  178. *Required*: No.
  179. *Introduced*: 3.0
  180. ``minfds``
  181. The minimum number of file descriptors that must be available before
  182. supervisord will start successfully. A call to setrlimit will be made
  183. to attempt to raise the soft and hard limits of the supervisord process to
  184. satisfy ``minfds``. The hard limit may only be raised if supervisord
  185. is run as root. supervisord uses file descriptors liberally, and will
  186. enter a failure mode when one cannot be obtained from the OS, so it's
  187. useful to be able to specify a minimum value to ensure it doesn't run out
  188. of them during execution. This option is particularly useful on Solaris,
  189. which has a low per-process fd limit by default.
  190. *Default*: 1024
  191. *Required*: No.
  192. *Introduced*: 3.0
  193. ``minprocs``
  194. The minimum number of process descriptors that must be available
  195. before supervisord will start successfully. A call to setrlimit will be
  196. made to attempt to raise the soft and hard limits of the supervisord process
  197. to satisfy ``minprocs``. The hard limit may only be raised if supervisord
  198. is run as root. supervisord will enter a failure mode when the OS runs out
  199. of process descriptors, so it's useful to ensure that enough process
  200. descriptors are available upon :program:`supervisord` startup.
  201. *Default*: 200
  202. *Required*: No.
  203. *Introduced*: 3.0
  204. ``nocleanup``
  205. Prevent supervisord from clearing any existing ``AUTO``
  206. chlild log files at startup time. Useful for debugging.
  207. *Default*: false
  208. *Required*: No.
  209. *Introduced*: 3.0
  210. ``childlogdir``
  211. The directory used for ``AUTO`` child log files. This option can
  212. include the value ``%(here)s``, which expands to the directory in
  213. which the :program:`supervisord` configuration file was found.
  214. *Default*: value of Python's :func:`tempfile.get_tempdir`
  215. *Required*: No.
  216. *Introduced*: 3.0
  217. ``user``
  218. If :program:`supervisord` is run as the root user, switch users to
  219. this UNIX user account before doing any meaningful processing. This
  220. value has no effect if :program:`supervisord` is not run as root.
  221. *Default*: do not switch users
  222. *Required*: No.
  223. *Introduced*: 3.0
  224. ``directory``
  225. When :program:`supervisord` daemonizes, switch to this directory.
  226. This option can include the value ``%(here)s``, which expands to the
  227. directory in which the :program:`supervisord` configuration file was
  228. found.
  229. *Default*: do not cd
  230. *Required*: No.
  231. *Introduced*: 3.0
  232. ``strip_ansi``
  233. Strip all ANSI escape sequences from child log files.
  234. *Default*: false
  235. *Required*: No.
  236. *Introduced*: 3.0
  237. ``environment``
  238. A list of key/value pairs in the form ``KEY="val",KEY2="val2"`` that
  239. will be placed in the :program:`supervisord` process' environment
  240. (and as a result in all of its child process' environments). This
  241. option can include the value ``%(here)s``, which expands to the
  242. directory in which the supervisord configuration file was found.
  243. Values containing non-alphanumeric characters should be quoted
  244. (e.g. ``KEY="val:123",KEY2="val,456"``). Otherwise, quoting the
  245. values is optional but recommended. To escape percent characters,
  246. simply use two. (e.g. ``URI="/first%%20name"``) **Note** that
  247. subprocesses will inherit the environment variables of the shell
  248. used to start :program:`supervisord` except for the ones overridden
  249. here and within the program's ``environment`` option. See
  250. :ref:`subprocess_environment`.
  251. *Default*: no values
  252. *Required*: No.
  253. *Introduced*: 3.0
  254. ``identifier``
  255. The identifier string for this supervisor process, used by the RPC
  256. interface.
  257. *Default*: supervisor
  258. *Required*: No.
  259. *Introduced*: 3.0
  260. ``[supervisord]`` Section Example
  261. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  262. .. code-block:: ini
  263. [supervisord]
  264. logfile = /tmp/supervisord.log
  265. logfile_maxbytes = 50MB
  266. logfile_backups=10
  267. loglevel = info
  268. pidfile = /tmp/supervisord.pid
  269. nodaemon = false
  270. minfds = 1024
  271. minprocs = 200
  272. umask = 022
  273. user = chrism
  274. identifier = supervisor
  275. directory = /tmp
  276. nocleanup = true
  277. childlogdir = /tmp
  278. strip_ansi = false
  279. environment = KEY1="value1",KEY2="value2"
  280. ``[supervisorctl]`` Section Settings
  281. ------------------------------------
  282. The configuration file may contain settings for the
  283. :program:`supervisorctl` interactive shell program. These options
  284. are listed below.
  285. ``[supervisorctl]`` Section Values
  286. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  287. ``serverurl``
  288. The URL that should be used to access the supervisord server,
  289. e.g. ``http://localhost:9001``. For UNIX domain sockets, use
  290. ``unix:///absolute/path/to/file.sock``.
  291. *Default*: ``http://localhost:9001``
  292. *Required*: No.
  293. *Introduced*: 3.0
  294. ``username``
  295. The username to pass to the supervisord server for use in
  296. authentication. This should be same as ``username`` from the
  297. supervisord server configuration for the port or UNIX domain socket
  298. you're attempting to access.
  299. *Default*: No username
  300. *Required*: No.
  301. *Introduced*: 3.0
  302. ``password``
  303. The password to pass to the supervisord server for use in
  304. authentication. This should be the cleartext version of ``password``
  305. from the supervisord server configuration for the port or UNIX
  306. domain socket you're attempting to access. This value cannot be
  307. passed as a SHA hash. Unlike other passwords specified in this
  308. file, it must be provided in cleartext.
  309. *Default*: No password
  310. *Required*: No.
  311. *Introduced*: 3.0
  312. ``prompt``
  313. String used as supervisorctl prompt.
  314. *Default*: ``supervisor``
  315. *Required*: No.
  316. *Introduced*: 3.0
  317. ``history_file``
  318. A path to use as the ``readline`` persistent history file. If you
  319. enable this feature by choosing a path, your supervisorctl commands
  320. will be kept in the file, and you can use readline (e.g. arrow-up)
  321. to invoke commands you performed in your last supervisorctl session.
  322. *Default*: No file
  323. *Required*: No.
  324. *Introduced*: 3.0a5
  325. ``[supervisorctl]`` Section Example
  326. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  327. .. code-block:: ini
  328. [supervisorctl]
  329. serverurl = unix:///tmp/supervisor.sock
  330. username = chris
  331. password = 123
  332. prompt = mysupervisor
  333. .. _programx_section:
  334. ``[program:x]`` Section Settings
  335. --------------------------------
  336. The configuration file must contain one or more ``program`` sections
  337. in order for supervisord to know which programs it should start and
  338. control. The header value is composite value. It is the word
  339. "program", followed directly by a colon, then the program name. A
  340. header value of ``[program:foo]`` describes a program with the name of
  341. "foo". The name is used within client applications that control the
  342. processes that are created as a result of this configuration. It is
  343. an error to create a ``program`` section that does not have a name.
  344. The name must not include a colon character or a bracket character.
  345. The value of the name is used as the value for the
  346. ``%(program_name)s`` string expression expansion within other values
  347. where specified.
  348. .. note::
  349. A ``[program:x]`` section actually represents a "homogeneous
  350. process group" to supervisor (as of 3.0). The members of the group
  351. are defined by the combination of the ``numprocs`` and
  352. ``process_name`` parameters in the configuration. By default, if
  353. numprocs and process_name are left unchanged from their defaults,
  354. the group represented by ``[program:x]`` will be named ``x`` and
  355. will have a single process named ``x`` in it. This provides a
  356. modicum of backwards compatibility with older supervisor releases,
  357. which did not treat program sections as homogeneous process group
  358. definitions.
  359. But for instance, if you have a ``[program:foo]`` section with a
  360. ``numprocs`` of 3 and a ``process_name`` expression of
  361. ``%(program_name)s_%(process_num)02d``, the "foo" group will
  362. contain three processes, named ``foo_00``, ``foo_01``, and
  363. ``foo_02``. This makes it possible to start a number of very
  364. similar processes using a single ``[program:x]`` section. All
  365. logfile names, all environment strings, and the command of programs
  366. can also contain similar Python string expressions, to pass
  367. slightly different parameters to each process.
  368. ``[program:x]`` Section Values
  369. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  370. ``command``
  371. The command that will be run when this program is started. The
  372. command can be either absolute (e.g. ``/path/to/programname``) or
  373. relative (e.g. ``programname``). If it is relative, the
  374. supervisord's environment ``$PATH`` will be searched for the
  375. executable. Programs can accept arguments, e.g. ``/path/to/program
  376. foo bar``. The command line can use double quotes to group
  377. arguments with spaces in them to pass to the program,
  378. e.g. ``/path/to/program/name -p "foo bar"``. Note that the value of
  379. ``command`` may include Python string expressions,
  380. e.g. ``/path/to/programname --port=80%(process_num)02d`` might
  381. expand to ``/path/to/programname --port=8000`` at runtime. String
  382. expressions are evaluated against a dictionary containing the keys
  383. ``group_name``, ``host_node_name``, ``process_num``, ``program_name``,
  384. ``here`` (the directory of the supervisord config file), and all
  385. supervisord's environment variables prefixed with ``ENV_``. Controlled
  386. programs should themselves not be daemons, as supervisord assumes it is
  387. responsible for daemonizing its subprocesses (see
  388. :ref:`nondaemonizing_of_subprocesses`).
  389. *Default*: No default.
  390. *Required*: Yes.
  391. *Introduced*: 3.0
  392. ``process_name``
  393. A Python string expression that is used to compose the supervisor
  394. process name for this process. You usually don't need to worry
  395. about setting this unless you change ``numprocs``. The string
  396. expression is evaluated against a dictionary that includes
  397. ``group_name``, ``host_node_name``, ``process_num``, ``program_name``,
  398. and ``here`` (the directory of the supervisord config file).
  399. *Default*: ``%(program_name)s``
  400. *Required*: No.
  401. *Introduced*: 3.0
  402. ``numprocs``
  403. Supervisor will start as many instances of this program as named by
  404. numprocs. Note that if numprocs > 1, the ``process_name``
  405. expression must include ``%(process_num)s`` (or any other
  406. valid Python string expression that includes ``process_num``) within
  407. it.
  408. *Default*: 1
  409. *Required*: No.
  410. *Introduced*: 3.0
  411. ``numprocs_start``
  412. An integer offset that is used to compute the number at which
  413. ``numprocs`` starts.
  414. *Default*: 0
  415. *Required*: No.
  416. *Introduced*: 3.0
  417. ``priority``
  418. The relative priority of the program in the start and shutdown
  419. ordering. Lower priorities indicate programs that start first and
  420. shut down last at startup and when aggregate commands are used in
  421. various clients (e.g. "start all"/"stop all"). Higher priorities
  422. indicate programs that start last and shut down first.
  423. *Default*: 999
  424. *Required*: No.
  425. *Introduced*: 3.0
  426. ``autostart``
  427. If true, this program will start automatically when supervisord is
  428. started.
  429. *Default*: true
  430. *Required*: No.
  431. *Introduced*: 3.0
  432. ``autorestart``
  433. May be one of ``false``, ``unexpected``, or ``true``. If ``false``,
  434. the process will never be autorestarted. If ``unexpected``, the
  435. process will be restart when the program exits with an exit code
  436. that is not one of the exit codes associated with this process'
  437. configuration (see ``exitcodes``). If ``true``, the process will be
  438. unconditionally restarted when it exits, without regard to its exit
  439. code.
  440. *Default*: unexpected
  441. *Required*: No.
  442. *Introduced*: 3.0
  443. ``startsecs``
  444. The total number of seconds which the program needs to stay running
  445. after a startup to consider the start successful. If the program
  446. does not stay up for this many seconds after it has started, even if
  447. it exits with an "expected" exit code (see ``exitcodes``), the
  448. startup will be considered a failure. Set to ``0`` to indicate that
  449. the program needn't stay running for any particular amount of time.
  450. *Default*: 1
  451. *Required*: No.
  452. *Introduced*: 3.0
  453. ``startretries``
  454. The number of serial failure attempts that :program:`supervisord`
  455. will allow when attempting to start the program before giving up and
  456. puting the process into an ``FATAL`` state. See
  457. :ref:`process_states` for explanation of the ``FATAL`` state.
  458. *Default*: 3
  459. *Required*: No.
  460. *Introduced*: 3.0
  461. ``exitcodes``
  462. The list of "expected" exit codes for this program. If the
  463. ``autorestart`` parameter is set to ``unexpected``, and the process
  464. exits in any other way than as a result of a supervisor stop
  465. request, :program:`supervisord` will restart the process if it exits
  466. with an exit code that is not defined in this list.
  467. *Default*: 0,2
  468. *Required*: No.
  469. *Introduced*: 3.0
  470. ``stopsignal``
  471. The signal used to kill the program when a stop is requested. This
  472. can be any of TERM, HUP, INT, QUIT, KILL, USR1, or USR2.
  473. *Default*: TERM
  474. *Required*: No.
  475. *Introduced*: 3.0
  476. ``stopwaitsecs``
  477. The number of seconds to wait for the OS to return a SIGCHILD to
  478. :program:`supervisord` after the program has been sent a stopsignal.
  479. If this number of seconds elapses before :program:`supervisord`
  480. receives a SIGCHILD from the process, :program:`supervisord` will
  481. attempt to kill it with a final SIGKILL.
  482. *Default*: 10
  483. *Required*: No.
  484. *Introduced*: 3.0
  485. ``stopasgroup``
  486. If true, the flag causes supervisor to send the stop signal to the
  487. whole process group and implies ``killasgroup`` is true. This is useful
  488. for programs, such as Flask in debug mode, that do not propagate
  489. stop signals to their children, leaving them orphaned.
  490. *Default*: false
  491. *Required*: No.
  492. *Introduced*: 3.0b1
  493. ``killasgroup``
  494. If true, when resorting to send SIGKILL to the program to terminate
  495. it send it to its whole process group instead, taking care of its
  496. children as well, useful e.g with Python programs using
  497. :mod:`multiprocessing`.
  498. *Default*: false
  499. *Required*: No.
  500. *Introduced*: 3.0a11
  501. ``user``
  502. If :program:`supervisord` runs as root, this UNIX user account will
  503. be used as the account which runs the program. If :program:`supervisord`
  504. can't switch to the specified user, the program will not be started.
  505. *Default*: Do not switch users
  506. *Required*: No.
  507. *Introduced*: 3.0
  508. ``redirect_stderr``
  509. If true, cause the process' stderr output to be sent back to
  510. :program:`supervisord` on its stdout file descriptor (in UNIX shell
  511. terms, this is the equivalent of executing ``/the/program 2>&1``).
  512. *Default*: false
  513. *Required*: No.
  514. *Introduced*: 3.0, replaces 2.0's ``log_stdout`` and ``log_stderr``
  515. ``stdout_logfile``
  516. Put process stdout output in this file (and if redirect_stderr is
  517. true, also place stderr output in this file). If ``stdout_logfile``
  518. is unset or set to ``AUTO``, supervisor will automatically choose a
  519. file location. If this is set to ``NONE``, supervisord will create
  520. no log file. ``AUTO`` log files and their backups will be deleted
  521. when :program:`supervisord` restarts. The ``stdout_logfile`` value
  522. can contain Python string expressions that will evaluated against a
  523. dictionary that contains the keys ``group_name``, ``host_node_name``,
  524. ``process_num``, ``program_name``, and ``here`` (the directory of the
  525. supervisord config file).
  526. .. note::
  527. It is not possible for two processes to share a single log file
  528. (``stdout_logfile``) when rotation (``stdout_logfile_maxbytes``)
  529. is enabled. This will result in the file being corrupted.
  530. *Default*: ``AUTO``
  531. *Required*: No.
  532. *Introduced*: 3.0, replaces 2.0's ``logfile``
  533. ``stdout_logfile_maxbytes``
  534. The maximum number of bytes that may be consumed by
  535. ``stdout_logfile`` before it is rotated (suffix multipliers like
  536. "KB", "MB", and "GB" can be used in the value). Set this value to 0
  537. to indicate an unlimited log size.
  538. *Default*: 50MB
  539. *Required*: No.
  540. *Introduced*: 3.0, replaces 2.0's ``logfile_maxbytes``
  541. ``stdout_logfile_backups``
  542. The number of ``stdout_logfile`` backups to keep around resulting
  543. from process stdout log file rotation. If set to 0, no backups
  544. will be kept.
  545. *Default*: 10
  546. *Required*: No.
  547. *Introduced*: 3.0, replaces 2.0's ``logfile_backups``
  548. ``stdout_capture_maxbytes``
  549. Max number of bytes written to capture FIFO when process is in
  550. "stdout capture mode" (see :ref:`capture_mode`). Should be an
  551. integer (suffix multipliers like "KB", "MB" and "GB" can used in the
  552. value). If this value is 0, process capture mode will be off.
  553. *Default*: 0
  554. *Required*: No.
  555. *Introduced*: 3.0, replaces 2.0's ``logfile_backups``
  556. ``stdout_events_enabled``
  557. If true, PROCESS_LOG_STDOUT events will be emitted when the process
  558. writes to its stdout file descriptor. The events will only be
  559. emitted if the file descriptor is not in capture mode at the time
  560. the data is received (see :ref:`capture_mode`).
  561. *Default*: 0
  562. *Required*: No.
  563. *Introduced*: 3.0a7
  564. ``stderr_logfile``
  565. Put process stderr output in this file unless ``redirect_stderr`` is
  566. true. Accepts the same value types as ``stdout_logfile`` and may
  567. contain the same Python string expressions.
  568. .. note::
  569. It is not possible for two processes to share a single log file
  570. (``stderr_logfile``) when rotation (``stderr_logfile_maxbytes``)
  571. is enabled. This will result in the file being corrupted.
  572. *Default*: ``AUTO``
  573. *Required*: No.
  574. *Introduced*: 3.0
  575. ``stderr_logfile_maxbytes``
  576. The maximum number of bytes before logfile rotation for
  577. ``stderr_logfile``. Accepts the same value types as
  578. ``stdout_logfile_maxbytes``.
  579. *Default*: 50MB
  580. *Required*: No.
  581. *Introduced*: 3.0
  582. ``stderr_logfile_backups``
  583. The number of backups to keep around resulting from process stderr
  584. log file rotation. If set to 0, no backups will be kept.
  585. *Default*: 10
  586. *Required*: No.
  587. *Introduced*: 3.0
  588. ``stderr_capture_maxbytes``
  589. Max number of bytes written to capture FIFO when process is in
  590. "stderr capture mode" (see :ref:`capture_mode`). Should be an
  591. integer (suffix multipliers like "KB", "MB" and "GB" can used in the
  592. value). If this value is 0, process capture mode will be off.
  593. *Default*: 0
  594. *Required*: No.
  595. *Introduced*: 3.0
  596. ``stderr_events_enabled``
  597. If true, PROCESS_LOG_STDERR events will be emitted when the process
  598. writes to its stderr file descriptor. The events will only be
  599. emitted if the file descriptor is not in capture mode at the time
  600. the data is received (see :ref:`capture_mode`).
  601. *Default*: false
  602. *Required*: No.
  603. *Introduced*: 3.0a7
  604. ``environment``
  605. A list of key/value pairs in the form ``KEY="val",KEY2="val2"`` that
  606. will be placed in the child process' environment. The environment
  607. string may contain Python string expressions that will be evaluated
  608. against a dictionary containing ``group_name``, ``host_node_name``,
  609. ``process_num``, ``program_name``, and ``here`` (the directory of the
  610. supervisord config file). Values containing non-alphanumeric characters
  611. should be quoted (e.g. ``KEY="val:123",KEY2="val,456"``). Otherwise,
  612. quoting the values is optional but recommended. **Note** that the
  613. subprocess will inherit the environment variables of the shell used to
  614. start "supervisord" except for the ones overridden here. See
  615. :ref:`subprocess_environment`.
  616. *Default*: No extra environment
  617. *Required*: No.
  618. *Introduced*: 3.0
  619. ``directory``
  620. A file path representing a directory to which :program:`supervisord`
  621. should temporarily chdir before exec'ing the child.
  622. *Default*: No chdir (inherit supervisor's)
  623. *Required*: No.
  624. *Introduced*: 3.0
  625. ``umask``
  626. An octal number (e.g. 002, 022) representing the umask of the
  627. process.
  628. *Default*: No special umask (inherit supervisor's)
  629. *Required*: No.
  630. *Introduced*: 3.0
  631. ``serverurl``
  632. The URL passed in the environment to the subprocess process as
  633. ``SUPERVISOR_SERVER_URL`` (see :mod:`supervisor.childutils`) to
  634. allow the subprocess to easily communicate with the internal HTTP
  635. server. If provided, it should have the same syntax and structure
  636. as the ``[supervisorctl]`` section option of the same name. If this
  637. is set to AUTO, or is unset, supervisor will automatically construct
  638. a server URL, giving preference to a server that listens on UNIX
  639. domain sockets over one that listens on an internet socket.
  640. *Default*: AUTO
  641. *Required*: No.
  642. *Introduced*: 3.0
  643. ``[program:x]`` Section Example
  644. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  645. .. code-block:: ini
  646. [program:cat]
  647. command=/bin/cat
  648. process_name=%(program_name)s
  649. numprocs=1
  650. directory=/tmp
  651. umask=022
  652. priority=999
  653. autostart=true
  654. autorestart=true
  655. startsecs=10
  656. startretries=3
  657. exitcodes=0,2
  658. stopsignal=TERM
  659. stopwaitsecs=10
  660. user=chrism
  661. redirect_stderr=false
  662. stdout_logfile=/a/path
  663. stdout_logfile_maxbytes=1MB
  664. stdout_logfile_backups=10
  665. stdout_capture_maxbytes=1MB
  666. stderr_logfile=/a/path
  667. stderr_logfile_maxbytes=1MB
  668. stderr_logfile_backups=10
  669. stderr_capture_maxbytes=1MB
  670. environment=A="1",B="2"
  671. serverurl=AUTO
  672. ``[include]`` Section Settings
  673. ------------------------------
  674. The :file:`supervisord.conf` file may contain a section named
  675. ``[include]``. If the configuration file contains an ``[include]``
  676. section, it must contain a single key named "files". The values in
  677. this key specify other configuration files to be included within the
  678. configuration.
  679. ``[include]`` Section Values
  680. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  681. ``files``
  682. A space-separated sequence of file globs. Each file glob may be
  683. absolute or relative. If the file glob is relative, it is
  684. considered relative to the location of the configuration file which
  685. includes it. A "glob" is a file pattern which matches a specified
  686. pattern according to the rules used by the Unix shell. No tilde
  687. expansion is done, but ``*``, ``?``, and character ranges expressed
  688. with ``[]`` will be correctly matched. Recursive includes from
  689. included files are not supported.
  690. *Default*: No default (required)
  691. *Required*: Yes.
  692. *Introduced*: 3.0
  693. ``[include]`` Section Example
  694. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  695. .. code-block:: ini
  696. [include]
  697. files = /an/absolute/filename.conf /an/absolute/*.conf foo.conf config??.conf
  698. ``[group:x]`` Section Settings
  699. ------------------------------
  700. It is often useful to group "homogeneous" process groups (aka
  701. "programs") together into a "heterogeneous" process group so they can
  702. be controlled as a unit from Supervisor's various controller
  703. interfaces.
  704. To place programs into a group so you can treat them as a unit, define
  705. a ``[group:x]`` section in your configuration file. The group header
  706. value is a composite. It is the word "group", followed directly by a
  707. colon, then the group name. A header value of ``[group:foo]``
  708. describes a group with the name of "foo". The name is used within
  709. client applications that control the processes that are created as a
  710. result of this configuration. It is an error to create a ``group``
  711. section that does not have a name. The name must not include a colon
  712. character or a bracket character.
  713. For a ``[group:x]``, there must be one or more ``[program:x]``
  714. sections elsewhere in your configuration file, and the group must
  715. refer to them by name in the ``programs`` value.
  716. If "homogeneous" process groups (represented by program sections) are
  717. placed into a "heterogeneous" group via ``[group:x]`` section's
  718. ``programs`` line, the homogeneous groups that are implied by the
  719. program section will not exist at runtime in supervisor. Instead, all
  720. processes belonging to each of the homogeneous groups will be placed
  721. into the heterogeneous group. For example, given the following group
  722. configuration:
  723. .. code-block:: ini
  724. [group:foo]
  725. programs=bar,baz
  726. priority=999
  727. Given the above, at supervisord startup, the ``bar`` and ``baz``
  728. homogeneous groups will not exist, and the processes that would have
  729. been under them will now be moved into the ``foo`` group.
  730. ``[group:x]`` Section Values
  731. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  732. ``programs``
  733. A comma-separated list of program names. The programs which are
  734. listed become members of the group.
  735. *Default*: No default (required)
  736. *Required*: Yes.
  737. *Introduced*: 3.0
  738. ``priority``
  739. A priority number analogous to a ``[program:x]`` priority value
  740. assigned to the group.
  741. *Default*: 999
  742. *Required*: No.
  743. *Introduced*: 3.0
  744. ``[group:x]`` Section Example
  745. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  746. .. code-block:: ini
  747. [group:foo]
  748. programs=bar,baz
  749. priority=999
  750. ``[fcgi-program:x]`` Section Settings
  751. -------------------------------------
  752. Supervisor can manage groups of `FastCGI <http://www.fastcgi.com>`_
  753. processes that all listen on the same socket. Until now, deployment
  754. flexibility for FastCGI was limited. To get full process management,
  755. you could use mod_fastcgi under Apache but then you were stuck with
  756. Apache's inefficient concurrency model of one process or thread per
  757. connection. In addition to requiring more CPU and memory resources,
  758. the process/thread per connection model can be quickly saturated by a
  759. slow resource, preventing other resources from being served. In order
  760. to take advantage of newer event-driven web servers such as lighttpd
  761. or nginx which don't include a built-in process manager, you had to
  762. use scripts like cgi-fcgi or spawn-fcgi. These can be used in
  763. conjunction with a process manager such as supervisord or daemontools
  764. but require each FastCGI child process to bind to its own socket.
  765. The disadvantages of this are: unnecessarily complicated web server
  766. configuration, ungraceful restarts, and reduced fault tolerance. With
  767. fewer sockets to configure, web server configurations are much smaller
  768. if groups of FastCGI processes can share sockets. Shared sockets
  769. allow for graceful restarts because the socket remains bound by the
  770. parent process while any of the child processes are being restarted.
  771. Finally, shared sockets are more fault tolerant because if a given
  772. process fails, other processes can continue to serve inbound
  773. connections.
  774. With integrated FastCGI spawning support, Supervisor gives you the
  775. best of both worlds. You get full-featured process management with
  776. groups of FastCGI processes sharing sockets without being tied to a
  777. particular web server. It's a clean separation of concerns, allowing
  778. the web server and the process manager to each do what they do best.
  779. .. note::
  780. The socket manager in Supervisor was originally developed to support
  781. FastCGI processes but it is not limited to FastCGI. Other protocols may
  782. be used as well with no special configuration. Any program that can
  783. access an open socket from a file descriptor (e.g. with
  784. `socket.fromfd <http://docs.python.org/library/socket.html#socket.fromfd>`_
  785. in Python) can use the socket manager. Supervisor will automatically
  786. create the socket, bind, and listen before forking the first child in a
  787. group. The socket will be passed to each child on file descriptor
  788. number ``0`` (zero). When the last child in the group exits,
  789. Supervisor will close the socket.
  790. All the options available to ``[program:x]`` sections are
  791. also respected by ``fcgi-program`` sections.
  792. ``[fcgi-program:x]`` Section Values
  793. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  794. ``[fcgi-program:x]`` sections have a single key which ``[program:x]``
  795. sections do not have.
  796. ``socket``
  797. The FastCGI socket for this program, either TCP or UNIX domain
  798. socket. For TCP sockets, use this format: ``tcp://localhost:9002``.
  799. For UNIX domain sockets, use ``unix:///absolute/path/to/file.sock``.
  800. String expressions are evaluated against a dictionary containing the
  801. keys "program_name" and "here" (the directory of the supervisord
  802. config file).
  803. *Default*: No default.
  804. *Required*: Yes.
  805. *Introduced*: 3.0
  806. ``socket_owner``
  807. For UNIX domain sockets, this parameter can be used to specify the user
  808. and group for the FastCGI socket. May be a UNIX username (e.g. chrism)
  809. or a UNIX username and group separated by a colon (e.g. chrism:wheel).
  810. *Default*: Uses the user and group set for the fcgi-program
  811. *Required*: No.
  812. *Introduced*: 3.0
  813. ``socket_mode``
  814. For UNIX domain sockets, this parameter can be used to specify the
  815. permission mode.
  816. *Default*: 0700
  817. *Required*: No.
  818. *Introduced*: 3.0
  819. Consult :ref:`programx_section` for other allowable keys, delta the
  820. above constraints and additions.
  821. ``[fcgi-program:x]`` Section Example
  822. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  823. .. code-block:: ini
  824. [fcgi-program:fcgiprogramname]
  825. command=/usr/bin/example.fcgi
  826. socket=unix:///var/run/supervisor/%(program_name)s.sock
  827. process_name=%(program_name)s_%(process_num)02d
  828. numprocs=5
  829. priority=999
  830. autostart=true
  831. autorestart=unexpected
  832. startsecs=1
  833. startretries=3
  834. exitcodes=0,2
  835. stopsignal=QUIT
  836. stopwaitsecs=10
  837. user=chrism
  838. redirect_stderr=true
  839. stdout_logfile=/a/path
  840. stdout_logfile_maxbytes=1MB
  841. stdout_logfile_backups=10
  842. stderr_logfile=/a/path
  843. stderr_logfile_maxbytes=1MB
  844. stderr_logfile_backups
  845. environment=A="1",B="2"
  846. ``[eventlistener:x]`` Section Settings
  847. --------------------------------------
  848. Supervisor allows specialized homogeneous process groups ("event
  849. listener pools") to be defined within the configuration file. These
  850. pools contain processes that are meant to receive and respond to event
  851. notifications from supervisor's event system. See :ref:`events` for
  852. an explanation of how events work and how to implement programs that
  853. can be declared as event listeners.
  854. Note that all the options available to ``[program:x]`` sections are
  855. respected by eventlistener sections *except* for
  856. ``stdout_capture_maxbytes`` and ``stderr_capture_maxbytes`` (event
  857. listeners cannot emit process communication events, see
  858. :ref:`capture_mode`).
  859. ``[eventlistener:x]`` Section Values
  860. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  861. ``[eventlistener:x]`` sections have a few keys which ``[program:x]``
  862. sections do not have.
  863. ``buffer_size``
  864. The event listener pool's event queue buffer size. When a listener
  865. pool's event buffer is overflowed (as can happen when an event
  866. listener pool cannot keep up with all of the events sent to it), the
  867. oldest event in the buffer is discarded.
  868. ``events``
  869. A comma-separated list of event type names that this listener is
  870. "interested" in receiving notifications for (see
  871. :ref:`event_types` for a list of valid event type names).
  872. ``result_handler``
  873. A `pkg_resources entry point string
  874. <http://peak.telecommunity.com/DevCenter/PkgResources>`_ that
  875. resolves to a Python callable. The default value is
  876. ``supervisor.dispatchers:default_handler``. Specifying an alternate
  877. result handler is a very uncommon thing to need to do, and as a
  878. result, how to create one is not documented.
  879. Consult :ref:`programx_section` for other allowable keys, delta the
  880. above constraints and additions.
  881. ``[eventlistener:x]`` Section Example
  882. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  883. .. code-block:: ini
  884. [eventlistener:theeventlistenername]
  885. command=/bin/eventlistener
  886. process_name=%(program_name)s_%(process_num)02d
  887. numprocs=5
  888. events=PROCESS_STATE
  889. buffer_size=10
  890. priority=-1
  891. autostart=true
  892. autorestart=unexpected
  893. startsecs=1
  894. startretries=3
  895. exitcodes=0,2
  896. stopsignal=QUIT
  897. stopwaitsecs=10
  898. user=chrism
  899. redirect_stderr=true
  900. stdout_logfile=/a/path
  901. stdout_logfile_maxbytes=1MB
  902. stdout_logfile_backups=10
  903. stderr_logfile=/a/path
  904. stderr_logfile_maxbytes=1MB
  905. stderr_logfile_backups
  906. environment=A="1",B="2"
  907. ``[rpcinterface:x]`` Section Settings
  908. -------------------------------------
  909. Adding ``rpcinterface:x`` settings in the configuration file is only
  910. useful for people who wish to extend supervisor with additional custom
  911. behavior.
  912. In the sample config file, there is a section which is named
  913. ``[rpcinterface:supervisor]``. By default it looks like the
  914. following.
  915. .. code-block:: ini
  916. [rpcinterface:supervisor]
  917. supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
  918. The ``[rpcinterface:supervisor]`` section *must* remain in the
  919. configuration for the standard setup of supervisor to work properly.
  920. If you don't want supervisor to do anything it doesn't already do out
  921. of the box, this is all you need to know about this type of section.
  922. However, if you wish to add rpc interface namespaces in order to
  923. customize supervisor, you may add additional ``[rpcinterface:foo]``
  924. sections, where "foo" represents the namespace of the interface (from
  925. the web root), and the value named by
  926. ``supervisor.rpcinterface_factory`` is a factory callable which should
  927. have a function signature that accepts a single positional argument
  928. ``supervisord`` and as many keyword arguments as required to perform
  929. configuration. Any extra key/value pairs defined within the
  930. ``[rpcinterface:x]`` section will be passed as keyword arguments to
  931. the factory.
  932. Here's an example of a factory function, created in the
  933. ``__init__.py`` file of the Python package ``my.package``.
  934. .. code-block:: python
  935. from my.package.rpcinterface import AnotherRPCInterface
  936. def make_another_rpcinterface(supervisord, **config):
  937. retries = int(config.get('retries', 0))
  938. another_rpc_interface = AnotherRPCInterface(supervisord, retries)
  939. return another_rpc_interface
  940. And a section in the config file meant to configure it.
  941. .. code-block:: ini
  942. [rpcinterface:another]
  943. supervisor.rpcinterface_factory = my.package:make_another_rpcinterface
  944. retries = 1
  945. ``[rpcinterface:x]`` Section Values
  946. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  947. ``supervisor.rpcinterface_factory``
  948. ``pkg_resources`` "entry point" dotted name to your RPC interface's
  949. factory function.
  950. *Default*: N/A
  951. *Required*: No.
  952. *Introduced*: 3.0
  953. ``[rpcinterface:x]`` Section Example
  954. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  955. .. code-block:: ini
  956. [rpcinterface:another]
  957. supervisor.rpcinterface_factory = my.package:make_another_rpcinterface
  958. retries = 1