book3-exercises icon indicating copy to clipboard operation
book3-exercises copied to clipboard

gunicorn_start failing

Open dco5 opened this issue 9 years ago • 4 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.

dco5 avatar Jan 15 '16 02:01 dco5

Sounds like a permissions issue -> http://stackoverflow.com/questions/19737511/gunicorn-throws-oserror-errno-1-when-starting

@j1z0 can you please clarify. Thanks!

mjhea0 avatar Jan 15 '16 02:01 mjhea0

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.

dco5 avatar Jan 15 '16 02:01 dco5

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 [email protected] 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.

j1z0 avatar Jan 15 '16 04:01 j1z0

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.

dco5 avatar Jan 15 '16 16:01 dco5