configuration.rst 37 KB

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