configuration.rst 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486
  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. ``stderr_logfile``
  607. Put process stderr output in this file unless ``redirect_stderr`` is
  608. true. Accepts the same value types as ``stdout_logfile`` and may
  609. contain the same Python string expressions.
  610. .. note::
  611. It is not possible for two processes to share a single log file
  612. (``stderr_logfile``) when rotation (``stderr_logfile_maxbytes``)
  613. is enabled. This will result in the file being corrupted.
  614. *Default*: ``AUTO``
  615. *Required*: No.
  616. *Introduced*: 3.0
  617. ``stderr_logfile_maxbytes``
  618. The maximum number of bytes before logfile rotation for
  619. ``stderr_logfile``. Accepts the same value types as
  620. ``stdout_logfile_maxbytes``.
  621. *Default*: 50MB
  622. *Required*: No.
  623. *Introduced*: 3.0
  624. ``stderr_logfile_backups``
  625. The number of backups to keep around resulting from process stderr
  626. log file rotation. If set to 0, no backups will be kept.
  627. *Default*: 10
  628. *Required*: No.
  629. *Introduced*: 3.0
  630. ``stderr_capture_maxbytes``
  631. Max number of bytes written to capture FIFO when process is in
  632. "stderr capture mode" (see :ref:`capture_mode`). Should be an
  633. integer (suffix multipliers like "KB", "MB" and "GB" can used in the
  634. value). If this value is 0, process capture mode will be off.
  635. *Default*: 0
  636. *Required*: No.
  637. *Introduced*: 3.0
  638. ``stderr_events_enabled``
  639. If true, PROCESS_LOG_STDERR events will be emitted when the process
  640. writes to its stderr file descriptor. The events will only be
  641. emitted if the file descriptor is not in capture mode at the time
  642. the data is received (see :ref:`capture_mode`).
  643. *Default*: false
  644. *Required*: No.
  645. *Introduced*: 3.0a7
  646. ``environment``
  647. A list of key/value pairs in the form ``KEY="val",KEY2="val2"`` that
  648. will be placed in the child process' environment. The environment
  649. string may contain Python string expressions that will be evaluated
  650. against a dictionary containing ``group_name``, ``host_node_name``,
  651. ``process_num``, ``program_name``, and ``here`` (the directory of the
  652. supervisord config file). Values containing non-alphanumeric characters
  653. should be quoted (e.g. ``KEY="val:123",KEY2="val,456"``). Otherwise,
  654. quoting the values is optional but recommended. **Note** that the
  655. subprocess will inherit the environment variables of the shell used to
  656. start "supervisord" except for the ones overridden here. See
  657. :ref:`subprocess_environment`.
  658. *Default*: No extra environment
  659. *Required*: No.
  660. *Introduced*: 3.0
  661. ``directory``
  662. A file path representing a directory to which :program:`supervisord`
  663. should temporarily chdir before exec'ing the child.
  664. *Default*: No chdir (inherit supervisor's)
  665. *Required*: No.
  666. *Introduced*: 3.0
  667. ``umask``
  668. An octal number (e.g. 002, 022) representing the umask of the
  669. process.
  670. *Default*: No special umask (inherit supervisor's)
  671. *Required*: No.
  672. *Introduced*: 3.0
  673. ``serverurl``
  674. The URL passed in the environment to the subprocess process as
  675. ``SUPERVISOR_SERVER_URL`` (see :mod:`supervisor.childutils`) to
  676. allow the subprocess to easily communicate with the internal HTTP
  677. server. If provided, it should have the same syntax and structure
  678. as the ``[supervisorctl]`` section option of the same name. If this
  679. is set to AUTO, or is unset, supervisor will automatically construct
  680. a server URL, giving preference to a server that listens on UNIX
  681. domain sockets over one that listens on an internet socket.
  682. *Default*: AUTO
  683. *Required*: No.
  684. *Introduced*: 3.0
  685. ``[program:x]`` Section Example
  686. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  687. .. code-block:: ini
  688. [program:cat]
  689. command=/bin/cat
  690. process_name=%(program_name)s
  691. numprocs=1
  692. directory=/tmp
  693. umask=022
  694. priority=999
  695. autostart=true
  696. autorestart=unexpected
  697. startsecs=10
  698. startretries=3
  699. exitcodes=0,2
  700. stopsignal=TERM
  701. stopwaitsecs=10
  702. stopasgroup=false
  703. killasgroup=false
  704. user=chrism
  705. redirect_stderr=false
  706. stdout_logfile=/a/path
  707. stdout_logfile_maxbytes=1MB
  708. stdout_logfile_backups=10
  709. stdout_capture_maxbytes=1MB
  710. stdout_events_enabled=false
  711. stderr_logfile=/a/path
  712. stderr_logfile_maxbytes=1MB
  713. stderr_logfile_backups=10
  714. stderr_capture_maxbytes=1MB
  715. stderr_events_enabled=false
  716. environment=A="1",B="2"
  717. serverurl=AUTO
  718. ``[include]`` Section Settings
  719. ------------------------------
  720. The :file:`supervisord.conf` file may contain a section named
  721. ``[include]``. If the configuration file contains an ``[include]``
  722. section, it must contain a single key named "files". The values in
  723. this key specify other configuration files to be included within the
  724. configuration.
  725. ``[include]`` Section Values
  726. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  727. ``files``
  728. A space-separated sequence of file globs. Each file glob may be
  729. absolute or relative. If the file glob is relative, it is
  730. considered relative to the location of the configuration file which
  731. includes it. A "glob" is a file pattern which matches a specified
  732. pattern according to the rules used by the Unix shell. No tilde
  733. expansion is done, but ``*``, ``?``, and character ranges expressed
  734. with ``[]`` will be correctly matched. The string expression is
  735. evaluated against a dictionary that includes ``host_node_name``
  736. and ``here`` (the directory of the supervisord config file). Recursive
  737. includes from included files are not supported.
  738. *Default*: No default (required)
  739. *Required*: Yes.
  740. *Introduced*: 3.0
  741. *Changed*: 3.3.0. Added support for the ``host_node_name`` expansion.
  742. ``[include]`` Section Example
  743. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  744. .. code-block:: ini
  745. [include]
  746. files = /an/absolute/filename.conf /an/absolute/*.conf foo.conf config??.conf
  747. ``[group:x]`` Section Settings
  748. ------------------------------
  749. It is often useful to group "homogeneous" process groups (aka
  750. "programs") together into a "heterogeneous" process group so they can
  751. be controlled as a unit from Supervisor's various controller
  752. interfaces.
  753. To place programs into a group so you can treat them as a unit, define
  754. a ``[group:x]`` section in your configuration file. The group header
  755. value is a composite. It is the word "group", followed directly by a
  756. colon, then the group name. A header value of ``[group:foo]``
  757. describes a group with the name of "foo". The name is used within
  758. client applications that control the processes that are created as a
  759. result of this configuration. It is an error to create a ``group``
  760. section that does not have a name. The name must not include a colon
  761. character or a bracket character.
  762. For a ``[group:x]``, there must be one or more ``[program:x]``
  763. sections elsewhere in your configuration file, and the group must
  764. refer to them by name in the ``programs`` value.
  765. If "homogeneous" process groups (represented by program sections) are
  766. placed into a "heterogeneous" group via ``[group:x]`` section's
  767. ``programs`` line, the homogeneous groups that are implied by the
  768. program section will not exist at runtime in supervisor. Instead, all
  769. processes belonging to each of the homogeneous groups will be placed
  770. into the heterogeneous group. For example, given the following group
  771. configuration:
  772. .. code-block:: ini
  773. [group:foo]
  774. programs=bar,baz
  775. priority=999
  776. Given the above, at supervisord startup, the ``bar`` and ``baz``
  777. homogeneous groups will not exist, and the processes that would have
  778. been under them will now be moved into the ``foo`` group.
  779. ``[group:x]`` Section Values
  780. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  781. ``programs``
  782. A comma-separated list of program names. The programs which are
  783. listed become members of the group.
  784. *Default*: No default (required)
  785. *Required*: Yes.
  786. *Introduced*: 3.0
  787. ``priority``
  788. A priority number analogous to a ``[program:x]`` priority value
  789. assigned to the group.
  790. *Default*: 999
  791. *Required*: No.
  792. *Introduced*: 3.0
  793. ``[group:x]`` Section Example
  794. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  795. .. code-block:: ini
  796. [group:foo]
  797. programs=bar,baz
  798. priority=999
  799. ``[fcgi-program:x]`` Section Settings
  800. -------------------------------------
  801. Supervisor can manage groups of `FastCGI <http://www.fastcgi.com>`_
  802. processes that all listen on the same socket. Until now, deployment
  803. flexibility for FastCGI was limited. To get full process management,
  804. you could use mod_fastcgi under Apache but then you were stuck with
  805. Apache's inefficient concurrency model of one process or thread per
  806. connection. In addition to requiring more CPU and memory resources,
  807. the process/thread per connection model can be quickly saturated by a
  808. slow resource, preventing other resources from being served. In order
  809. to take advantage of newer event-driven web servers such as lighttpd
  810. or nginx which don't include a built-in process manager, you had to
  811. use scripts like cgi-fcgi or spawn-fcgi. These can be used in
  812. conjunction with a process manager such as supervisord or daemontools
  813. but require each FastCGI child process to bind to its own socket.
  814. The disadvantages of this are: unnecessarily complicated web server
  815. configuration, ungraceful restarts, and reduced fault tolerance. With
  816. fewer sockets to configure, web server configurations are much smaller
  817. if groups of FastCGI processes can share sockets. Shared sockets
  818. allow for graceful restarts because the socket remains bound by the
  819. parent process while any of the child processes are being restarted.
  820. Finally, shared sockets are more fault tolerant because if a given
  821. process fails, other processes can continue to serve inbound
  822. connections.
  823. With integrated FastCGI spawning support, Supervisor gives you the
  824. best of both worlds. You get full-featured process management with
  825. groups of FastCGI processes sharing sockets without being tied to a
  826. particular web server. It's a clean separation of concerns, allowing
  827. the web server and the process manager to each do what they do best.
  828. .. note::
  829. The socket manager in Supervisor was originally developed to support
  830. FastCGI processes but it is not limited to FastCGI. Other protocols may
  831. be used as well with no special configuration. Any program that can
  832. access an open socket from a file descriptor (e.g. with
  833. `socket.fromfd <http://docs.python.org/library/socket.html#socket.fromfd>`_
  834. in Python) can use the socket manager. Supervisor will automatically
  835. create the socket, bind, and listen before forking the first child in a
  836. group. The socket will be passed to each child on file descriptor
  837. number ``0`` (zero). When the last child in the group exits,
  838. Supervisor will close the socket.
  839. All the options available to ``[program:x]`` sections are
  840. also respected by ``fcgi-program`` sections.
  841. ``[fcgi-program:x]`` Section Values
  842. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  843. ``[fcgi-program:x]`` sections have a single key which ``[program:x]``
  844. sections do not have.
  845. ``socket``
  846. The FastCGI socket for this program, either TCP or UNIX domain
  847. socket. For TCP sockets, use this format: ``tcp://localhost:9002``.
  848. For UNIX domain sockets, use ``unix:///absolute/path/to/file.sock``.
  849. String expressions are evaluated against a dictionary containing the
  850. keys "program_name" and "here" (the directory of the supervisord
  851. config file).
  852. *Default*: No default.
  853. *Required*: Yes.
  854. *Introduced*: 3.0
  855. ``socket_owner``
  856. For UNIX domain sockets, this parameter can be used to specify the user
  857. and group for the FastCGI socket. May be a UNIX username (e.g. chrism)
  858. or a UNIX username and group separated by a colon (e.g. chrism:wheel).
  859. *Default*: Uses the user and group set for the fcgi-program
  860. *Required*: No.
  861. *Introduced*: 3.0
  862. ``socket_mode``
  863. For UNIX domain sockets, this parameter can be used to specify the
  864. permission mode.
  865. *Default*: 0700
  866. *Required*: No.
  867. *Introduced*: 3.0
  868. Consult :ref:`programx_section` for other allowable keys, delta the
  869. above constraints and additions.
  870. ``[fcgi-program:x]`` Section Example
  871. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  872. .. code-block:: ini
  873. [fcgi-program:fcgiprogramname]
  874. command=/usr/bin/example.fcgi
  875. socket=unix:///var/run/supervisor/%(program_name)s.sock
  876. socket_owner=chrism
  877. socket_mode=0700
  878. process_name=%(program_name)s_%(process_num)02d
  879. numprocs=5
  880. directory=/tmp
  881. umask=022
  882. priority=999
  883. autostart=true
  884. autorestart=unexpected
  885. startsecs=1
  886. startretries=3
  887. exitcodes=0,2
  888. stopsignal=QUIT
  889. stopasgroup=false
  890. killasgroup=false
  891. stopwaitsecs=10
  892. user=chrism
  893. redirect_stderr=true
  894. stdout_logfile=/a/path
  895. stdout_logfile_maxbytes=1MB
  896. stdout_logfile_backups=10
  897. stdout_events_enabled=false
  898. stderr_logfile=/a/path
  899. stderr_logfile_maxbytes=1MB
  900. stderr_logfile_backups=10
  901. stderr_events_enabled=false
  902. environment=A="1",B="2"
  903. serverurl=AUTO
  904. ``[eventlistener:x]`` Section Settings
  905. --------------------------------------
  906. Supervisor allows specialized homogeneous process groups ("event
  907. listener pools") to be defined within the configuration file. These
  908. pools contain processes that are meant to receive and respond to event
  909. notifications from supervisor's event system. See :ref:`events` for
  910. an explanation of how events work and how to implement programs that
  911. can be declared as event listeners.
  912. Note that all the options available to ``[program:x]`` sections are
  913. respected by eventlistener sections *except* for
  914. ``stdout_capture_maxbytes`` and ``stderr_capture_maxbytes`` (event
  915. listeners cannot emit process communication events, see
  916. :ref:`capture_mode`).
  917. ``[eventlistener:x]`` Section Values
  918. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  919. ``[eventlistener:x]`` sections have a few keys which ``[program:x]``
  920. sections do not have.
  921. ``buffer_size``
  922. The event listener pool's event queue buffer size. When a listener
  923. pool's event buffer is overflowed (as can happen when an event
  924. listener pool cannot keep up with all of the events sent to it), the
  925. oldest event in the buffer is discarded.
  926. ``events``
  927. A comma-separated list of event type names that this listener is
  928. "interested" in receiving notifications for (see
  929. :ref:`event_types` for a list of valid event type names).
  930. ``result_handler``
  931. A `pkg_resources entry point string
  932. <http://peak.telecommunity.com/DevCenter/PkgResources>`_ that
  933. resolves to a Python callable. The default value is
  934. ``supervisor.dispatchers:default_handler``. Specifying an alternate
  935. result handler is a very uncommon thing to need to do, and as a
  936. result, how to create one is not documented.
  937. Consult :ref:`programx_section` for other allowable keys, delta the
  938. above constraints and additions.
  939. ``[eventlistener:x]`` Section Example
  940. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  941. .. code-block:: ini
  942. [eventlistener:theeventlistenername]
  943. command=/bin/eventlistener
  944. process_name=%(program_name)s_%(process_num)02d
  945. numprocs=5
  946. events=PROCESS_STATE
  947. buffer_size=10
  948. directory=/tmp
  949. umask=022
  950. priority=-1
  951. autostart=true
  952. autorestart=unexpected
  953. startsecs=1
  954. startretries=3
  955. exitcodes=0,2
  956. stopsignal=QUIT
  957. stopwaitsecs=10
  958. stopasgroup=false
  959. killasgroup=false
  960. user=chrism
  961. redirect_stderr=false
  962. stdout_logfile=/a/path
  963. stdout_logfile_maxbytes=1MB
  964. stdout_logfile_backups=10
  965. stdout_events_enabled=false
  966. stderr_logfile=/a/path
  967. stderr_logfile_maxbytes=1MB
  968. stderr_logfile_backups=10
  969. stderr_events_enabled=false
  970. environment=A="1",B="2"
  971. serverurl=AUTO
  972. ``[rpcinterface:x]`` Section Settings
  973. -------------------------------------
  974. Adding ``rpcinterface:x`` settings in the configuration file is only
  975. useful for people who wish to extend supervisor with additional custom
  976. behavior.
  977. In the sample config file, there is a section which is named
  978. ``[rpcinterface:supervisor]``. By default it looks like the
  979. following.
  980. .. code-block:: ini
  981. [rpcinterface:supervisor]
  982. supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
  983. The ``[rpcinterface:supervisor]`` section *must* remain in the
  984. configuration for the standard setup of supervisor to work properly.
  985. If you don't want supervisor to do anything it doesn't already do out
  986. of the box, this is all you need to know about this type of section.
  987. However, if you wish to add rpc interface namespaces in order to
  988. customize supervisor, you may add additional ``[rpcinterface:foo]``
  989. sections, where "foo" represents the namespace of the interface (from
  990. the web root), and the value named by
  991. ``supervisor.rpcinterface_factory`` is a factory callable which should
  992. have a function signature that accepts a single positional argument
  993. ``supervisord`` and as many keyword arguments as required to perform
  994. configuration. Any extra key/value pairs defined within the
  995. ``[rpcinterface:x]`` section will be passed as keyword arguments to
  996. the factory.
  997. Here's an example of a factory function, created in the
  998. ``__init__.py`` file of the Python package ``my.package``.
  999. .. code-block:: python
  1000. from my.package.rpcinterface import AnotherRPCInterface
  1001. def make_another_rpcinterface(supervisord, **config):
  1002. retries = int(config.get('retries', 0))
  1003. another_rpc_interface = AnotherRPCInterface(supervisord, retries)
  1004. return another_rpc_interface
  1005. And a section in the config file meant to configure it.
  1006. .. code-block:: ini
  1007. [rpcinterface:another]
  1008. supervisor.rpcinterface_factory = my.package:make_another_rpcinterface
  1009. retries = 1
  1010. ``[rpcinterface:x]`` Section Values
  1011. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1012. ``supervisor.rpcinterface_factory``
  1013. ``pkg_resources`` "entry point" dotted name to your RPC interface's
  1014. factory function.
  1015. *Default*: N/A
  1016. *Required*: No.
  1017. *Introduced*: 3.0
  1018. ``[rpcinterface:x]`` Section Example
  1019. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1020. .. code-block:: ini
  1021. [rpcinterface:another]
  1022. supervisor.rpcinterface_factory = my.package:make_another_rpcinterface
  1023. retries = 1