configuration.rst 44 KB

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