Getting started with Typo

2006-07-17, Comments

Typo is a Ruby on Rails blogging application. I’d already installed one Rails application on Textdrive before, when I set up a Wiki, and this time it was even easier. It took no more than half an hour to get the thing up and running. The steps were:

The steps were: log into my server obtain the latest version of Typo * create a production database edit the database configuration file tweak the example lighttpd server configuration to use my assigned port * start up Typo log in and configure using the Typo admin interface shutdown Typo * reconfigure my main lighttpd * restart lighttpd * … and we’re done!

Here are the details. Note that my domain is wordaligned.org and my user name is wordaligned — adjust as required. You’ll also need a two port numbers: one for running Typo standalone, and one for running lighttpd. Textdrive can supply these on request.

Obtaining Typo

Apparently the trunk is good and stable and upgrading as simple as svn update so let’s log in to the server and go for it:

svn checkout svn://typosphere.org/typo/trunk typo

Database Configuration

First, create and initialise a mysql production database.

mysql -u wordaligned -p
mysql> create database wordaligned_typo;
mysql> quit;
cat typo/db/schema.mysql.sql | mysql -u wordaligned -p wordaligned_typo

Now configure Typo to use this database by creating a database.yml file which points at your production database, the mysql adapter, and the correct user/password credentials.

cd typo/config
cp database.yml.example database.yml
vi database.yml                     # edit as required

Starting Typo Standalone

Do you have a port number to run Typo standlone? I’d obtained 2508 for Instiki which I no longer required (now that I’m using [lighttpd](http:/www.lighttpd.net to serve my wiki), so I just used that. I edited the lighttpd configuration file in config/lighttpd.conf to use this port number and my Typo production environment:

# Default configuration file for the lighttpd web server
# Start using ./script/server lighttpd
server.port = 2508
....
# Change *-procs to 2 if you need to use Upload Progress or other tasks that
# *need* to execute a second request while the first is still pending.
fastcgi.server = ( ".fcgi" =>
  ( "localhost" =>
      (
        "min-procs" => 2,
        "max-procs" => 2,
        "socket"    => CWD + "/tmp/sockets/fcgi.socket",
        "bin-path"  => CWD + "/public/dispatch.fcgi",
        "bin-environment" => ( "RAILS_ENV" => "production" )
      )
  )
)

I also edited the shebang line in both public/dispatch.rb, public/dispatch.fcgi to explicitly reference ruby at /usr/local/bin/ruby. Now I started Typo with: script/serverlighttpd, logged in at http://wordaligned.org:2508, which put me directly into the Typo administration section.

Having done this, I shutdown Typo with CTRL-C.

Reconfigure lighttpd

Now I merged the example lighttpd configuration with my main one, which now reads something like:

# Making sure file uploads above 64k always work when using IE or Safari
# For more information, see http://trac.lighttpd.net/trac/ticket/360
$HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" {
  server.max-keep-alive-requests = 0
}

$HTTP["host"] =~ "\.wordaligned\.org" {
  server.document-root = "/users/home/wordaligned/web/public/"
  ....
}

$HTTP["host"] =~ "wiki\.wordaligned\.org" {
  server.document-root = "/users/home/wordaligned/instiki/public/"
  ....
}
$HTTP["host"] =~ "blog\.wordaligned\.org" {
  server.document-root =  "/users/home/wordaligned/typo/public/"
  ....
}
$HTTP["host"] == "projects.wordaligned.org" {
  server.document-root = "/users/home/wordaligned/trac/"
  ....
}

Feedback