Production setup

10 views
Skip to first unread message

detour

unread,
Apr 20, 2011, 3:38:43 PM4/20/11
to Whirlwind
I've been having a lot of fun developing my Whirlwind app locally and
am ready to move my app over to my VPS. I have configured nginx as per
the Tornado docs and I am trying to use the provided /etc/init.d/
whirlwind script to start/stop the instances but seem to be having
trouble.

app settings - first off, should anything change in my app's config/
settings.py?
/etc/whirlwind.conf - I have modified the path to point to my app's
location
/etc/init.d/whirlwind - I had to create a /var/run/whirlwind directory
as well as /var/log/whirlwind

When I run "whirlwind start" I get the following output:

Starting whirlwind daemon:
on port: 8000 ...done.
on port: 8001 ...done.
on port: 8002 ...done.
on port: 8003 ...done.

When I try to access the page in a browser, I get 502 Bad Gateway
message from nginx. If I try to access page.address.com:8000 in a
browser I get nothing. If I view the nginx log I have:

[error] 2352#0: *20 connect() failed (111: Connection refused) while
connecting to upstream, ... upstream: "http://127.0.0.1:8003/"...
[error] 2352#0: *20 connect() failed (111: Connection refused) while
connecting to upstream, ... upstream: "http://127.0.0.1:8000/"...
[error] 2352#0: *20 connect() failed (111: Connection refused) while
connecting to upstream, ... upstream: "http://127.0.0.1:8001/"...
[error] 2352#0: *20 connect() failed (111: Connection refused) while
connecting to upstream, ... upstream: "http://127.0.0.1:8002/"...

If I try to run "whirlwind stop" I get the following output:

Stopping whirlwind daemon:
start-stop-daemon: warning: failed to kill 2519: No such process
whirlwind 8000.
start-stop-daemon: warning: failed to kill 2527: No such process
whirlwind 8001.
start-stop-daemon: warning: failed to kill 2535: No such process
whirlwind 8002.
start-stop-daemon: warning: failed to kill 2543: No such process
whirlwind 8003.

If I run the server from the command line, I can successfully access
page.address.com:8000 in a browser. I can also access the page without
the port but no static files get served.


Any help wold be greatly appreciated.

Matt Dennebaum

unread,
Apr 20, 2011, 3:49:10 PM4/20/11
to whirlw...@googlegroups.com
Looks like your daemon processes are failing to start. If i had to guess
it sounds like a permissions issue to me. Does the user your running the
init.d script as have access to write to the pid
directory(/var/run/whirlwind)? If not chown the pid directory to be
owned by the user who is running the init.d script. If you have sudo
access you can try running the init.d as root as a quick test.

As for your settings.py you shouldn't have to change anything.

Let me know how that pans out.

best,
Matt

PS glad to hear your enjoying working with whirlwind. :)

--

Matt Dennebaum, Chief Technology Officer
Wiredset * 425 West 13th Street Suite 504 * NY NY 10014

tel: 212.242.3400 ext: 123 * fax: 212.242.3464 * cel: n/a
W3: wiredset.com * e: ma...@wiredset.com * aim: mdennebaum2

Linkedin: http://www.linkedin.com/in/dennebaum

--

David Torres

unread,
Apr 20, 2011, 5:34:17 PM4/20/11
to whirlw...@googlegroups.com
Managed to get it working by removing the output redirection and logging stuff from DAEMON_OPTS, " > $LOGFILE 2>&1". Not sure what wasn't working exactly. Bash scripting isn't my strongest point but I did notice that line 43:

rm -f /var/run/"$NAME-$PORT".pid

should be:
rm -f /var/run/whirlwind/"$NAME-$PORT".pid

I can now hit each instance by port. Static files still don't seem to be serving when accessing via nginx but I'm sure I'll iron that out.
--
[ detour ]

Matt Dennebaum

unread,
Apr 21, 2011, 10:17:54 AM4/21/11
to whirlw...@googlegroups.com
Yah bash can be a pain. Its always chalanging to create something that will work for everyone's setup. Glad to hear you got it working.

As for your static files issue as long as you have something along the lines of...

location ^~ /static/ {
            root /path/to/your/app;
            if ($query_string) {
                expires max;
            }
        }

in your config for nginx then you should be good to go.

best,
Matt
-- 

Matt Dennebaum, Chief Technology Officer
Linkedin: http://www.linkedin.com/in/dennebaum

-- 

Matt Dennebaum

unread,
Apr 25, 2011, 11:48:42 AM4/25/11
to whirlw...@googlegroups.com
Hey detour,

I just pushed a change to the way the logging redirection works in the whirlwind init.d script. It should now create a log file for each port your running on in the /var/log/whirlwind directory. Give it a shot and let me know if it works for you. Also fixed the bug you mentioned below. :)

best,
matt


On 4/20/2011 5:34 PM, David Torres wrote:
-- 

Matt Dennebaum, Chief Technology Officer
Linkedin: http://www.linkedin.com/in/dennebaum

-- 

David Torres

unread,
Apr 25, 2011, 11:58:32 AM4/25/11
to whirlw...@googlegroups.com
Yep that works for me now without modification. Thanks!
--
[ detour ]

Matt Dennebaum

unread,
Apr 25, 2011, 12:02:05 PM4/25/11
to whirlw...@googlegroups.com
Fantastic! Thx for the quick reply. :)

-M
Reply all
Reply to author
Forward
0 new messages