configuration.rst 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523
  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. chlild 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. ``autorestart``
  435. May be one of ``false``, ``unexpected``, or ``true``. If ``false``,
  436. the process will never be autorestarted. If ``unexpected``, the
  437. process will be restart when the program exits with an exit code
  438. that is not one of the exit codes associated with this process'
  439. configuration (see ``exitcodes``). If ``true``, the process will be
  440. unconditionally restarted when it exits, without regard to its exit
  441. code.
  442. *Default*: unexpected
  443. *Required*: No.
  444. *Introduced*: 3.0
  445. ``startsecs``
  446. The total number of seconds which the program needs to stay running
  447. after a startup to consider the start successful. If the program
  448. does not stay up for this many seconds after it has started, even if
  449. it exits with an "expected" exit code (see ``exitcodes``), the
  450. startup will be considered a failure. Set to ``0`` to indicate that
  451. the program needn't stay running for any particular amount of time.
  452. *Default*: 1
  453. *Required*: No.
  454. *Introduced*: 3.0
  455. ``startretries``
  456. The number of serial failure attempts that :program:`supervisord`
  457. will allow when attempting to start the program before giving up and
  458. putting the process into an ``FATAL`` state. See
  459. :ref:`process_states` for explanation of the ``FATAL`` state.
  460. *Default*: 3
  461. *Required*: No.
  462. *Introduced*: 3.0
  463. ``exitcodes``
  464. The list of "expected" exit codes for this program. If the
  465. ``autorestart`` parameter is set to ``unexpected``, and the process
  466. exits in any other way than as a result of a supervisor stop
  467. request, :program:`supervisord` will restart the process if it exits
  468. with an exit code that is not defined in this list.
  469. *Default*: 0,2
  470. *Required*: No.
  471. *Introduced*: 3.0
  472. ``stopsignal``
  473. The signal used to kill the program when a stop is requested. This
  474. can be any of TERM, HUP, INT, QUIT, KILL, USR1, or USR2.
  475. *Default*: TERM
  476. *Required*: No.
  477. *Introduced*: 3.0
  478. ``stopwaitsecs``
  479. The number of seconds to wait for the OS to return a SIGCHILD to
  480. :program:`supervisord` after the program has been sent a stopsignal.
  481. If this number of seconds elapses before :program:`supervisord`
  482. receives a SIGCHILD from the process, :program:`supervisord` will
  483. attempt to kill it with a final SIGKILL.
  484. *Default*: 10
  485. *Required*: No.
  486. *Introduced*: 3.0
  487. ``stopasgroup``
  488. If true, the flag causes supervisor to send the stop signal to the
  489. whole process group and implies ``killasgroup`` is true. This is useful
  490. for programs, such as Flask in debug mode, that do not propagate
  491. stop signals to their children, leaving them orphaned.
  492. *Default*: false
  493. *Required*: No.
  494. *Introduced*: 3.0b1
  495. ``killasgroup``
  496. If true, when resorting to send SIGKILL to the program to terminate
  497. it send it to its whole process group instead, taking care of its
  498. children as well, useful e.g with Python programs using
  499. :mod:`multiprocessing`.
  500. *Default*: false
  501. *Required*: No.
  502. *Introduced*: 3.0a11
  503. ``user``
  504. If :program:`supervisord` runs as root, this UNIX user account will
  505. be used as the account which runs the program. If :program:`supervisord`
  506. can't switch to the specified user, the program will not be started.
  507. .. note::
  508. The user will be changed using ``setuid`` only. This does not start
  509. a login shell and does not change environment variables like
  510. ``USER`` or ``HOME``. See :ref:`subprocess_environment` for details.
  511. *Default*: Do not switch users
  512. *Required*: No.
  513. *Introduced*: 3.0
  514. ``redirect_stderr``
  515. If true, cause the process' stderr output to be sent back to
  516. :program:`supervisord` on its stdout file descriptor (in UNIX shell
  517. terms, this is the equivalent of executing ``/the/program 2>&1``).
  518. .. note::
  519. Do not set ``redirect_stderr=true`` in an ``[eventlistener:x]`` section.
  520. Eventlisteners use ``stdout`` and ``stdin`` to communicate with
  521. ``supervisord``. If ``stderr`` is redirected, output from
  522. ``stderr`` will interfere with the eventlistener protocol.
  523. *Default*: false
  524. *Required*: No.
  525. *Introduced*: 3.0, replaces 2.0's ``log_stdout`` and ``log_stderr``
  526. ``stdout_logfile``
  527. Put process stdout output in this file (and if redirect_stderr is
  528. true, also place stderr output in this file). If ``stdout_logfile``
  529. is unset or set to ``AUTO``, supervisor will automatically choose a
  530. file location. If this is set to ``NONE``, supervisord will create
  531. no log file. ``AUTO`` log files and their backups will be deleted
  532. when :program:`supervisord` restarts. The ``stdout_logfile`` value
  533. can contain Python string expressions that will evaluated against a
  534. dictionary that contains the keys ``group_name``, ``host_node_name``,
  535. ``process_num``, ``program_name``, and ``here`` (the directory of the
  536. supervisord config file).
  537. .. note::
  538. It is not possible for two processes to share a single log file
  539. (``stdout_logfile``) when rotation (``stdout_logfile_maxbytes``)
  540. is enabled. This will result in the file being corrupted.
  541. *Default*: ``AUTO``
  542. *Required*: No.
  543. *Introduced*: 3.0, replaces 2.0's ``logfile``
  544. ``stdout_logfile_maxbytes``
  545. The maximum number of bytes that may be consumed by
  546. ``stdout_logfile`` before it is rotated (suffix multipliers like
  547. "KB", "MB", and "GB" can be used in the value). Set this value to 0
  548. to indicate an unlimited log size.
  549. *Default*: 50MB
  550. *Required*: No.
  551. *Introduced*: 3.0, replaces 2.0's ``logfile_maxbytes``
  552. ``stdout_logfile_backups``
  553. The number of ``stdout_logfile`` backups to keep around resulting
  554. from process stdout log file rotation. If set to 0, no backups
  555. will be kept.
  556. *Default*: 10
  557. *Required*: No.
  558. *Introduced*: 3.0, replaces 2.0's ``logfile_backups``
  559. ``stdout_capture_maxbytes``
  560. Max number of bytes written to capture FIFO when process is in
  561. "stdout capture mode" (see :ref:`capture_mode`). Should be an
  562. integer (suffix multipliers like "KB", "MB" and "GB" can used in the
  563. value). If this value is 0, process capture mode will be off.
  564. *Default*: 0
  565. *Required*: No.
  566. *Introduced*: 3.0, replaces 2.0's ``logfile_backups``
  567. ``stdout_events_enabled``
  568. If true, PROCESS_LOG_STDOUT events will be emitted when the process
  569. writes to its stdout file descriptor. The events will only be
  570. emitted if the file descriptor is not in capture mode at the time
  571. the data is received (see :ref:`capture_mode`).
  572. *Default*: 0
  573. *Required*: No.
  574. *Introduced*: 3.0a7
  575. ``stdout_syslog``
  576. If true, stdout will be directed to syslog along with the process name.
  577. *Default*: False
  578. *Required*: No.
  579. *Introduced*: 4.0.0
  580. ``stderr_logfile``
  581. Put process stderr output in this file unless ``redirect_stderr`` is
  582. true. Accepts the same value types as ``stdout_logfile`` and may
  583. contain the same Python string expressions.
  584. .. note::
  585. It is not possible for two processes to share a single log file
  586. (``stderr_logfile``) when rotation (``stderr_logfile_maxbytes``)
  587. is enabled. This will result in the file being corrupted.
  588. *Default*: ``AUTO``
  589. *Required*: No.
  590. *Introduced*: 3.0
  591. ``stderr_logfile_maxbytes``
  592. The maximum number of bytes before logfile rotation for
  593. ``stderr_logfile``. Accepts the same value types as
  594. ``stdout_logfile_maxbytes``.
  595. *Default*: 50MB
  596. *Required*: No.
  597. *Introduced*: 3.0
  598. ``stderr_logfile_backups``
  599. The number of backups to keep around resulting from process stderr
  600. log file rotation. If set to 0, no backups will be kept.
  601. *Default*: 10
  602. *Required*: No.
  603. *Introduced*: 3.0
  604. ``stderr_capture_maxbytes``
  605. Max number of bytes written to capture FIFO when process is in
  606. "stderr capture mode" (see :ref:`capture_mode`). Should be an
  607. integer (suffix multipliers like "KB", "MB" and "GB" can used in the
  608. value). If this value is 0, process capture mode will be off.
  609. *Default*: 0
  610. *Required*: No.
  611. *Introduced*: 3.0
  612. ``stderr_events_enabled``
  613. If true, PROCESS_LOG_STDERR events will be emitted when the process
  614. writes to its stderr file descriptor. The events will only be
  615. emitted if the file descriptor is not in capture mode at the time
  616. the data is received (see :ref:`capture_mode`).
  617. *Default*: false
  618. *Required*: No.
  619. *Introduced*: 3.0a7
  620. ``stderr_syslog``
  621. If true, stderr will be directed to syslog along with the process name.
  622. *Default*: False
  623. *Required*: No.
  624. *Introduced*: 4.0.0
  625. ``environment``
  626. A list of key/value pairs in the form ``KEY="val",KEY2="val2"`` that
  627. will be placed in the child process' environment. The environment
  628. string may contain Python string expressions that will be evaluated
  629. against a dictionary containing ``group_name``, ``host_node_name``,
  630. ``process_num``, ``program_name``, and ``here`` (the directory of the
  631. supervisord config file). Values containing non-alphanumeric characters
  632. should be quoted (e.g. ``KEY="val:123",KEY2="val,456"``). Otherwise,
  633. quoting the values is optional but recommended. **Note** that the
  634. subprocess will inherit the environment variables of the shell used to
  635. start "supervisord" except for the ones overridden here. See
  636. :ref:`subprocess_environment`.
  637. *Default*: No extra environment
  638. *Required*: No.
  639. *Introduced*: 3.0
  640. ``directory``
  641. A file path representing a directory to which :program:`supervisord`
  642. should temporarily chdir before exec'ing the child.
  643. *Default*: No chdir (inherit supervisor's)
  644. *Required*: No.
  645. *Introduced*: 3.0
  646. ``umask``
  647. An octal number (e.g. 002, 022) representing the umask of the
  648. process.
  649. *Default*: No special umask (inherit supervisor's)
  650. *Required*: No.
  651. *Introduced*: 3.0
  652. ``serverurl``
  653. The URL passed in the environment to the subprocess process as
  654. ``SUPERVISOR_SERVER_URL`` (see :mod:`supervisor.childutils`) to
  655. allow the subprocess to easily communicate with the internal HTTP
  656. server. If provided, it should have the same syntax and structure
  657. as the ``[supervisorctl]`` section option of the same name. If this
  658. is set to AUTO, or is unset, supervisor will automatically construct
  659. a server URL, giving preference to a server that listens on UNIX
  660. domain sockets over one that listens on an internet socket.
  661. *Default*: AUTO
  662. *Required*: No.
  663. *Introduced*: 3.0
  664. ``[program:x]`` Section Example
  665. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  666. .. code-block:: ini
  667. [program:cat]
  668. command=/bin/cat
  669. process_name=%(program_name)s
  670. numprocs=1
  671. directory=/tmp
  672. umask=022
  673. priority=999
  674. autostart=true
  675. autorestart=unexpected
  676. startsecs=10
  677. startretries=3
  678. exitcodes=0,2
  679. stopsignal=TERM
  680. stopwaitsecs=10
  681. stopasgroup=false
  682. killasgroup=false
  683. user=chrism
  684. redirect_stderr=false
  685. stdout_logfile=/a/path
  686. stdout_logfile_maxbytes=1MB
  687. stdout_logfile_backups=10
  688. stdout_capture_maxbytes=1MB
  689. stdout_events_enabled=false
  690. stderr_logfile=/a/path
  691. stderr_logfile_maxbytes=1MB
  692. stderr_logfile_backups=10
  693. stderr_capture_maxbytes=1MB
  694. stderr_events_enabled=false
  695. environment=A="1",B="2"
  696. serverurl=AUTO
  697. ``[include]`` Section Settings
  698. ------------------------------
  699. The :file:`supervisord.conf` file may contain a section named
  700. ``[include]``. If the configuration file contains an ``[include]``
  701. section, it must contain a single key named "files". The values in
  702. this key specify other configuration files to be included within the
  703. configuration.
  704. ``[include]`` Section Values
  705. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  706. ``files``
  707. A space-separated sequence of file globs. Each file glob may be
  708. absolute or relative. If the file glob is relative, it is
  709. considered relative to the location of the configuration file which
  710. includes it. A "glob" is a file pattern which matches a specified
  711. pattern according to the rules used by the Unix shell. No tilde
  712. expansion is done, but ``*``, ``?``, and character ranges expressed
  713. with ``[]`` will be correctly matched. Recursive includes from
  714. included files are not supported.
  715. *Default*: No default (required)
  716. *Required*: Yes.
  717. *Introduced*: 3.0
  718. ``[include]`` Section Example
  719. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  720. .. code-block:: ini
  721. [include]
  722. files = /an/absolute/filename.conf /an/absolute/*.conf foo.conf config??.conf
  723. ``[group:x]`` Section Settings
  724. ------------------------------
  725. It is often useful to group "homogeneous" process groups (aka
  726. "programs") together into a "heterogeneous" process group so they can
  727. be controlled as a unit from Supervisor's various controller
  728. interfaces.
  729. To place programs into a group so you can treat them as a unit, define
  730. a ``[group:x]`` section in your configuration file. The group header
  731. value is a composite. It is the word "group", followed directly by a
  732. colon, then the group name. A header value of ``[group:foo]``
  733. describes a group with the name of "foo". The name is used within
  734. client applications that control the processes that are created as a
  735. result of this configuration. It is an error to create a ``group``
  736. section that does not have a name. The name must not include a colon
  737. character or a bracket character.
  738. For a ``[group:x]``, there must be one or more ``[program:x]``
  739. sections elsewhere in your configuration file, and the group must
  740. refer to them by name in the ``programs`` value.
  741. If "homogeneous" process groups (represented by program sections) are
  742. placed into a "heterogeneous" group via ``[group:x]`` section's
  743. ``programs`` line, the homogeneous groups that are implied by the
  744. program section will not exist at runtime in supervisor. Instead, all
  745. processes belonging to each of the homogeneous groups will be placed
  746. into the heterogeneous group. For example, given the following group
  747. configuration:
  748. .. code-block:: ini
  749. [group:foo]
  750. programs=bar,baz
  751. priority=999
  752. Given the above, at supervisord startup, the ``bar`` and ``baz``
  753. homogeneous groups will not exist, and the processes that would have
  754. been under them will now be moved into the ``foo`` group.
  755. ``[group:x]`` Section Values
  756. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  757. ``programs``
  758. A comma-separated list of program names. The programs which are
  759. listed become members of the group.
  760. *Default*: No default (required)
  761. *Required*: Yes.
  762. *Introduced*: 3.0
  763. ``priority``
  764. A priority number analogous to a ``[program:x]`` priority value
  765. assigned to the group.
  766. *Default*: 999
  767. *Required*: No.
  768. *Introduced*: 3.0
  769. ``[group:x]`` Section Example
  770. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  771. .. code-block:: ini
  772. [group:foo]
  773. programs=bar,baz
  774. priority=999
  775. ``[fcgi-program:x]`` Section Settings
  776. -------------------------------------
  777. Supervisor can manage groups of `FastCGI <http://www.fastcgi.com>`_
  778. processes that all listen on the same socket. Until now, deployment
  779. flexibility for FastCGI was limited. To get full process management,
  780. you could use mod_fastcgi under Apache but then you were stuck with
  781. Apache's inefficient concurrency model of one process or thread per
  782. connection. In addition to requiring more CPU and memory resources,
  783. the process/thread per connection model can be quickly saturated by a
  784. slow resource, preventing other resources from being served. In order
  785. to take advantage of newer event-driven web servers such as lighttpd
  786. or nginx which don't include a built-in process manager, you had to
  787. use scripts like cgi-fcgi or spawn-fcgi. These can be used in
  788. conjunction with a process manager such as supervisord or daemontools
  789. but require each FastCGI child process to bind to its own socket.
  790. The disadvantages of this are: unnecessarily complicated web server
  791. configuration, ungraceful restarts, and reduced fault tolerance. With
  792. fewer sockets to configure, web server configurations are much smaller
  793. if groups of FastCGI processes can share sockets. Shared sockets
  794. allow for graceful restarts because the socket remains bound by the
  795. parent process while any of the child processes are being restarted.
  796. Finally, shared sockets are more fault tolerant because if a given
  797. process fails, other processes can continue to serve inbound
  798. connections.
  799. With integrated FastCGI spawning support, Supervisor gives you the
  800. best of both worlds. You get full-featured process management with
  801. groups of FastCGI processes sharing sockets without being tied to a
  802. particular web server. It's a clean separation of concerns, allowing
  803. the web server and the process manager to each do what they do best.
  804. .. note::
  805. The socket manager in Supervisor was originally developed to support
  806. FastCGI processes but it is not limited to FastCGI. Other protocols may
  807. be used as well with no special configuration. Any program that can
  808. access an open socket from a file descriptor (e.g. with
  809. `socket.fromfd <http://docs.python.org/library/socket.html#socket.fromfd>`_
  810. in Python) can use the socket manager. Supervisor will automatically
  811. create the socket, bind, and listen before forking the first child in a
  812. group. The socket will be passed to each child on file descriptor
  813. number ``0`` (zero). When the last child in the group exits,
  814. Supervisor will close the socket.
  815. All the options available to ``[program:x]`` sections are
  816. also respected by ``fcgi-program`` sections.
  817. ``[fcgi-program:x]`` Section Values
  818. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  819. ``[fcgi-program:x]`` sections have a single key which ``[program:x]``
  820. sections do not have.
  821. ``socket``
  822. The FastCGI socket for this program, either TCP or UNIX domain
  823. socket. For TCP sockets, use this format: ``tcp://localhost:9002``.
  824. For UNIX domain sockets, use ``unix:///absolute/path/to/file.sock``.
  825. String expressions are evaluated against a dictionary containing the
  826. keys "program_name" and "here" (the directory of the supervisord
  827. config file).
  828. *Default*: No default.
  829. *Required*: Yes.
  830. *Introduced*: 3.0
  831. ``socket_owner``
  832. For UNIX domain sockets, this parameter can be used to specify the user
  833. and group for the FastCGI socket. May be a UNIX username (e.g. chrism)
  834. or a UNIX username and group separated by a colon (e.g. chrism:wheel).
  835. *Default*: Uses the user and group set for the fcgi-program
  836. *Required*: No.
  837. *Introduced*: 3.0
  838. ``socket_mode``
  839. For UNIX domain sockets, this parameter can be used to specify the
  840. permission mode.
  841. *Default*: 0700
  842. *Required*: No.
  843. *Introduced*: 3.0
  844. Consult :ref:`programx_section` for other allowable keys, delta the
  845. above constraints and additions.
  846. ``[fcgi-program:x]`` Section Example
  847. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  848. .. code-block:: ini
  849. [fcgi-program:fcgiprogramname]
  850. command=/usr/bin/example.fcgi
  851. socket=unix:///var/run/supervisor/%(program_name)s.sock
  852. socket_owner=chrism
  853. socket_mode=0700
  854. process_name=%(program_name)s_%(process_num)02d
  855. numprocs=5
  856. directory=/tmp
  857. umask=022
  858. priority=999
  859. autostart=true
  860. autorestart=unexpected
  861. startsecs=1
  862. startretries=3
  863. exitcodes=0,2
  864. stopsignal=QUIT
  865. stopasgroup=false
  866. killasgroup=false
  867. stopwaitsecs=10
  868. user=chrism
  869. redirect_stderr=true
  870. stdout_logfile=/a/path
  871. stdout_logfile_maxbytes=1MB
  872. stdout_logfile_backups=10
  873. stdout_events_enabled=false
  874. stderr_logfile=/a/path
  875. stderr_logfile_maxbytes=1MB
  876. stderr_logfile_backups=10
  877. stderr_events_enabled=false
  878. environment=A="1",B="2"
  879. serverurl=AUTO
  880. ``[eventlistener:x]`` Section Settings
  881. --------------------------------------
  882. Supervisor allows specialized homogeneous process groups ("event
  883. listener pools") to be defined within the configuration file. These
  884. pools contain processes that are meant to receive and respond to event
  885. notifications from supervisor's event system. See :ref:`events` for
  886. an explanation of how events work and how to implement programs that
  887. can be declared as event listeners.
  888. Note that all the options available to ``[program:x]`` sections are
  889. respected by eventlistener sections *except* for
  890. ``stdout_capture_maxbytes`` and ``stderr_capture_maxbytes`` (event
  891. listeners cannot emit process communication events, see
  892. :ref:`capture_mode`).
  893. ``[eventlistener:x]`` Section Values
  894. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  895. ``[eventlistener:x]`` sections have a few keys which ``[program:x]``
  896. sections do not have.
  897. ``buffer_size``
  898. The event listener pool's event queue buffer size. When a listener
  899. pool's event buffer is overflowed (as can happen when an event
  900. listener pool cannot keep up with all of the events sent to it), the
  901. oldest event in the buffer is discarded.
  902. ``events``
  903. A comma-separated list of event type names that this listener is
  904. "interested" in receiving notifications for (see
  905. :ref:`event_types` for a list of valid event type names).
  906. ``result_handler``
  907. A `pkg_resources entry point string
  908. <http://peak.telecommunity.com/DevCenter/PkgResources>`_ that
  909. resolves to a Python callable. The default value is
  910. ``supervisor.dispatchers:default_handler``. Specifying an alternate
  911. result handler is a very uncommon thing to need to do, and as a
  912. result, how to create one is not documented.
  913. Consult :ref:`programx_section` for other allowable keys, delta the
  914. above constraints and additions.
  915. ``[eventlistener:x]`` Section Example
  916. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  917. .. code-block:: ini
  918. [eventlistener:theeventlistenername]
  919. command=/bin/eventlistener
  920. process_name=%(program_name)s_%(process_num)02d
  921. numprocs=5
  922. events=PROCESS_STATE
  923. buffer_size=10
  924. directory=/tmp
  925. umask=022
  926. priority=-1
  927. autostart=true
  928. autorestart=unexpected
  929. startsecs=1
  930. startretries=3
  931. exitcodes=0,2
  932. stopsignal=QUIT
  933. stopwaitsecs=10
  934. stopasgroup=false
  935. killasgroup=false
  936. user=chrism
  937. redirect_stderr=false
  938. stdout_logfile=/a/path
  939. stdout_logfile_maxbytes=1MB
  940. stdout_logfile_backups=10
  941. stdout_events_enabled=false
  942. stderr_logfile=/a/path
  943. stderr_logfile_maxbytes=1MB
  944. stderr_logfile_backups=10
  945. stderr_events_enabled=false
  946. environment=A="1",B="2"
  947. serverurl=AUTO
  948. ``[rpcinterface:x]`` Section Settings
  949. -------------------------------------
  950. Adding ``rpcinterface:x`` settings in the configuration file is only
  951. useful for people who wish to extend supervisor with additional custom
  952. behavior.
  953. In the sample config file, there is a section which is named
  954. ``[rpcinterface:supervisor]``. By default it looks like the
  955. following.
  956. .. code-block:: ini
  957. [rpcinterface:supervisor]
  958. supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
  959. The ``[rpcinterface:supervisor]`` section *must* remain in the
  960. configuration for the standard setup of supervisor to work properly.
  961. If you don't want supervisor to do anything it doesn't already do out
  962. of the box, this is all you need to know about this type of section.
  963. However, if you wish to add rpc interface namespaces in order to
  964. customize supervisor, you may add additional ``[rpcinterface:foo]``
  965. sections, where "foo" represents the namespace of the interface (from
  966. the web root), and the value named by
  967. ``supervisor.rpcinterface_factory`` is a factory callable which should
  968. have a function signature that accepts a single positional argument
  969. ``supervisord`` and as many keyword arguments as required to perform
  970. configuration. Any extra key/value pairs defined within the
  971. ``[rpcinterface:x]`` section will be passed as keyword arguments to
  972. the factory.
  973. Here's an example of a factory function, created in the
  974. ``__init__.py`` file of the Python package ``my.package``.
  975. .. code-block:: python
  976. from my.package.rpcinterface import AnotherRPCInterface
  977. def make_another_rpcinterface(supervisord, **config):
  978. retries = int(config.get('retries', 0))
  979. another_rpc_interface = AnotherRPCInterface(supervisord, retries)
  980. return another_rpc_interface
  981. And a section in the config file meant to configure it.
  982. .. code-block:: ini
  983. [rpcinterface:another]
  984. supervisor.rpcinterface_factory = my.package:make_another_rpcinterface
  985. retries = 1
  986. ``[rpcinterface:x]`` Section Values
  987. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  988. ``supervisor.rpcinterface_factory``
  989. ``pkg_resources`` "entry point" dotted name to your RPC interface's
  990. factory function.
  991. *Default*: N/A
  992. *Required*: No.
  993. *Introduced*: 3.0
  994. ``[rpcinterface:x]`` Section Example
  995. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  996. .. code-block:: ini
  997. [rpcinterface:another]
  998. supervisor.rpcinterface_factory = my.package:make_another_rpcinterface
  999. retries = 1
  1000. Environment Variable Interpolation
  1001. ----------------------------------
  1002. There may be a time where it is necessary to avoid hardcoded values in your
  1003. configuration file (such as paths, port numbers, username, etc). Some teams
  1004. may also put their supervisord.conf files under source control but may want
  1005. to avoid committing sensitive information into the repository.
  1006. With this, **all** the environment variables inherited by the ``supervisord``
  1007. process are available and can be interpolated / expanded in **any**
  1008. configuration value, under **any** section.
  1009. Your configuration values may contain Python expressions for expanding
  1010. the environment variables using the ``ENV_`` prefix. The sample syntax is
  1011. ``foo_key=%(ENV_FOO)s``, where the value of the environment variable ``FOO``
  1012. will be assigned to the ``foo_key``. The string values of environment
  1013. variables will be converted properly to their correct types.
  1014. .. note::
  1015. - some sections such as ``[program:x]`` have other extra expansion options.
  1016. - environment variables in the configuration will be required, otherwise
  1017. supervisord will refuse to start.
  1018. - any changes to the variable requires a restart in the ``supervisord``
  1019. daemon.
  1020. An example configuration snippet with customizable values:
  1021. .. code-block:: ini
  1022. [supervisord]
  1023. logfile = %(ENV_MYSUPERVISOR_BASEDIR)s/%(ENV_MYSUPERVISOR_LOGFILE)s
  1024. logfile_maxbytes = %(ENV_MYSUPERVISOR_LOGFILE_MAXBYTES)s
  1025. logfile_backups=10
  1026. loglevel = info
  1027. pidfile = %(ENV_MYSUPERVISOR_BASEDIR)s/supervisor.pid
  1028. nodaemon = false
  1029. minfds = 1024
  1030. minprocs = 200
  1031. umask = 022
  1032. user = %(ENV_USER)s
  1033. [program:cat]
  1034. command=/bin/cat -x -y --optz=%(ENV_CAT_OPTZ)s
  1035. process_name=%(program_name)s
  1036. numprocs=%(ENV_CAT_NUMPROCS)s
  1037. directory=%(ENV_CAT_DIR)s
  1038. umask=022
  1039. priority=999
  1040. autostart=true
  1041. autorestart=unexpected
  1042. exitcodes=0,2
  1043. user=%(ENV_USER)s
  1044. redirect_stderr=false
  1045. stopwaitsecs=10
  1046. The above sample config will require the following environment variables to be set:
  1047. - ``MYSUPERVISOR_BASEDIR``
  1048. - ``MYSUPERVISOR_LOGFILE``
  1049. - ``MYSUPERVISOR_LOGFILE_MAXBYTES``
  1050. - ``USER``
  1051. - ``CAT_OPTZ``
  1052. - ``CAT_NUMPROCS``
  1053. - ``CAT_DIRECTORY``