Skip to content

Building a RoR Production Server: Assumptions and tools

sentient06 edited this page Jan 8, 2013 · 3 revisions

Before we start, I assume the reader knows:

  • How to navigate in a Unix or Linux environment, create directories, delete files (including directories), change permissions, change user, read files on a command line, edit files on a command line, etc;
  • At least one computer language, whatever it is, but specially C/C++ and Ruby;
  • How to deploy Rails application or at least tried to do so;
  • How to build a basic Rails application;
  • How to use basic GIT commands like clone, push and pull;
  • How to use a database like PostgreSQL or MySQL or anything-SQL;
  • How a basic server works (HTTP protocol, IP, etc).
If there is nothing to worry here, lets see what are we going to do:

I found a really interesting link about Heroku and I took the liberty to choose similar tools to emulate it's functionality:

http://www.quora.com/Scalability/How-does-Heroku-work

I am working on a Snow Leopard machine (hell yes, I am not into planned obsolescence, this system covers all I need) and I use Sublime Text 2 for coding. I don't get any money telling you this.

For the server I am using Linux Ubuntu, because well, is free, and I think it is well stable and well documented and updated.

So, after reading the mentioned article I came to a list.

We will need:

  • Ubuntu Server 12.04
  • Ruby on Rails applications:
    • Ruby Version Manager,
    • Ruby,
    • Rails
    • Thin (application server)
  • Nginx (reverse proxy)
  • PostgreSQL
  • Git
  • Some scripts to tie everything up.
For testing I suggest using an emulator. I would recommend VMWare Fusion, because it can save the state of the virtual machine and you can recover if anything goes wrong. But, this thing is paid, so if you want a free alternative, try VirtualBox from Oracle.

I will not get into details on how to setup the emulator or the real server. The important thing is that you get a default Ubuntu environment with at least one administrator user. Since this user is not set in a VPS like Linode, I will quickly cover it to avoid time spent on research. In the VM you can setup this user on the installation.