Permession denied error when use supervisorctl

Posted on 2017-02-08 00:16  LoveAI  阅读(2104)  评论(0编辑  收藏  举报

i am use supervisor + flask + gunicorn + virtalenv to deply my app, when i use supervisorctl, it shows me the error:

error: <class 'socket.error'>, [Errno 13] Permission denied: file: /usr/lib/python2.7/socket.py line: 224

this is supervisor.conf

[inet_http_server]
port=127.0.0.1:9001
username=xxx
password=xxxx

[supervisord]
logfile=/tmp/supervisord.log
logfile_maxbytes=10MB
logfile_backups=10
loglevel=info
pidfile=/tmp/supervisord.pid
user=wwwuser

[supervisorctl]
serverurl=http://127.0.0.1:9001
username=xxx
password=xxx

[program:xxxxxxxxx]
command=gunicorn -w 4 -k gevent -p /tmp/site.pid -b 127.0.0.1:6000 manage:app
process_name=%(program_name)s
numprocs=1
directory=/home/wwwuser/site
autostart=true
user=wwwuser
redirect_stderr=true
stdout_logfile=/tmp/site-out.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stderr_logfile=/tmp/site-err.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10

=================================================

in your supervisord.conf you can do something like the following

just make it writable for all

[unix_http_server]
file=/tmp/supervisor.sock   ; (the path to the socket file)
chmod=0766                 ; socket file mode (default 0700)

controll who actually owns the file

[unix_http_server]
file=/tmp/supervisor.sock   ; (the path to the socket file)
chmod=0760                 ; socket file mode (default 0700)
chown=myuser:group       ; socket file uid:gid owner

this last one im not sure as i have not tested and i dont completely understand behavior here. I also dont care cause It doesnt look very safe:

[unix_http_server]
file=/tmp/supervisor.sock   ; (the path to the socket file)
chmod=0700                ; socket file mode (default 0700)
username=root              ; (default is no username (open server))
password=yourrootpassword               ; (default is no password (open server))