With my new Slice up and running, it’s time to install a blogging engine and migrate my various crap blog content from Blogger.

After some research I settled on using Typo, because:

  • I wanted on Ruby on Rails app to play with (my first experience with RoR, mongrel clusters, apache, etc).
  • That’s what the slicehost blog uses, and they’re cool.
  • Typo’s development community seems reasonably active (definitely more active than the other RoR blog engines around at the time).
  • Features and all that jazz look nice.
  • Nice installation process using Gems.

I had an error trying to install the Typo gem: sudo gem install -y typo

Something about sqlite3… so I made sure sqlite3 was installed: sudo apt-get install sqlite3

And still had the same error. I took a break for a while, and then it dawned on me - the typo installer probably needs to compile something to do with sqlite. I don’t know what, and I don’t really care. So I guessed to install the sqlite3 source, or header files, or whatever: sudo apt-get install sqlite3-dev

And it worked! Hahaha. I just love how intuitive all this linux stuff is.

With the Typo gem installed I could install my Typo blog(s) at will :) with: typo install /home/james/public_html/my-new-typo-blog

Gems is cool.

Once installed, the new Typo blog is running on a mongrels server on a randomly choosen port.

Applying what I’d learnt from the Mongrel clusters and surviving a reboot article, I knew that I’d want to scrap whatever the Typo installer did regarding mongrel and serving on that random port. So I restarted my slice. After starting back up, the new blog’s mongrel server was not running on any port - haray - so I could start copying the steps from the “surviving a reboot” article, applying them to my new typo blog.

Create a mongrel cluster config to server the blog:
cd /home/james/public_html/my-new-typo-blog
mongrelrails cluster::configure -e production -p 8002 -N 2 -c /home/james/publichtml/my-new-typo-blog -a 127.0.0.1

Now I need to create a link to this new mongrel cluster config, so that it’s used by the mongrel init.d script. I didn’t pay much attention to how that works, just followed the “surviving a reboot” article and it all just worked ;-)
sudo ln -s /home/james/publichtml/my-new-typo-blog/config/mongrelcluster.yml /etc/mongrel_cluster/my-new-typo-blog.yml

So now I can start the mongrel cluster, to start serving my new blog on ports 8002 and 8003.
mongrelclusterctl start

Or not. I get an error. Something about an invalid file. My generic test RoR app (which I created while following the article) works fine on ports 8000 and 8001. So I looked for something different with my Typo set-up.

I executed exactly the same commands, so it must be something to do with the Typo structure itself…

Uuh, the Typo install does not have a tmp/pids/ directory, which is where mongrel appears to create it’s PID file things (not that I really know what they are, some kind of process marker I guess).

So I created the directory: mkdir /home/james/public_html/my-new-typo-blog/tmp/pids

And now I can start the mongrel cluster:
mongrelclusterctl start

Wooo, it worked!

The low-down:

  • mongrel_rails cluster::configure creates a config file referencing directory-of-rails-app/tmp/pids/ by default.
  • So make sure you have that directory in your rails apps :-)

Now with the mongrel cluster running (and starting automatically on startup), I just need to make Apache proxy requests through to the mongrel cluster.

To do this I just copied the relevant steps in the Apache, virtual hosts, rails and mongrels article exactly, and it worked.