by Ryan Walker

Building an app with Rails 3 and MongoDB (part 3)

Built v1 of app out, it was very straightforward. I found Rails 3 Guides very helpful, which covers Rails 3 exclusively, to learn new Rails stuff for ActionMailer and Routing.

Then I was off to figure out the next hard part, deployment.

New VPS

  • I ordered up a new VPS on Linode, chose Ubuntu 8.04.
  • Followed setup processes from here to install Git, add deploy user, get SSH setup, add firewall, and then I tried to get Ruby setup.

Ruby

Attempt 1

My first attempt was to try and see if RVM would work without Ruby - no it doesn’t. I couldn’t figure out what minimum version of Ruby was required, so for fun I tried to use aptitude versions of Ruby & RubyGems. I had some problems with RVM working after I logged in and out (I think maybe I did some commands as deploy when I needed to be root) and after some time, decided to wipe the VPS and start over.

Attempt 2

  • I installed Ruby 1.8.6 from source, then RubyGems, then RVM
  • Ran into some problems again. Not sure exactly where I went wrong, but decided to try a new idea.

Attempt 3

At the end of the steps, I had Ruby 1.9.2-head running w/ Rails 3.0 beta 2 with functioning RubyGems system, and it was now 2am, so I’m happy for now.

MongoDB

  • Downloaded, compiled, installed MongoDB. Started it up.

Running Rails

By now it’s very late, I just want to see something working.

  • Turned off Apache
  • Ran rails server -e production -p 80 in a screen
  • The site was up, running Webbrick in production (I feel serious deja vu from back in the early Rails days)
  • For some reason when I started Rails, I couldn’t get it to recognize mongo_ext - oh well, will troubleshoot that later

Next steps

  • I think I could be running Passenger + Apache just fine - need to figure that out
  • v2 of site – really just have “scaffolding” up - needed to make sure I could get Rails 3 beta 2 out in the wild before writing the whole app.