how to config supervisor with django channels and server daphne

时间:2018-09-18 19:51:41

标签: django supervisor django-channels daphne

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

show 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 but I don't know why to happen that, please help me

tanks for your attention.

1 个答案:

答案 0 :(得分:0)

我解决了我的问题,错误在于文件.conf中,我删除了“;”并删除.sh,将start.sh更改为开始

错误命令

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

正确的命令

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

我希望它对任何人都有帮助