How to config supervisor with Django channels and server daphne

只谈情不闲聊 提交于 2019-12-11 15:17:28

问题


I have a problem with my configuration supervisor, my file is in etc/supervisor/conf.d/realtimecolonybit.conf,

When I try command supervisorctl reread, show me the "No config updates to processes" and when I try the other command like this

supervisorctl status realtimecolonybit

Shows me this error

realtimecolonybit                FATAL     can't find command '/home/ubuntu/realtimecolonybit/bin/start.sh;'

And when try the supervisorctl start realtimecolonybit show me this error

realtimecolonybit: ERROR (no such file)

My configuration in my file realtimecolonybit.conf is below

[program:realtimecolonybit]
command = /home/ubuntu/realtimecolonybit/bin/start.sh;
user = root
stdout_logfile = /home/ubuntu/realtimecolonybit/logs/realtimecolonybit.log;
redirect_strderr = true;

My configuration from my file start.sh is below

     #!/bin/bash
     NAME="realtimecolonybit"
     DJANGODIR=/home/ubuntu/realtimecolonybit/colonybit
     SOCKFILE=/home/ubuntu/realtimecolonybit/run/gunicorn.sock

     USER=root
     GROUP=root
     NUM_WORKERS=3
     DJANGO_SETTINGS_MODULE=colonybit.settings

     echo "Starting $NAME as `whoami`"

     cd $DJANGODIR
     source /home/ubuntu/realtimecolonybit/bin/activate
     # workon realtimecolonybit
     export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
     export PYTHONPAHT=$DJANGODIR:$PYTHONPATH

     RUNDIR=$(dirname $SOCKFILE)
     test -d $RUNDIR || mkdir -p $RUNDIR

     exec daphne -b 0.0.0.0 -p 8001 colonybit.asgi:application

When I run without supervisor like this

(realtimecolonybit)realtimecolonybit/#/ ./bin/start.sh

it's run ok and working well, but sometimes down the server

I try to run a Django 1.11 and django_channel with supervisor my app is in aws.


回答1:


I solve my problem, the error was in file .conf, I remove ; and remove the .sh, change the start.sh to start

wrong command

command = /home/ubuntu/realtimecolonybit/bin/start.sh;

correct command

command = /home/ubuntu/realtimecolonybit/bin/start


来源:https://stackoverflow.com/questions/52393668/how-to-config-supervisor-with-django-channels-and-server-daphne

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!