Wednesday, February 17th, 2010
At first I was thrown by the Phusion Passenger installation instructions when it talked about enabling the Passenger module in apache .conf file. In Ubuntu the enabling/disabling of modules does not sit in a .conf file but, in fact, split into individual .load/.conf files in the /etc/apache2/mods-available folder.
This means when you enable a module with a2enmod in Ubuntu it simply makes a symlink from mods-enabled -> mods-available and disabling a module (with a2dismod is just as easy. No more hunting in those .conf files.
So I wanted to keep things using the same idea of using the mods-enabled directory as opposed to using one large apache2.conf file.
Phusion Passenger Installation
Passenger is drop dead simple to install, here’s the steps.
Update the system
sudo apt-get update
sudo apt-get install apache2-prefork-dev |
Now Install Phusion Passenger
sudo gem install passenger
sudo passenger-install-apache2-module |
Passenger is now installed; let’s get it enabled.
Create the .load/.conf in mod-available
Create the .load file with sudo nano /etc/apache2/mods-available/passenger.load and paste in the following:
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.9/ext/apache2/mod_passenger.so |
Note: The version numbers I’ve used might not be what you have installed; Passenger will give you the correct version numbers on screen once installation is complete.
Create the .conf file with sudo nano /etc/apache2/mods-available/passenger.conf and paste in the following:
<IfModule passenger_module>
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.9
PassengerRuby /usr/bin/ruby1.8
</IfModule> |
Enable Passenger
Enabling Passenger is as simple as:
sudo a2enmod passenger
sudo /etc/init.d/apache2 restart |
And you will need to change your /etc/apache2/sites-available/default to read:
<VirtualHost *:80>
ServerName www.rackapp.com
DocumentRoot /webapps/rackapp/public
</VirtualHost> |
And you’re done. You’re up and running with Phusion Passenger.
You can read more about configuring Passenger here
Posted in Ruby on Rails | Comments Off
Monday, February 15th, 2010
I am unable to get Capistrano to deploy from our Subversion repository as it’s on a local IP, with no VPN access or access from the outside world and I’m also not in a position to open up the SVN box to the outside world.
So how does Capistrano get access to the source code?
Turns out it’s not that hard, you just need to know the tricks. So open up your /config/deploy.rb file and add/modify the following lines:
set :scm, :none
set :respository, "."
set :deploy_via, :copy |
Using Capistrano
Here’s my notes for getting Capistrano up and running. You need only run these steps the first time:
sudo gem install Capistrano
cd /your/project/directory
capify . |
copy deploy.rb (listed below) over project/config/deploy.rb
cap deploy:setup
cap deploy:cold |
Subsequent Capistrano usage needs only:
deploy.rb
Below is the deploy.rb I’ve used (many thanks to aussiegeek on twitter). You might not require the first line default_run_options[:pty] = true I had to add it for use on Ubuntu 9.10.
Also I’m using Phusion Passenger.
default_run_options[:pty] = true
set :application, 'projectName'
set :deploy_to, '/server/path/'
set :user, 'username'
set :use_sudo, false
role :web, "server.com"
role :db, "server.com", :primary => true
role :app, "server.com"
set :scm, :none
set :repository, "."
set :deploy_via, :copy
namespace :deploy do
task :start, :roles => :app do
end
task :stop, :roles => :app do
end
task :restart, :roles => :app do
run "touch #{current_path}/tmp/restart.txt"
end
end |
Posted in Ruby on Rails | Comments Off
Friday, January 15th, 2010
Here’s the steps I took to install Ruby on Rails on a fresh Ubuntu 9.10 Karmic Koala.
Update/upgrade system
sudo apt-get update
Install ruby, irb and rdoc
sudo apt-get install ruby irb rdoc
Install required Ubuntu packages
sudo apt-get install libopenssl-ruby build-essential ruby1.8-dev libpq-dev
Install rubygems
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar -xvzf rubygems-1.3.5.tgz
cd rubygems-1.3.5/
sudo ruby setup.rb
sudo gem update --system
Install Rails (with gem)
sudo gem install rails
If you need to install postgresql
sudo apt-get install postgresql
Create the postgres user
sudo su postgres
createuser
Need to create a postgres database?
createdb
Install the ruby to postgres driver
sudo gem install postgres
Finished
That’s it, Ruby on Rails should be installed along with Postgresql if you need it.
Credit goes to Peter Vandenabeele for the basis for these steps.
Posted in Ruby on Rails | 2 Comments »