Skip to content

Instantly share code, notes, and snippets.

@muffinista
Created August 6, 2012 16:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muffinista/3276350 to your computer and use it in GitHub Desktop.
Save muffinista/3276350 to your computer and use it in GitHub Desktop.
RVM and Bundler on Dreamhost
#
# Step One - Installing RVM
#
curl -L https://get.rvm.io | bash -s stable --ruby
# Then, install ruby 1.8.7 -- you need to basically match the same version of Ruby as Dreamhost
rvm install ruby-1.8.7-p334
#
# I also create a gemset, although this is probably optional
#
rvm gemset create sinatra
rvm use 1.8.7@sinatra
# My project has this very simple .rvmrc
rvm 1.8.7@sinatra
# Install bundler next:
gem install bundler
#
# Step Three - Setup Gemfile
#
# In your Gemfile, you will need to match the version of rack being used on Dreamhost, which is currently 1.2.1:
gem "rack", "=1.2.1"
#
# Step Three - Setup config.ru
#
#!/usr/bin/env ruby
require 'rubygems'
ENV['GEM_HOME']="/home/username/.rvm/gems/ruby-1.8.7-p334@sinatra"
ENV['GEM_PATH']="/home/username/.rvm/gems/ruby-1.8.7-p334@sinatra:/home/username/.rvm/gems/ruby-1.8.7-p334@global"
require 'rubygems'
Gem.clear_paths
require 'bundler'
Bundler.require
require 'mufftweet'
run MuffTweet
#
# Recently I had some problems with my apps on Dreamhost, and I switched to using
# a vendored bundle. I ran this command within each of my projects:
#
bundle install --path vendor
# This installs the gems you need in a vendor/ folder within your project.
# Finally, if you need something to run in cron, you can do it like this:
# The ". ~/.bash_profile" bit loads in the RVM functions that you will need to run anything in cron.
*/10 * * * * . ~/.bash_profile; cd /home/username/appname; /home/username/appname/cron.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment