Skip to content

Commit 19c9cbf

Browse files
committed
add supervisord.conf
1 parent a089546 commit 19c9cbf

File tree

1 file changed

+216
-0
lines changed

1 file changed

+216
-0
lines changed

supervisord.conf

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
; Sample supervisor config file.
2+
;
3+
; For more information on the config file, please see:
4+
; http://supervisord.org/configuration.html
5+
;
6+
; Notes:
7+
; - Shell expansion ("~" or "$HOME") is not supported. Environment
8+
; variables can be expanded using this syntax: "%(ENV_HOME)s".
9+
; - Quotes around values are not supported, except in the case of
10+
; the environment= options as shown below.
11+
; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
12+
; - Command will be truncated if it looks like a config file comment, e.g.
13+
; "command=bash -c 'foo ; bar'" will truncate to "command=bash -c 'foo ".
14+
15+
[unix_http_server]
16+
file=/tmp/supervisor.sock ; the path to the socket file
17+
;chmod=0700 ; socket file mode (default 0700)
18+
;chown=nobody:nogroup ; socket file uid:gid owner
19+
;username=user ; default is no username (open server)
20+
;password=123 ; default is no password (open server)
21+
22+
;[inet_http_server] ; inet (TCP) server disabled by default
23+
;port=127.0.0.1:9001 ; ip_address:port specifier, *:port for all iface
24+
;username=user ; default is no username (open server)
25+
;password=123 ; default is no password (open server)
26+
27+
[supervisord]
28+
logfile=/tmp/supervisord.log ; main log file; default $CWD/supervisord.log
29+
logfile_maxbytes=50MB ; max main logfile bytes b4 rotation; default 50MB
30+
logfile_backups=10 ; # of main logfile backups; 0 means none, default 10
31+
loglevel=info ; log level; default info; others: debug,warn,trace
32+
pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid
33+
nodaemon=false ; start in foreground if true; default false
34+
minfds=1024 ; min. avail startup file descriptors; default 1024
35+
minprocs=200 ; min. avail process descriptors;default 200
36+
;umask=022 ; process file creation umask; default 022
37+
;user=supervisord ; setuid to this UNIX account at startup; recommended if root
38+
;identifier=supervisor ; supervisord identifier, default is 'supervisor'
39+
;directory=/tmp ; default is not to cd during start
40+
;nocleanup=true ; don't clean up tempfiles at start; default false
41+
;childlogdir=/tmp ; 'AUTO' child log dir, default $TEMP
42+
;environment=KEY="value" ; key value pairs to add to environment
43+
;strip_ansi=false ; strip ansi escape codes in logs; def. false
44+
45+
; The rpcinterface:supervisor section must remain in the config file for
46+
; RPC (supervisorctl/web interface) to work. Additional interfaces may be
47+
; added by defining them in separate [rpcinterface:x] sections.
48+
49+
[rpcinterface:supervisor]
50+
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
51+
52+
; The supervisorctl section configures how supervisorctl will connect to
53+
; supervisord. configure it match the settings in either the unix_http_server
54+
; or inet_http_server section.
55+
56+
[supervisorctl]
57+
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
58+
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
59+
;username=chris ; should be same as in [*_http_server] if set
60+
;password=123 ; should be same as in [*_http_server] if set
61+
;prompt=mysupervisor ; cmd line prompt (default "supervisor")
62+
;history_file=~/.sc_history ; use readline history if available
63+
64+
; The sample program section below shows all possible program subsection values.
65+
; Create one or more 'real' program: sections to be able to control them under
66+
; supervisor.
67+
68+
;[program:theprogramname]
69+
;command=/bin/cat ; the program (relative uses PATH, can take args)
70+
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
71+
;numprocs=1 ; number of processes copies to start (def 1)
72+
;directory=/tmp ; directory to cwd to before exec (def no cwd)
73+
;umask=022 ; umask for process (default None)
74+
;priority=999 ; the relative start priority (default 999)
75+
;autostart=true ; start at supervisord start (default: true)
76+
;startsecs=1 ; # of secs prog must stay up to be running (def. 1)
77+
;startretries=3 ; max # of serial start failures when starting (default 3)
78+
;autorestart=unexpected ; when to restart if exited after running (def: unexpected)
79+
;exitcodes=0 ; 'expected' exit codes used with autorestart (default 0)
80+
;stopsignal=QUIT ; signal used to kill process (default TERM)
81+
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
82+
;stopasgroup=false ; send stop signal to the UNIX process group (default false)
83+
;killasgroup=false ; SIGKILL the UNIX process group (def false)
84+
;user=chrism ; setuid to this UNIX account to run the program
85+
;redirect_stderr=true ; redirect proc stderr to stdout (default false)
86+
;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
87+
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
88+
;stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10)
89+
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
90+
;stdout_events_enabled=false ; emit events on stdout writes (default false)
91+
;stdout_syslog=false ; send stdout to syslog with process name (default false)
92+
;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
93+
;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
94+
;stderr_logfile_backups=10 ; # of stderr logfile backups (0 means none, default 10)
95+
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
96+
;stderr_events_enabled=false ; emit events on stderr writes (default false)
97+
;stderr_syslog=false ; send stderr to syslog with process name (default false)
98+
;environment=A="1",B="2" ; process environment additions (def no adds)
99+
;serverurl=AUTO ; override serverurl computation (childutils)
100+
101+
; The sample eventlistener section below shows all possible eventlistener
102+
; subsection values. Create one or more 'real' eventlistener: sections to be
103+
; able to handle event notifications sent by supervisord.
104+
105+
;[eventlistener:theeventlistenername]
106+
;command=/bin/eventlistener ; the program (relative uses PATH, can take args)
107+
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
108+
;numprocs=1 ; number of processes copies to start (def 1)
109+
;events=EVENT ; event notif. types to subscribe to (req'd)
110+
;buffer_size=10 ; event buffer queue size (default 10)
111+
;directory=/tmp ; directory to cwd to before exec (def no cwd)
112+
;umask=022 ; umask for process (default None)
113+
;priority=-1 ; the relative start priority (default -1)
114+
;autostart=true ; start at supervisord start (default: true)
115+
;startsecs=1 ; # of secs prog must stay up to be running (def. 1)
116+
;startretries=3 ; max # of serial start failures when starting (default 3)
117+
;autorestart=unexpected ; autorestart if exited after running (def: unexpected)
118+
;exitcodes=0 ; 'expected' exit codes used with autorestart (default 0)
119+
;stopsignal=QUIT ; signal used to kill process (default TERM)
120+
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
121+
;stopasgroup=false ; send stop signal to the UNIX process group (default false)
122+
;killasgroup=false ; SIGKILL the UNIX process group (def false)
123+
;user=chrism ; setuid to this UNIX account to run the program
124+
;redirect_stderr=false ; redirect_stderr=true is not allowed for eventlisteners
125+
;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
126+
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
127+
;stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10)
128+
;stdout_events_enabled=false ; emit events on stdout writes (default false)
129+
;stdout_syslog=false ; send stdout to syslog with process name (default false)
130+
;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
131+
;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
132+
;stderr_logfile_backups=10 ; # of stderr logfile backups (0 means none, default 10)
133+
;stderr_events_enabled=false ; emit events on stderr writes (default false)
134+
;stderr_syslog=false ; send stderr to syslog with process name (default false)
135+
;environment=A="1",B="2" ; process environment additions
136+
;serverurl=AUTO ; override serverurl computation (childutils)
137+
138+
; The sample group section below shows all possible group values. Create one
139+
; or more 'real' group: sections to create "heterogeneous" process groups.
140+
141+
;[group:thegroupname]
142+
;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions
143+
;priority=999 ; the relative start priority (default 999)
144+
145+
; The [include] section can just contain the "files" setting. This
146+
; setting can list multiple files (separated by whitespace or
147+
; newlines). It can also contain wildcards. The filenames are
148+
; interpreted as relative to this file. Included files *cannot*
149+
; include files themselves.
150+
151+
;[include]
152+
;files = relative/directory/*.ini
153+
154+
[program:celery.worker]
155+
;指定运行目录
156+
directory=/api_automation_test
157+
;运行目录下执行命令
158+
command=celery -A api_automation_test worker --loglevel=DEBUG -c 10
159+
160+
;启动设置
161+
numprocs=1 ;进程数
162+
autostart=true ;当supervisor启动时,程序将会自动启动
163+
autorestart=true ;自动重启
164+
165+
;停止信号,默认TERM
166+
;中断:INT (类似于Ctrl+C)(kill -INT pid),退出后会将写文件或日志(推荐)
167+
;终止:TERM (kill -TERM pid)
168+
;挂起:HUP (kill -HUP pid),注意与Ctrl+Z/kill -stop pid不同
169+
;从容停止:QUIT (kill -QUIT pid)
170+
stopsignal=INT
171+
;输出日志
172+
stdout_logfile=/api_automation_test/logs/celery_worker.log
173+
stdout_logfile_maxbytes=10MB ;默认最大50M
174+
stdout_logfile_backups=10 ;日志文件备份数,默认为10
175+
176+
;错误日志
177+
redirect_stderr=false ;为true表示禁止监听错误
178+
stderr_logfile=/api_automation_test/logs/celery_worker_err.log
179+
stderr_logfile_maxbytes=10MB
180+
stderr_logfile_backups=10
181+
182+
183+
[program:celery.beat]
184+
directory=/api_automation_test
185+
command=python3 manage.py celery beat --pidfile=
186+
numprocs=1 ;进程数
187+
autostart=true ;当supervisor启动时,程序将会自动启动
188+
autorestart=true ;自动重启
189+
stopsignal=INT
190+
stdout_logfile=/api_automation_test/logs/celery_beat.log
191+
stdout_logfile_maxbytes=10MB ;默认最大50M
192+
stdout_logfile_backups=10 ;日志文件备份数,默认为10
193+
redirect_stderr=false ;为true表示禁止监听错误
194+
stderr_logfile=/api_automation_test/logs/celery_beat_err.log
195+
stderr_logfile_maxbytes=10MB
196+
stderr_logfile_backups=10
197+
198+
199+
[fcgi-program:asgi]
200+
socket=tcp://0.0.0.0:8001
201+
directory=/api_automation_test
202+
# 区别在这里
203+
command=daphne --fd 0 --access-log - --proxy-headers api_automation_test.asgi:application
204+
###########
205+
numprocs=4
206+
process_name=asgi%(process_num)d
207+
autostart=true
208+
autorestart=true
209+
redirect_stderr=true
210+
stdout_logfile=/api_automation_test/logs/asgi.log
211+
stdout_logfile_maxbytes=10MB ;默认最大50M
212+
stdout_logfile_backups=10 ;日志文件备份数,默认为10
213+
redirect_stderr=false ;为true表示禁止监听错误
214+
stderr_logfile=/api_automation_test/logs/asgi.log
215+
stderr_logfile_maxbytes=10MB
216+
stderr_logfile_backups=10

0 commit comments

Comments
 (0)