nprapps / lunchbox

Image tools for social media sharing
http://blog.apps.npr.org/lunchbox/
MIT License
175 stars 144 forks source link

gunicorn worker error #71

Closed IADDIC closed 8 years ago

IADDIC commented 8 years ago

Hi all:

I have gone through the process of setting up a virtual env and went through the process of implementing lunchbox. I am able to execute the following without error...one warning (npm WARN package.json lunchbox@1.0.0 No repository field. when I run npm install) My research says this is not of great concern for this xercise.

so I have done the following:

mkvirtualenv lunchbox cd lunchbox pip install -r requirements.txt npm install

but when I switch to the fabfile directory and execute fab app I get the following errors Note if I do not switch to fabfile folder fab app causes gunicorn to just hang.

(lunchbox) ubuntu@ip-172-31-34-211:/virtualenvs/lunchbox/fabfile$ fab app [localhost] local: gunicorn -b 0.0.0.0:8000 --timeout 3600 --debug --reload app:wsgi_app Traceback (most recent call last): File "/virtualenvs/lunchbox/bin/gunicorn", line 11, in sys.exit(run()) File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run() File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 185, in run super(Application, self).run() File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 71, in run Arbiter(self).run() File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 169, in run self.manage_workers() File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 477, in manage_workers self.spawn_workers() File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 542, in spawn_workers time.sleep(0.1 * random.random()) File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 209, in handle_chld self.reap_workers() File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 459, in reap_workers raise HaltServer(reason, self.WORKER_BOOT_ERROR) gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

Fatal error: local() encountered an error (return code 1) while executing 'gunicorn -b 0.0.0.0:8000 --timeout 3600 --debug --reload app:wsgi_app'

Aborting.

eads commented 8 years ago

I think you might be mistaking gunicorn hanging for it simply running. When you run fab app, the terminal will appear to hang, but that's just because the server is active, listening for requests. If you run fab app and can access http://127.0.0.1 in your browser, everything is cool. Just press ctrl-c to kill the server process when you are done.

On Mon, Feb 15, 2016 at 3:10 PM, Rich notifications@github.com wrote:

Hi all:

I have gone through the process of setting up a virtual env and went through the process of implementing lunchbox. I am able to execute the following without error...one warning (npm WARN package.json lunchbox@1.0.0 No repository field. when I run npm install) My research says this is not of great concern for this xercise.

so I have done the following:

mkvirtualenv lunchbox cd lunchbox pip install -r requirements.txt npm install

but when I switch to the fabfile directory and execute fab app I get the following errors Note if I do not switch to fabfile folder fab app causes gunicorn to just hang.

(lunchbox) ubuntu@ip-172-31-34-211:/virtualenvs/lunchbox/fabfile$ fab app [localhost] local: gunicorn -b 0.0.0.0:8000 --timeout 3600 --debug --reload app:wsgi_app Traceback (most recent call last): File "/virtualenvs/lunchbox/bin/gunicorn", line 11, in sys.exit(run()) File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run() File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 185, in run super(Application, self).run() File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 71, in run Arbiter(self).run() File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 169, in run self.manage_workers() File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 477, in manage_workers self.spawn_workers() File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 542, in spawn_workers time.sleep(0.1 * random.random()) File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 209, in handle_chld self.reap_workers() File "/virtualenvs/lunchbox/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 459, in reap_workers raise HaltServer(reason, self.WORKER_BOOT_ERROR) gunicorn.errors.HaltServer:

Fatal error: local() encountered an error (return code 1) while executing 'gunicorn -b 0.0.0.0:8000 --timeout 3600 --debug --reload app:wsgi_app'

Aborting.

— Reply to this email directly or view it on GitHub https://github.com/nprapps/lunchbox/issues/71.

David Eads | http://recoveredfactory.net

"Medical statistics will be our standard of measurement: we will weigh life for life and see where the dead lie thicker, among the workers or among the privileged." -- Rudolf Virchow

IADDIC commented 8 years ago

Thanks eads...but then I think I am lost. I am implementing on an AWS EC2 Ubuntu instance and was thinking I needed to wait until fab app finished before running fab fileserver master deploy. Since I can't access 127.0.0.1 how would/should I get the app in the www web directories if gunicorn is not able to stop/finish? I believe I have the virtual env and wrapper set because requirements.txt and npm install both executed without errors. Any suggestion?

By the way I did modify the For app_config variables before running fab app...but I can't see how that would be the problem...

FILE_SERVER_USER = 'ubuntu' FILE_SERVER = 'your.fileserver.org' FILE_SERVER_PATH = '~/www'

Also, I did try to run fab fileserver master deploy but nothing showed up in the web server...

Thanks, I appreciate your thoughts on this!

Rich

IADDIC commented 8 years ago

I'll leave a followup in case someone else is seeking a resolution here. Yes when gunicorn seems to hang this is ok. When running fab fileserver master deploy I went back and reloaded nodeJS, NPM, and lessc inside of the VM. I ran the fab fileserver master deploy (after changing the config file) and then moved the contents of the www directory to my webserver. I am VERY new to this so I am not sure if this is how things were supposed to go or if I just got lucky. Over time more experience will certainly pay off. good luck and thanks.

Update -- created a sym link between virtual env and www. Much better way to go.

TylerFisher commented 8 years ago

fab app and fab fileserver master deploy have nothing to do with each other. The former is solely so you can preview the app locally. And yes, you do not need to switch to the fabfile directory to do so.

fab fileserver master deploy should perform an rsync with your fileserver provided your local machine has access to that server. But directly copying from www manually is essentially the same thing.