-
Notifications
You must be signed in to change notification settings - Fork 6
Install a Rails Stack on NitrousIO
In this guide we will install and set up RVM, Ruby, Postgresql, and Rails, and connect the VM to Github.
Follow the two initial steps in RVM's installation guide.
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
\curl -sSL https://get.rvm.io | bash
The console will output a couple of warnings. You must amend .bash_profile
to source ~/.profile
, and unset the current gem set. Open ~/.bash_profile
(click the "Show Hidden Files" button if .bash_profile
isn't visible) and add the following line.
source ~/.profile
Then run the following command in the console.
unset GEM_HOME
Restart the console to install Ruby.
Check what versions of Ruby are available and install your preferred version using the following commands.
rvm list known
rvm install [version]
Use bundler to install Rails.
gem install rails
NitrousIO's .gemrc
already disables rdoc installation. You can confirm this by opening ~/.gemrc
. You should see the following lines.
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
gem: --no-rdoc --no-ri
If .gemrc
does not exist, create it under your home directory and add aforementioned lines. Make sure hidden files are visible, otherwise you will not be able to see the file.
Restart your console to be safe.
NitrousIO distros use parts for package installing.
parts install postgresql
parts start postgresql
Create a new app and start it. Rails 4.2 might require you change the IP address binding for Webrick.
rails new appname -d postgresql
cd appname
rails s -b, --binding=0.0.0.0
You can make your life easier by creating an alias to the rails server command. Open ~/.bashrc
(click the "Show Hidden Files" button if .bashrc
isn't visible) and add the following line.
alias server='rails s -b, --binding=0.0.0.0'
This will allow you to connect to the rails server by simply typing 'server' on the command line.
Assuming you have connected your Github account, navigate to the boxes page and click on the box to open its profile. Click the link at the bottom that says "Reveal Public Key." Once the key is revealed, an additional link on the right-hand side will appear. It should say "Add to Github." Go ahead and click that, and sooner after it should confirm that the key was added. You can navigate to Github to confirm this change.