Skip to content

Instantly share code, notes, and snippets.

@witwall
Created April 6, 2013 08:55
Show Gist options
  • Save witwall/5325468 to your computer and use it in GitHub Desktop.
Save witwall/5325468 to your computer and use it in GitHub Desktop.
RVM and Bundler on Dreamhost, I can access https://gist.github.com/muffinista/3276350, so I copy it from the google cache
#
# 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