Ok after playing with Ubuntu, Apache 2.2, mod_proxy_balancer, and Mongrel, I've decided that this is the deployment stack I want to use for at least the next month. snicker
Since I was using a few different sources as references while setting this up, I thought I'd post exactly what I did to get everything installed correctly to suit my needs. This won't go into how to actually DEPLOY your rails app into this environment, but it'll show you what you need to do to get it all installed and set up.
UPDATE: This works on Edgy (6.10) as well...
UPDATE 2: Some things updated for Apache 2.2.4
UPDATE 3: Now with Subversion hotness
Deployment Stack
- Ubuntu Linux 6.06 Dapper Drake
- Apache 2.2
- mod_proxy_balancer
- Mongrel
Sources
Everything below was taken directly (and sometimes even copied and pasted) from the sources above. They are the real heros here. I"m just the aggregator. I'm pretty sure the "one customer" mentioned in the rimuhosting post is Ezra as well. But I could be mistaken.
Ok, lets start.
Its assumed that you are su'd to root.
Core Essentials
Make sure you remove any version of apache that already exists!
sudo dpkg --purge apache apache2
Install the GCC compilers and developer tools.
sudo apt-get install build-essential
Now we'll install Ruby and friends:
sudo apt-get install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8
Next we need to make some symlinks for basic Ruby commands.
sudo ln -s /usr/bin/ruby1.8 /usr/local/bin/ruby
sudo ln -s /usr/bin/ri1.8 /usr/local/bin/ri
sudo ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdoc
sudo ln -s /usr/bin/irb1.8 /usr/local/bin/irb
Apache & Pals
Download and compile Zlib
wget http://www.zlib.net/zlib-1.2.3.tar.gz
tar -xvf zlib-1.2.3.tar.gz
./configure
make
sudo make install
Download and compile Apache 2.2
wget http://apache.rmplc.co.uk/httpd/httpd-2.2.4.tar.gz
tar -xvf httpd-2.2.4.tar.gz
./configure --prefix=/usr/local/apache --enable-proxy --enable-proxy-http --enable-proxy-balancer --enable-dav --enable-rewrite --enable-so --enable-http --enable-ssl --enable-expires --enable-headers --enable-mods=deflate_module --with-php --with-mysql --with-susexec --disable-info --without-berkeley-db --enable-dav=shared --enable-dav-lock=shared --with-included-apr
make
sudo make install
MySQL & Postfix
Lets install Postfix here really quick. We will configure it later but if we don't install it before we install MySQL, apt will pull in Exim as a dependency. We don't want this so lets pre-empt it by installing Postfix.
sudo apt-get install postfix
The Postfix installer will ask you a question about what type of server it is. I just chose "Internet Site".
Now let's install MySQL and friends.
sudo apt-get install mysql-server mysql-common mysql-client libmysqlclient15-dev libmysqlclient15off
Install the MySQL bindings.
sudo apt-get install libmysql-ruby1.8
Now test it:
irb
irb(main):001:0> require 'mysql'
=> true
irb(main):002:0> exit
Now we will install RubyGems so we can get Rails and all kinds of other Ruby treasures!
wget http://rubyforge.iasi.roedu.net/files/rubygems/rubygems-0.9.0.tgz
tar xvzf rubygems*
cd rubygems*
sudo ruby setup.rb
Now we'll install the latest version of Rails.
sudo gem install rails --include-dependencies
You should see (as of Rails 1.2.3):
Successfully installed rails-1.2.3
Successfully installed rake-0.7.2
Successfully installed activesupport-1.4.2
Successfully installed activerecord-1.15.3
Successfully installed actionpack-1.13.3
Successfully installed actionmailer-1.3.3
Successfully installed actionwebservice-1.2.3
Installing ri documentation for rake-0.7.2...
Installing ri documentation for activesupport-1.4.2...
Installing ri documentation for activerecord-1.15.3...
Installing ri documentation for actionpack-1.13.3...
lib/action_controller/routing.rb:1061:30: ':' not followed by identified or operator
lib/action_controller/routing.rb:1065:39: ':' not followed by identified or operator
Installing ri documentation for actionmailer-1.3.3...
Installing ri documentation for actionwebservice-1.2.3...
Installing RDoc documentation for rake-0.7.2...
Installing RDoc documentation for activesupport-1.4.2...
Installing RDoc documentation for activerecord-1.15.3...
Installing RDoc documentation for actionpack-1.13.3...
lib/action_controller/routing.rb:1061:30: ':' not followed by identified or operator
lib/action_controller/routing.rb:1065:39: ':' not followed by identified or operator
Installing RDoc documentation for actionmailer-1.3.3...
Installing RDoc documentation for actionwebservice-1.2.3...
Don't worry about those couple of errors. That just happens sometimes when building the RDoc documentation. If you look closely, you will see that it says "Successfully installed foobar..." a bunch of times.
Mongrel & Friends
Install mongrel and its supporting software. Make sure when prompted you select the most recent, non mswin32 option.
sudo gem install daemons gem_plugin mongrel mongrel_cluster --include-dependencies
It was previously advised to install Sendfile in this stack, but apparently it doesn't serve the static content like it was once suggested. So the speed boost isn't actually there. This means its just extra software to blow up. So don't install it.
This comes strait from Coda, which came strait from Zed. And you listen to Zed.
Subversion
Ok, now lets throw subversion on the box. You might need to grab the libxml2 libs, so apt-get them first. Then download Subversion and compile it. You'll probably be warned that the Berkeley DB isn't installed. Just ignore it. I do.
sudo apt-get install libxml2-dev
wget http://subversion.tigris.org/downloads/subversion-1.3.2.tar.gz
tar xfz subversion-1.3.2.tar.gz
cd subversion-1.3.2
./configure --with-apr=/usr/local/apache/bin/apr-1-config --with-apr-util=/usr/local/apache/bin/apu-1-config --with-apxs=/usr/local/apache/bin/apxs --without-berkeley-db --with-ssl
Further Reading
Simply put, go read Coda's post on how to turn all the elements you just installed into a real working mongrel cluster.
I'm in the process of setting up a shared environment for my pre-production server. So I'll have this stack working for multiple sites on one computer using virtual hosts. I'll share the apache conf files when I've got them finalized.
Popularity: 33% [?]