7
votes

I deploy my django project with uwsgi、supervisor and nginx. but I have added my program like above in the /etc/supervisord.conf.

[program:JZAssist]
command=-E uwsgi --ini /home/work/xxxx/uwsgi.ini
directory=/home/work/xxxx
startsecs=0
stopwaitsecs=0
autostart=true
autorestart=true

and my uwsgi.ini content is:

[uwsgi] 
socket = :8000 
chdir = /home/work/xxxx 
module = xxxx.wsgi 
master = true 
processes = 4 
vacuum = true 

xxxx is my project name.

I run supervisorctl -c /etc/supervisord.conf restart all in the cmd. And it shows

xxxx: ERROR (no such file)

/tmp/supervisord.log part of content:

2017-02-24 23:31:41,433 INFO gave up: JZAssist entered FATAL state,         too many start retries too quickly
2017-02-24 23:52:29,940 WARN Failed to clean up '/tmp/JZAssist-stderr---supervisor-goPZyS.log'
2017-02-24 23:52:29,940 WARN Failed to clean up '/tmp/JZAssist-stdout---supervisor-WtfJcp.log'
2017-02-24 23:52:57,535 WARN Failed to clean up '/tmp/JZAssist-stderr---supervisor-goPZyS.log'
2017-02-24 23:52:57,535 WARN Failed to clean up '/tmp/JZAssist-stdout---supervisor-WtfJcp.log'
2017-02-24 23:52:57,541 INFO RPC interface 'supervisor' initialized
2017-02-24 23:52:57,541 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-02-24 23:52:57,542 INFO daemonizing the supervisord process
2017-02-24 23:52:57,543 CRIT could not write pidfile /tmp/supervisord.pid
2017-02-24 23:52:58,544 INFO spawnerr: can't find command '-E'
2017-02-24 23:52:59,546 INFO spawnerr: can't find command '-E'
2017-02-25 00:46:59,234 WARN Failed to clean up '/tmp/JZAssist-stderr---supervisor-goPZyS.log'
2017-02-25 00:46:59,234 WARN Failed to clean up '/tmp/JZAssist-stdout---supervisor-WtfJcp.log'

I don't know why it will report error like that.I can run my django project with runserver.so what the file is missing?

3
What is the first -E element in the command ?Antwane
I use -E to keep environment variables when using SUDOxyxc
What is the content of your log file and what is the log level for supervisor?chaos
loglevel=info, and the log I added abovexyxc

3 Answers

7
votes

On your command= line, you've specified the program to run as -E, which supervisor can't find to execute.

When creating a file for the job, the command line should be executable as a shell command, and should not rely on internal commands for a given shell. For example, I had trouble with one that started with:

source /path/to/python/virtual/environment/bin/activate && ...

but source is a bash builtin. I needed to change it to read:

bash -c 'source /path/to/python/virtual/environment/bin/activate && ...

This way, the executable file that supervisor can find and run is bash.

In your case, it appears uwsgi should be the first thing after command=.

You mentioned that you're using the -E flag to preserve environment variables when you run sudo, but supervisor won't need sudo

0
votes

I ran into this error message, but in my case it turn out I'd specified a user in my job definition that hadn't been created on the server.

[program:my-task]
user=this-user-didnt-exist
0
votes

In my case, the problem was that I had command="/bin/python3.8 main.py" in my conf.d/mysite.conf file.

When i removed the "", it worked.