configuration.rst 45 KB

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