configuration.rst 41 KB

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