The Sprinkle gem is the easiest way I’ve seen in order to deploy a Slicehost VPS remotely for Rails development… (In this case Phusion Passenger (mod_rails) and Ruby Enterprise Edition)
I’m using Linux Slackware 12.1 distro for my local machine OS… and Linux Ubuntu 8.04 LTS Hardy distro for my VPS.
The first step would be to set the RoR environment on your local machine… I just went to the Ruby on Rails official site and downloaded the tar.gz files and installed them in the following order;
Ruby
RubyGems
Now, you can update RubyGems
~$ gem update -system
~$ gem install rails –include-dependencies
(Be patient, this might take awhile. The —include-dependencies answers “yes” to any queries of whether to download other dependent projects, like rDoc.)
Now you can install Rails and Mongrel via RubyGems:
~$ gem install rails mongrel
Now add /var/lib/gems/1.8/bin/ to your path, and you’re done!
~$ PATH=${PATH}:/var/lib/gems/1.8/bin/
~$ export PATH
Now we can create an application skeleton and start the server:
rails path/to/your/new/application
cd path/to/your/new/application
ruby script/server
You’re running Ruby on Rails! On http://localhost:3000
Ok… now that we set up our RoR environment we can start playing with the Sprinkle gem!!!
I pretty much followed Mitchell Hashimoto’s screencast in order to understand the Sprinkle gem. Therefore, I’m using his gem version.
The Sprinkle gem has some bugs that Mitchell and the maintainer are currently addressing… so I just would try to explain what I did in order to get it to work properly.
The first step would be to rebuild your slice with Ubuntu 8.04 LTS Hardy distro (this is actually optional, but recommended).
SSH to your slice and run an “apt-get update”, an “apt-get upgrade” and restart your server… ((Make sure that any change to your SSH port, should be reflected on you Capistrano script as well. (These are some issues that Mitchell is trying to address in the future Sprinkle versions))
Download Mitchell’s Sprinkle gem (I would not recommend to perform updates after installing the scripts because it would overwrite it)
Follow the readme.txt file in order to install it.
After extracting it and going to the script directory (i.e ~$ cd /Desktop/downloads/package/scripts#)
In Slackware as root if you want, you can run;
~$ gem install –local sprinkle-0.1.5.gem
After that, go to the sprinkle/ directory in this package and modify the deploy.rb to match your settings.
It should look like this;
set :user, ‘root’
set :password, ‘YourVPSPassword’
role :app, ‘YourVPSIPAdress’, :primary => true
And change the four occurrences of ‘passenger-2.0.2′ in the phusion.rb file to ‘passenger-2.0.3′
Then run the following commands:
~$ sprinkle -c -t -s sprinkle.rb
Just for testing, and will not to perform any actions.
~$ sprinkle -c -s sprinkle.rb
This will setup the basics on your Ubuntu server!
Now you can type your VPS IP on your browser and should see the Apache “It works!” page.
This is my script output in case someone finds it helpful.

0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.