I start supervisor as root:
sudo supervisord -c /etc/supervisor/supervisord.conf
Then I try to start up supervisorctl:
(myapp)appuser@ip-172-31-21-65:~/appuser$ supervisorctl -c /etc/supervisor/supervisord.conf
Supervisor starts with the following mesage:
error: <class 'socket.error'>, [Errno 13] Permission denied: file: /usr/lib/python2.7/socket.py line: 224
Trying to run the second command as root is also unsuccessful. My understanding is that this is by design.
All the advice I find suggests that I should set my user as the user that executes the command, but this is already how I have it all configured:
Here is the script file that I am using:
NAME="myapp"
DJANGODIR=/home/appuser/myapp
SOCKFILE=/home/appuser/myapp/gunicorn.sock
USER=appuser
GROUP=webdata
NUM_WORKERS=1
DJANGO_SETTINGS_MODULE=myapp.settings
DJANGO_WSGI_MODULE=myapp.wsgi
I'm not sure what is screwing it up? I think it might be the GROUP
setting, as I don't recognize that value. But if I comment it out, it doesn't seem to make a difference. How should I troubleshoot this?
EDIT: I created a group named supervisor
, added appuser
to it and changed the GROUP
setting to match, but still no joy.
This is my supervisord.conf:
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/super$
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TE$
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
[include]
files = /etc/supervisor/conf.d/*.conf
And my configuration file for the app:
[program:myapp]
command = /home/appuser/myapp/gunicorn_start.sh ; Command to start app
user = appuser ; User to run as
stdout_logfile = /home/appuser/myapp/logs/supervisor.log ; Where to write$
redirect_stderr = true ; Save stderr in the same log
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8 ; Set UTF-8 as default encoding
My supervisor version is:
>supervisord --version
3.0b2
I added my username to the superisord.conf file under the [unix_http_server]
section like so:
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
chown=appuser:supervisor ;(username:group)
This seemed to work- time will tell if it continues working after I manage solve the rest of the supervisor issues.