Supervisor托管项目
- Supervisor官网
- 安装
pip install supervisor 配置
- 生成默认配置
echo_supervisord_conf > /etc/supervisord.conf - 自定义配置
;django-channels配置 [fcgi-program:my_channels] socket = tcp://0.0.0.0:2020 directory = /home/my_channels numprocs = 8 process_name = my_channels_2020-%(process_num)d command = /root/.virtualenvs/my_channels/bin/daphne -u /home/my_channels/runtime/my_channels_2020-%(process_num)d.sock --fd 0 --access-log - --proxy-headers my_channels.asgi:application autostart = true autorestart = true stdout_logfile = /home/my_channels/logging/my_channels.log stdout_logfile_maxbytes = 50MB stdout_logfile_backups = 10 redirect_stderr = true priority = 997 user = root killasgroup = true stopasgroup = true startsecs = 15 ;CeleryWorker配置 [program:celery-worker-my_channels] command = /root/.virtualenvs/my_channels/bin/celery -A my_channels worker -l info -Q default,manager directory = /home/my_channels stdout_logfile = /home/my_channels/logging/celery-worker-my_channels.log stdout_logfile_maxbytes = 50MB stdout_logfile_backups = 10 stderr_logfile = /home/my_channels/logging/celery-worker-my_channels-error.log stderr_logfile_maxbytes = 50MB stderr_logfile_backups = 10 autostart = true autorestart = true priority = 997 user = root killasgroup = true stopasgroup = true redirect_stderr = true startsecs = 15 ;Celery定时任务配置 [program:celery-beat-my_channels] command = /root/.virtualenvs/my_channels/bin/celery -A my_channels beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler directory = /home/my_channels stdout_logfile = /home/my_channels/logging/celery-beat-my_channels.log stdout_logfile_maxbytes = 50MB stdout_logfile_backups = 10 stderr_logfile = /home/my_channels/logging/celery-beat-my_channels-error.log stderr_logfile_maxbytes = 50MB stderr_logfile_backups = 10 autostart = true autorestart = true priority = 997 user = root killasgroup = true stopasgroup = true redirect_stderr = true startsecs = 15启动命令
supervisord -c /etc/supervisord.conf
更新配置supervisorctl update- 生成默认配置