Skip to content

Instantly share code, notes, and snippets.

@shearn89
Created November 24, 2011 15:46
Show Gist options
  • Save shearn89/1391641 to your computer and use it in GitHub Desktop.
Save shearn89/1391641 to your computer and use it in GitHub Desktop.
Configuration instructions for deploying my rails project

Configuring a Rails Server

Assuming Kerberos is set up, and Apache (or nginx) and MySQL (or other db) are installed, this guide should work fine. NOTE: RVM needs to be installed via sudo, not directly as root.

  1. Prepare installation of RVM:

    1. install build tools such as build-essential
    2. install git
  2. Follow the instructions found here: https://rvm.beginrescueend.com/rvm/install for multi-user install. Although this installs it for all users locally, we need to add the lines specified in step 2 to the top of /etc/bash.bashrc, ensuring that rvm and all $PATHs work over ssh.

  3. rvmsudo rvm install 1.9.2 followed by rvmsudo rvm use --default 1.9.2. These should make sure that all users are now using ruby 1.9.2 - easily checkable by logging in as a non-root user and doing which ruby (which should include rvm in the path somewhere), or ruby -v.

  4. sudo gem install rails. This should install rails 3.

  5. Install node.js (or some other javascript executable, see https://github.com/sstephenson/execjs for a list of supported runtimes). Node.js has handy source-building instructions available at http://apptob.org.

  6. Install the passenger module:

    1. sudo gem install passenger
    2. sudo passenger-install-apache2-module (or -nginx-module if nginx is the web server). May be required to install missing software.
    3. Install any dependencies listed for ''Ruby''.
  7. Configure Apache/Nginx. Add a virtual host entry (example for apache):

    <VirtualHost *:80>
        ServerName whateveritshouldbecalled
        DocumentRoot /var/www/foldername/current/public
        <Directory /var/www/foldername/current/public>
            Order allow,deny
            Allow from all
            Options -MultiViews
        </Directory>
    </VirtualHost>
    

    Make sure this host is marked as enabled. It should be noted that only the /var/www/foldername needs to be created, current/public gets created when I deploy the files. /var/www/foldername needs to be world readable, and writable by me (s0700157).

  8. Create a database, and grant all privileges on it to a new user with a password.

Then I simply need to know the /var/www/foldername path, the database user and password, and to be able to ssh into the machine. It should all work fine from there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment