Deploying A Rails App To Rackspace Cloud Servers On Ubuntu Using Nginx and Unicorn

by dontangg on April 4, 2012

Unicorn

Add unicorn to your Gemfile:

# Gemfile
gem "unicorn"

Add this file to your rails app. I pretty much copied this from Ariejan de Vroom and GitHub.

Page: 1 2 3 4 5 6

9 comments

Cool post!

A few comments/thoughts:

1. I still like RVM, and am used to it and see no reason to switch to rbenv. That said, I had trouble (and am still having trouble) with Ubuntu + OpenSSL + Ruby 1.9.2 + RVM. I’m not sure which aspect is to blame here, but all I know is I built this same server on Gentoo a year ago and didn’t have these OpenSSL issues.
2. I like thin over unicorn, as it allows for asynchronous IO. Although, to be fair, I’m not utilizing it much yet, so at this point I don’ think it matters too much what server I use for my Rails app.

I have been working hard on getting this dang Ubuntu box up and running. I think part of my frustration has actually stemmed from selecting the smallest (256mb) size server. It might be an interesting idea to choose a bigger instance at first, then after you’re done installing all the prerequisites, re-size it to a smaller instance and then save an image. I think that’s what I’ll do next time.

I also thing I’ll go back to Gentoo next time, or even (God help me), CentOS.

by Steve on May 7, 2012 at 1:34 am. Reply #

Thanks, I’m about to deploy to rackspace and plan to follow your instructions.

Does rackspace give you information regarding how much memory your instance is using?

by stephen murdoch on June 20, 2012 at 4:19 pm. Reply #

Yes, Rackspace tells you how much space you’re using. I haven’t look hard in the website to find it, but I know you can see it when you ssh into your server. As part of the welcome message, it gives you a bunch of stats like, number of running processes, hard disk usage, ram usage, etc.

I watched Ryan Bates’ Railscast after I posted this and found it very beneficial. I highly recommend it. You can find it here: http://railscasts.com/episodes/335-deploying-to-a-vps.

by dontangg on June 20, 2012 at 4:42 pm. Reply #

Thanks for the post, i absolutely will try this configuration later, while still on development.
Now i’m also on rackspace’s 256mb Debian 6, RVM + passenger + nginx + mysql.

by Adi Suryadi on July 26, 2012 at 5:59 pm. Reply #

I have a just a few questions. If I set my nginx, and unicorn files to the Rackspace provided IP instead of port 80 I can load the static pages from my rails app If I change it to port 80 and try to go to the rackspace provided IP is just see bad gateway message from nginx, would you be able to give me some guidance?

by nofx1717Jesse on September 19, 2012 at 10:56 am. Reply #

Sorry for the late reply. I just got back from a trip to Disneyland with my family. I don’t consider myself an expert in server setup/maintenance. At this point it would take me a while to remember everything. Part of the reason for this post was for me to be able to remind myself what I did. I don’t think that I can be much help with the time I have. I definitely recommend the Railscasts that I mentioned in the post on setting up a VPS. He does a great job of explaining the details. IMO, the one video itself is well worth the $9 it costs for a membership for a month.

by dontangg on September 28, 2012 at 10:33 pm. Reply #

Awesome post! What version of ubuntu are you running on RackSpace? Is it a 1st gen or next gen cloud server?

by James Stone on November 24, 2012 at 1:19 am. Reply #

I’m glad you liked it! It is a 1st gen cloud server. They hadn’t announced the next gen ones when I started. I’m running Ubuntu 11.10.

by dontangg on November 24, 2012 at 1:29 am. Reply #

Terrific post. Thank you! Got it up and running without issue.

by Bijan on February 19, 2013 at 6:12 pm. Reply #

Leave your comment

Required.

Required. Not published.

If you have one.