realpython / book3-exercises

Book 3 Advanced Web Dev with Django 1.7 -- Exercises for the book

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gunicorn_start failing

dco5 opened this issue · comments

Can you guys help me please! This is driving me crazy. I have googled the problem but can't find an answer. When I run the command ./gunicorn_start I get this error:

[2016-01-14 20:11:14 +0000] [28856] [INFO] Starting gunicorn 19.4.5
[2016-01-14 20:11:14 +0000] [28856] [DEBUG] Arbiter booted
[2016-01-14 20:11:14 +0000] [28856] [INFO] Listening at: http://127.0.0.1:8000 (28856)
[2016-01-14 20:11:14 +0000] [28856] [INFO] Using worker: sync
[2016-01-14 20:11:14 +0000] [28856] [INFO] Unhandled exception in main loop:
Traceback (most recent call last):
File "/home/admin/.virtualenvs/wrw/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 180, in run
self.manage_workers()
File "/home/admin/.virtualenvs/wrw/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 482, in manage_workers
self.spawn_workers()
File "/home/admin/.virtualenvs/wrw/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 548, in spawn_workers
self.spawn_worker()
File "/home/admin/.virtualenvs/wrw/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 502, in spawn_worker
self.cfg, self.log)
File "/home/admin/.virtualenvs/wrw/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 55, in init
self.tmp = WorkerTmp(cfg)
File "/home/admin/.virtualenvs/wrw/local/lib/python2.7/site-packages/gunicorn/workers/workertmp.py", line 26, in init
util.chown(name, cfg.uid, cfg.gid)
File "/home/admin/.virtualenvs/wrw/local/lib/python2.7/site-packages/gunicorn/util.py", line 163, in chown
os.chown(path, uid, gid)
OSError: [Errno 1] Operation not permitted: '/tmp/wgunicorn-86GYZk'

I can run gunicorn wrw.conf.wsgi:application --bind 127.0.0.1:8000 and the application runs fine and I can access it from the web.

I have checked and double check your gnuicorn_start script but can not find anything I copied wrong.

So from what I understand the user www-data and the group www-data does not have permissions?
From the book:

"USER and GROUP are used to set Gunicorn to run as www-data, which is a user created
during our installation that is most often used to run web/app server. This is for security
concerns to limit access to the system."

But I do not remember creating them on installation when I followed the book.

My memory may be a bit foggy here but I believe thouse users should be created by the package manager when installing via apt-get (Debian based distros). Can you list out the steps you followed to install / setup gunicorn so far?

Cheers,
Jeremy

On 15 Jan 2016, at 10:42, Jaime Lossada notifications@github.com wrote:

So from what I understand the user www-data and the group www-data does not have permissions?
From the book:

"USER and GROUP are used to set Gunicorn to run as www-data, which is a user created
during our installation that is most often used to run web/app server. This is for security
concerns to limit access to the system."

But I do not remember creating them on installation when I followed the book.


Reply to this email directly or view it on GitHub.

I am using Ubuntu 14.04

cd /opt/wrw/
workon wrw
pip install gunicorn
vim deploy/gunicorn_start

Then copied the instructions changing the directories and settings based on my set-up

I looked at the processes running and the nginx process has user: www-data and group: www-data
So they where created by the system. But now then how to I give them permission to run the gunicorn_start script.