I just had a ton of fun trying to deploy a Rails 3 app to a server. The
server (Ubuntu Hardy...whatever version that is), had Rails 2.3.5 on it,
and Ruby 1.8.6. I tried manually updating the gems, and of course it
failed installing Rails 3 (required Ruby >= 1.8.7), so I decided to use
RVM to get Ruby 1.9.2 running.
RVM installed fine, then I installed Ruby 1.9.2, then the Rails gems (
had some readline issues trying to get into the Rails console). I added
Passenger (the server is running Apache, and was running a lower version
of Passenger - v.2 something). That all worked. I was able to use
capistrano to deploy my new version of my app.
(side note - rvm and it's files were installed locally into my home
directory - I had to install passenger using the
passenger-install-apache2-module script WITHOUT using sudo, so it would
point to my rvm ruby... that all actually worked)
My issue now is dealing with the Gemfile on my local dev system and the
deployed version now on the server. My local Mac is using sqlite and the
production server is using MySql. The Ubuntu box had an issue installing
the sqlite gem, and since the Gemfile specifies it, I was stuck. I tried
using the note in the Gemfile about "groups" and did something like:
group :development do
gem 'sqlite3-ruby', :require => 'sqlite3'
group :production do
but upon trying to run the app on the server, it got an error saying
sqlite3 wasn't available. I logged into the server and tried using the
Bundle command to get it set up.. but it still tried to install
sqlite...even if I set RAILS_ENV=production. The only thing I did that
seemed to work was to manually, on the server, in the 'current'ly
deployed app, do bundle install --without development
So... What's the magic that I have to do with Capistrano and the Gemfile
to use the correct gems in production? I saw this morning a post about
adding a line to my deploy.rb file:
but... will that do it? Do I have to add something to my deploy.rb
script to make sure my gems.. proper for my environment... are set up?
I was able to get my app running in production by manually editing the
Gemfile on the server to remove the sqlite lines. And if I have any
changes I need to make to the app.. I've editing the files directly. I
would love to just do a cap deploy.. but that will break! (Not to
mention, having the gem 'mysql' in the Gemfile on my dev system fails,
because I don't have the mysql gem installed...) Nice catch-22 there!
Any info would be highly appreciated.