configuration.rst 39 KB

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