configuration.rst 39 KB

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