jhit
9/30/2012 - 1:46 PM

Setup RVM/Ruby with PUMA and NGINX on Debian Sqeeze (ISPconfig)

Setup RVM/Ruby with PUMA and NGINX on Debian Sqeeze (ISPconfig)

Sitewide Setup of PUMA with NGINX draft

In your project folder create a new file.
Gemfile.local

and add this line:
gem 'puma'

To install PUMA support in your project run
gem install puma

Just some helpful commands to get RVM running on Debian Sqeeze.

Install basic build tools for RVM apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config

Install dependencies to compile the mysql2 gem
apt-get install libmysqlclient-dev

Install dependencies to compile the postgre db gem
apt-get install libpq-dev

Install dependencies to compile the ImageMagick gem
apt-get install libmagick++-dev libmagickcore-dev libmagickwand-dev

Read the official install notes on the RVM website. For a multiuser setup [read this note too](https://rvm.io/support/troubleshooting/#sudo title="Use the sudo command!")!

Important: After running the RVM installation script log out or quit SSH session! Otherwise the RVM environment variables might not be there and your further setup gets borked.

If you do a multiuser setup you need to add this line to all starter scripts that should use rails, builder etc. Additionally you need to add this line to the .bashrc file of root, otherwise rvm will not properly initialise the environment variables for root.

source /etc/profile.d/rvm.sh

Test your environment. Run the followinc command and if everything is set correctly it should return rvm is a function
type rvm | head -n 1

Now install Ruby 1.9.3
rvm install 1.9.3

Set it as default
rvm use 1.9.3 --default

Install some gems that need root privilege. If you this now, you do not need to run bundler with root privilege later on. You do not need to install all the extensions. If you do not use mySQL, you can skip this line. But remember to add it to the exclude list of bundler (bundle install --without mysql2)
rvmsudo gem install rmagick
rvmsudo gem install pg
rvmsudo gem install mysql2

Install Rails 3.2.8 or what is now the current stable release and activate it
rvm gemset create rails328
rvm gemset use rails328
gem install rails -v 3.2.8

I use bundler to manage my gems. Lets install it.
gem install bundler

If you do not need some gems, for instance mysql2, run bundler like this:
bundle install --without development test mysql2