Apache 2.2, mod_proxy_balancer, & Mongrel on Ubuntu 6.06
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
- Ubuntu Linux 6.06 Dapper Drake
- Apache 2.2
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.
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.