Skip to content

Commit

Permalink
supervisor的使用
Browse files Browse the repository at this point in the history
  • Loading branch information
tanglang1990 committed Feb 16, 2019
1 parent d26a68b commit 3c695f1
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 8 deletions.
15 changes: 15 additions & 0 deletions imooc/conf/supervisor_celery_beat.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[program:imooc-celery-beat]
command=python manage.py celery beat -l INFO
directory=/root/celery_with_django/imooc
environment=PATH="/root/.local/share/virtualenvs/celery_with_django-oEbuwveD/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
stdout_logfile=/root/celery_with_django/imooc/logs/celery.beat.log
stderr_logfile=/root/celery_with_django/imooc/logs/celery.beat.log
autostart=true
autorestart=true
startsecs=10
stopwatisecs=60
priority=997




15 changes: 15 additions & 0 deletions imooc/conf/supervisor_celery_flower.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[program:imooc-celery-flower]
command=python manage.py celery flower --basic_auth=ten:ten
directory=/root/celery_with_django/imooc
environment=PATH="/root/.local/share/virtualenvs/celery_with_django-oEbuwveD/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
stdout_logfile=/root/celery_with_django/imooc/logs/celery.flower.log
stderr_logfile=/root/celery_with_django/imooc/logs/celery.flower.log
autostart=true
autorestart=true
startsecs=10
stopwatisecs=60
priority=996




15 changes: 15 additions & 0 deletions imooc/conf/supervisor_celery_server.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[program:imooc-celery-server]
command=python manage.py runserver 0.0.0.0:8000
directory=/root/celery_with_django/imooc
environment=PATH="/root/.local/share/virtualenvs/celery_with_django-oEbuwveD/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
stdout_logfile=/root/celery_with_django/imooc/logs/celery.beat.log
stderr_logfile=/root/celery_with_django/imooc/logs/celery.beat.log
autostart=true
autorestart=true
startsecs=10
stopwatisecs=60
priority=995




15 changes: 15 additions & 0 deletions imooc/conf/supervisor_celery_worker.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[program:imooc-celery-worker]
command=python manage.py celery worker -l INFO
directory=/root/celery_with_django/imooc
environment=PATH="/root/.local/share/virtualenvs/celery_with_django-oEbuwveD/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
stdout_logfile=/root/celery_with_django/imooc/logs/celery.worker.log
stderr_logfile=/root/celery_with_django/imooc/logs/celery.worker.log
autostart=true
autorestart=true
startsecs=10
stopwatisecs=60
priority=998




16 changes: 8 additions & 8 deletions imooc/conf/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ file=/tmp/supervisor.sock ; the path to the socket file
;username=user ; default is no username (open server)
;password=123 ; default is no password (open server)

;[inet_http_server] ; inet (TCP) server disabled by default
;port=127.0.0.1:9001 ; ip_address:port specifier, *:port for all iface
;username=user ; default is no username (open server)
;password=123 ; default is no password (open server)
[inet_http_server] ; inet (TCP) server disabled by default
port=0.0.0.0:9001 ; ip_address:port specifier, *:port for all iface
username=ten ; default is no username (open server)
password=ten ; default is no password (open server)

[supervisord]
logfile=/tmp/supervisord.log ; main log file; default $CWD/supervisord.log
Expand Down Expand Up @@ -54,8 +54,8 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
; or inet_http_server section.

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
;serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
;username=chris ; should be same as in [*_http_server] if set
;password=123 ; should be same as in [*_http_server] if set
;prompt=mysupervisor ; cmd line prompt (default "supervisor")
Expand Down Expand Up @@ -148,5 +148,5 @@ serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
; interpreted as relative to this file. Included files *cannot*
; include files themselves.

;[include]
;files = relative/directory/*.ini
[include]
files = *.ini
5 changes: 5 additions & 0 deletions imooc/imooc/celery_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,8 @@

# mkdir conf
# echo_supervisord_conf > conf/supervisord.conf
# 然后修改和添加配置文件

# 启动
# supervisord -c conf/supervisord.conf
# supervisorctl

0 comments on commit 3c695f1

Please sign in to comment.