deployment issue --- gunicorn

765 views
Skip to first unread message

har...@iinet.net.au

unread,
Jan 10, 2014, 12:41:31 AM1/10/14
to mezzani...@googlegroups.com

Hi,

I'm very new to Mezzanine and have been loving it --- especially the fabric deploment.  However, I seem to be having some troubles with gunicorn.

I started from a fresh linode running debian and allowed 'fab all' to build the full system.

I would very much appreciate some assistance with this.

My basic process is:

server:

new linode profile
ssh as root
adduser user
apt-get install sudo vim
add harry to sudoers file
on local machine:
ssh-copy-id -i ~/.ssh/id_rsa.pub
sudo pip install virtualenvwrapper
add to bashrc:

export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=$WORKON_HOME

local:

mkvirtualenv black_earth_{project}
pip install -r requirements.txt
createdb {project}
mezzanine-project {project}
set database parameters in local_settings.py
copy keys and deploy setting (FABRIC) to local_settings.py
set allowed_hosts in settings.py
ALLOWED_HOSTS = [
    'localhosts',
    '.mysite.org.au',
]
python manage.py createdb
check local server
set up git repository
git init
git add .
git  git remote add origin {gitserver}
git push -u origin master
pip freeze > requirements.txt
fab all

pip error:
sudo pip install setuptools --no-use-wheel --upgrade

At the final point in the deployment --- restart --- I get the error:

$ supervisorctl start black_earth_semina:gunicorn_black_earth_semina ->

[blackearthcollective.org.au] out: sudo password:
[blackearthcollective.org.au] out: black_earth_semina:gunicorn_black_earth_semina: ERROR (abnormal termination)
[blackearthcollective.org.au] out:

This is with a completely standard mezzanine setup.  I thought that the problem was with my theme project.

from the supervisor gunicorn log:

!!!
!!! WARNING: This command is deprecated.
!!!
!!!     You should now run your application with the WSGI interface
!!!     installed with your project. Ex.:
!!!
!!!         gunicorn myproject.wsgi:application
!!!
!!!     See https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/gunicorn/
!!!     for more info.
!!!

2014-01-10 01:16:35 [12088] [CRITICAL] WORKER TIMEOUT (pid:12097)

Stephen McDonald

unread,
Jan 10, 2014, 12:48:14 AM1/10/14
to mezzani...@googlegroups.com
There's no indication in any of that as to what's going wrong unfortunately.

Try taking the command out of the deployed supervisor conf (that black_earth_semina:gunicorn_black_earth_semina points to) and running it manually, that might show you something more useful.

Good luck.


--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Stephen McDonald
http://jupo.org

har...@iinet.net.au

unread,
Jan 10, 2014, 1:10:04 AM1/10/14
to mezzani...@googlegroups.com
That gives me:


!!!
!!! WARNING: This command is deprecated.
!!!
!!!     You should now run your application with the WSGI interface
!!!     installed with your project. Ex.:
!!!
!!!         gunicorn myproject.wsgi:application
!!!
!!!     See https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/gunicorn/
!!!     for more info.
!!!


Error: 'gunicorn.conf.py' doesn't exist

There is an instance of gunicorn.conf.py in /project and in /project/deploy

Could this be a permissions issue?

har...@iinet.net.au

unread,
Jan 10, 2014, 1:16:53 AM1/10/14
to mezzani...@googlegroups.com
Sorry, that as outside of the deploy folder. Here's the output running from the deploy folder:


!!!
!!! WARNING: This command is deprecated.
!!!
!!!     You should now run your application with the WSGI interface
!!!     installed with your project. Ex.:
!!!
!!!         gunicorn myproject.wsgi:application
!!!
!!!     See https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/gunicorn/
!!!     for more info.
!!!

Failed to read config file: gunicorn.conf.py
Traceback (most recent call last):
  File "/home/harry/.virtualenvs/black_earth_semina/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 51, in load_config_from_file
    execfile_(filename, cfg, cfg)
  File "gunicorn.conf.py", line 5, in <module>
    workers = (os.sysconf("SC_NPROCESSORS_ONLN") * 2) + 1
TypeError: configuration names must be strings or integers



On Friday, 10 January 2014 13:41:31 UTC+8, har...@iinet.net.au wrote:

norbert...@klamann-software.de

unread,
Jan 14, 2014, 11:00:16 AM1/14/14
to mezzani...@googlegroups.com
Hi all, any ideas for this ? 

I have the same problem


Thanks a lot

Norbert

Ryan Sadwick

unread,
Jan 15, 2014, 12:35:25 PM1/15/14
to mezzani...@googlegroups.com
Same here, I hit the same snag.  Currently deploying on Linode.

Stephen McDonald

unread,
Jan 15, 2014, 4:25:03 PM1/15/14
to mezzani...@googlegroups.com
I thought something may have changed in a recent version of gunicorn, since its version isn't specified in the provided fabfile, but I can't reproduce this at all - deploying fine with Mezzanine 3.0.5, Django 1.6.1, gunicorn 18.0, Ubuntu 12.04.

Please don't let this prevent you from diving in, working out what's wrong and reporting back the underlying cause.


--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

har...@iinet.net.au

unread,
Jan 15, 2014, 7:32:54 PM1/15/14
to mezzani...@googlegroups.com
At least for the most basic deployment of mezzanine (ie. no custom theme app yet) I seem to have resolved the issue.

Although I did a few different things, I think that the major factor was changing the gunicorn port from 8000 to anything else (8001, 8888).

I'll keep you posted as to whether this moment of success persists.

Harry


On Friday, 10 January 2014 13:41:31 UTC+8, har...@iinet.net.au wrote:

Stephen McDonald

unread,
Jan 15, 2014, 7:36:03 PM1/15/14
to mezzani...@googlegroups.com
Thanks Harry

FWIW my successful test used 8000 for the gunicorn port.


--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Klamann, Norbert

unread,
Jan 16, 2014, 6:35:58 AM1/16/14
to mezzani...@googlegroups.com
I repeated the whole exercise and now it works .

gunicorn.conf.py is changed an looks like that.

mezzanine@wsa02:~/mezz_test/project$ cat gunicorn.conf.py

from __future__ import unicode_literals
import multiprocessing
workers = multiprocessing.cpu_count() * 2 + 1
loglevel = "error"
proc_name = "mezz_test"

Now I get a Error 500  when I visit the new instance but that is another problem i presume.


Thanks for your help

Norbert






2014/1/16 Stephen McDonald <st...@jupo.org>
You received this message because you are subscribed to a topic in the Google Groups "Mezzanine Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mezzanine-users/Ltmdrd3D2aw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mezzanine-use...@googlegroups.com.

Ryan Sadwick

unread,
Jan 19, 2014, 12:09:51 AM1/19/14
to mezzani...@googlegroups.com
I was able to fix the problem I was having and successfully deployed.

I started over from a basic mezzanine project.  It worked perfectly.  Then I slowly merged in my settings and apps.  I'm using amazon s3 for my cdn and everything snapped together fine.  There was a few things I had to adjust to get the filebrower working with s3 but I expected that :)

I believe the original cause of the issue was I was working in the wrong virtualenv which caused a bunch of issues with supervisor.  While I was able to fix the issues with supervisor I was ultimately in the wrong virtualenv which caused problems with gunicorn.

Thanks for the help!

Federico Bruni

unread,
Feb 27, 2014, 6:42:55 PM2/27/14
to mezzani...@googlegroups.com
I confirm that this solved the same problem. More info here:

It's been fixed two months ago:

Stephen McDonald

unread,
Feb 27, 2014, 7:03:21 PM2/27/14
to mezzani...@googlegroups.com
Thanks Federico, I never stopped to realise that fix matched up with that issue - good to know!

Federico Bruni

unread,
Feb 27, 2014, 7:13:27 PM2/27/14
to mezzani...@googlegroups.com
If the commit or the pull request message contains a reference to the issue #number, then they will be linked each other. See:

Atai Konushaliev

unread,
Aug 14, 2014, 11:10:14 AM8/14/14
to mezzani...@googlegroups.com
I have the same issue with Gunicorn when deploying Mezzanine-based Drum using Fabric, and it seems that the reason is the "gunicorn_django" command in the deploy/supervisor.conf deprecated starting from Gunicorn 18.0, and that is still the default in Mezzanine's latest version (3.1.9 to date). I now trying to figure out how to solve this...

Eduardo Rivas

unread,
Aug 14, 2014, 2:58:20 PM8/14/14
to mezzani...@googlegroups.com
Hello everyone. I created a fabfile that deploys Mezzanine sites to Webfaction. It is not a drop-in replacement for the one provided with Mezzanine (I'm planning on releasing one since I've moved to hosting my sites on a VPS). Anyways, the point is that I've managed to drop gunicorn_django (since it's deprecated) and use vanilla gunicorn. Maybe it will help people having trouble https://github.com/jerivas/mezzanine-webf/blob/master/deploy/supervisorctl.conf#L2.
Reply all
Reply to author
Forward
0 new messages