Get your Rails app deployed in 30 mins or less

ENTER THE REQUIRED INFO:

Enter in a few details, install location, ip address etc. None of the details will be stored in anyway. If you’ve ruby already installed, the script will warn you and ask for your confirmation before you continue. Its highly recommened you use this script on clean installations only. We take NO responsibility for any data loss or breakage.

Welcome to EzRor. Please enter your License Key:
$ demo
Please enter the folder location of your new app:
$ /home/
Please enter the domain to setup rails on:
$ 0.0.0.0
Please enter the IP of the domain to setup rails on:
$ http://ezror.com
Please enter the Rails project name:
$ ezror_rocks
Please enter the root password:
$ pwd (Your password will not be stored)
Please enter the MYSQL database name to create:
$ db_name
Do you want to use Github to deploy (y/n)?:
$ yes
Please enter your GIT username:
$ ezror
Please enter your GIT email:
$ help@ezror.com
Please enter your GitHub Project Repo name:
$ project-repo
If you have uploaded Rails files to server, what
location are they under? (Enter to Skip):
$ ezror_rocks

FIRST WE MAKE SURE THE SYSTEM IS UPDATE:

This is the longest process of the installation. Depending on your internet connection, it may take anywhere from 10-20 minutes.

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirror.steadfast.net
* base: updates.interworx.info
* extras: mirror.ash.fastserv.com
* updates: centos.mirror.nac.net
Setting up Install Process

NEXT WE INSTALL RUBY ENTERPRISE:

Ruby Enterprise Edition has much better performance than regular ruby. (According to phusion passenger about 33% less). REE also install number of other things such as Rubygems, rake, fastthread, passenger etc.

Installing Ruby, Ruby Gems, Passenger, and Rails
Welcome to the Ruby Enterprise Edition installer
This installer will help you install
Ruby Enterprise Edition 1.8.7-2010.02.
Don't worry, none of your system files will be
touched if you don't want them
to, so there is no risk that things will screw up.
Auto-installing to: /opt/ruby-enterprise
--------------------------------------------
Compiling and optimizing the memory allocator for
Ruby Enterprise Edition
In the mean time, feel free to grab a cup of coffee.

./configure --prefix=/opt/ruby-enterprise --disable-
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install...
checking whether build environment is sane... yes
checking for gawk... gawk

NEXT WE INSTALL SQLITE 3.7.0.1:

sqlite3-ruby gem requires additional packages for it to work properly.

Resolving www.sqlite.org... 67.18.92.124
Connecting to www.sqlite.org|67.18.92.124|:80.
HTTP request sent, awaiting response... 200 OK
Length: 1486971 (1.4M) [application/x-gzip]
Saving to: `sqlite-amalgamation-3.7.0.1.tar.gz'

100%[================>] 1,486,971 1.98M/s in 0.7s

2010-10-10 07:56:18 (1.98 MB/s) -
`sqlite-amalgamation-3.7.0.1.tar.gz' saved

AFTER THAT COMES APACHE-2:

First we’ll need to exclude a line in /etc/yum.confg so we can the apache-2 from repos

Compiling and installing Apache 2 module...
cd /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/
passenger-2.2.15
/opt/ruby-enterprise/bin/ruby -S /opt/ruby-enterprise/
bin/rake clean apache2
# /opt/ruby-enterprise/bin/ruby -S /opt/ruby-enterprise/
bin/rake clean apache2
(in /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/
passenger-2.2.15)
rm -rf ext/apache2/libboost_oxt.a ext/apache2/libboost_oxt
rm -rf ext/apache2/libpassenger_common.a ext/apache2/

NEXT WE INSTALL PASSENGER 2.2.15:

We’ll be deploying your app through phusion passenger, so we’ll need to install that first. Passenger has numerous dependencies, which were taken care of in previous steps.

Welcome to Phusion Passenger v2.2.15.
This installer will guide you through the entire
installation process. It
shouldn't take more than 3 minutes in total.
Checking for required software...
* GNU C++ compiler... found at /usr/bin/g++
* Ruby development headers... found
* OpenSSL support for Ruby... found
* RubyGems... found
* Rake... found at /opt/ruby-enterprise/bin/rake
* rack... found
* Apache 2... found at /usr/sbin/httpd

NEXT CREATE SYMLINKS:

Ruby enterprise edition installs in a different location than regular ruby and hence so does gems. For the gem executables to work properly, we’ll create symlinks.

ln: creating symbolic link `/usr/bin/ruby' to
`/opt/ruby-enterprise/bin/ruby'
ln: creating symbolic link `/usr/bin/rake' to
`/opt/ruby-enterprise/bin/rake'
ln: creating symbolic link `/usr/bin/gem' to
`/opt/ruby-enterprise/bin/gem'
ln: creating symbolic link `/usr/bin/rails' to
`/opt/ruby-enterprise/bin/rails'

THEN WE CONFIGURE PASSENGER:

Passenger requires we add couple lines, which load passenger, to /etc/httpd/conf/httpd.conf. We do that by creating a local file and including that into the master apache file. This file also contains info about your apps’ ip address and location.

LoadModule passenger_module /opt/ruby-enterprise/
lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/
apache2/mod_passenger.so
PassengerRoot /opt/ruby-enterprise/lib/ruby/
gems/1.8/gems/passenger-2.2.15
PassengerRuby /opt/ruby-enterprise/bin/ruby
PassengerDefaultUser root

VirtualHost 173.242.112.209
ServerName 173.242.112.209
ServerAlias 173.242.112.209
DocumentRoot /home/current/public
Directory /home/current/public
Allow

NEXT UP GITHUB (OPTIONAL):

We also provide GITHUB deploy option. This step only runs if you specify it in the beginning. To configure GITHUB we need to specify out id_rsa.pub key. You will be emailed detailed instructions on how to do that.

Please follow the following instructions to use
Github to deploy your app on your server:
Login to your Github account
Click "Account settings" (Upper right side)
Click "SSH Public keys" (Lower left side):
Click "Add Another Public Key"
Copy and paste the key below
Be sure to copy the key exactly
Click "Add Key"
You're all done.

AND FINALLY WE CONFIGURE CAPISTRANO:

This is the final step in the process. We’ll be using a very simple capistrano recipe. You’re free to change it to suit your purpose. The file is under /config/deploy.rb in your application folder.

[add] writing './Capfile'
[add] writing './config/deploy.rb'
[done] capified!
default_run_options[:pty] = true

# be sure to change these
set :user, 'root'
set :domain, 'domain'
set :application, 'app'
set :repository, '/home/app/.git'
set :deploy_to, "/home"
set :deploy_via, :remote_cache
set :scm, 'git'
set :branch, 'master'

HOORAY, WE’RE DONE’:

If the above process was successful, you should see something like this:

RUBY - INSTALLED
RAILS - INSTALLED
GIT - INSTALLED
RUBY GEMS - INSTALLED
PASSENGER - INSTALLED
DEPLOYMENT SUCCESSFUL

If you run into any trouble, email us.