1

I'm setting up a django project following H. Percival's TDD. By the end of the chapter I setup an Upstart process to start the server with Gunicorn using Nginx as well.

My upstart file /etc/init/gunicorn-superlists-staging.conf looks like this:

description "Gunicorn server for superlists-staging"

start on net-device-up
stop on shutdown

respawn

setuid diego
chdir /home/diego/sites/superlists-staging/source

exec ../virtualenv/bin/gunicorn \
  --bind unix:/tmp/superlists-staging.socket \
  superlists.wsgi:application

And running it with sudo start I get the error:

start: Unknown job: gunicorn-superlists_staging

What confuses me is that I can run the last command fine from the server,

../virtualenv/bin/gunicorn \
    --bind unix:/tmp/superlists_staging.socket \
    superlists.wsgi:application

and this is where the error is.

The way to identify the error follows this post. That is, I comment all the instructions and uncomment one at a time until it breaks in the last one.

My server is in AWS. What else should I provide for fixing this?

Diego-MX
  • 608
  • 2
  • 7
  • 23
  • 1
    "... which is where the error is." How did you know that? Is there more to the error message than you have shown here? – muru Mar 08 '16 at 01:23
  • I edited the question, to include my fix. I also found errors with `init-checkconf` but don't have the output at the moment. – Diego-MX Mar 08 '16 at 13:15
  • 1
    Oddly enough, I can't find a single example in the Upstart cookbook where `\ ` is used to continue the command over the next line. Try putting the entire command on one line. – muru Mar 08 '16 at 13:20
  • Unfortunately, that didn't fix it. Another possibility is having changed the server's name when being referenced in the upstart process. That is, keeping it at `superlists-staging` instead of the whole `ec2-ip-region-.compute.amazonaws.com`. Could this have something to do? – Diego-MX Mar 08 '16 at 23:17
  • 2
    Dunno. Did you make a typo somewhere? The error says `gunicorn-superlists_staging` with a `_`, but the file name is `gunicorn-superlists-staging.conf`. – muru Mar 08 '16 at 23:19
  • You hit the nail. It wasn't a typo, but it was a bad choice of character. Bash does recognize `_` but apparently not Upstart for some reason. Thanks for checking it out. – Diego-MX Mar 08 '16 at 23:46
  • @Diego, was this fixed by muru's last comment? – user.dz Dec 17 '16 at 12:15

0 Answers0