configuration.rst 43 KB

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