
Last night I spent a few hours getting a Typo installation up and running on a server of ours. Typo is a Rails based blogging engine, and I wanted to take the chance to install it and see what it's like, and also learn more about Rails based applications.
Getting Typo built and deployed wasn't as easy as it could be but I made it in the end and the new weblog is up and running. I was also deploying to a Debian Sarge machine which didn't seem to be so common according to Google - most tutorials, blog posts, etc, out there seem to refer to Ubuntu, Fedora or Mac OS X - which is all fine, however I did come across a few Debian Sarge gotchas while installing.
Typo itself is available via Subversion and a released 2.6.0 product. The 2.6.0 product was released just a few months back but all of the mailing lists, wiki's, etc, say that the Subversion version is the way to go. So, subversion it was.
In terms of base packages under Sarge, to do all of this you'll need build-essential, ruby, irb, libfcgi-ruby1.8, libmysql-ruby1.8, mysql, and subversion which can all be installed via apt-get in a snap
You'll also need rubygems, and rake (installed via rubygems, and not the Debian package which doesn't seem to handle the Typo 2.6.0 migration properly).
To install rubygems:
$> wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
$> tar xvzf rubygems-0.8.11.tgz
$> cd rubygems-0.8.11
$> sudo ruby setup.rb
and then:
$> gem update
$> gem install rake
To get a hold of Typo itself, one has to check it out over the internet using the following command:
svn checkout svn://typosphere.org/typo/trunk typo
Once that's finished, you'll need to create a new database, and specify the credentials in the typo/config/database.yml configuration file.
login: &login
adapter: mysql
host: localhost
username: someuser
password: somepassword
production:
database: ty_host
<<: *login
After creating the database and an account to access it with appropriate permissions, you'll then need to create all of the tables/etc that Typo needs to operate.
$> mysql -p -u user database < db/schema.mysql.sql
Password:
As I found out, if you were to continue here and complete the installation of Typo - things won't work, as changes have been made to the database schema between 2.6.0 and what's in Subversion - luckily though there's a set of migration scripts that migrate the 2.6.0 schema to the new format required. For this you'll need Rake, and for some strange reason the Debian installed Rake package fails to work properly - so you'll need the gem installed Rake.
$> rake migrate RAILS_ENV=production
Ok, once this has all been done, you should be able to run a standalone installation of Typo by running:
$> script/server -e production
Which will run a server on port 3000 of your server. Connecting to this, ie: http://yourhost:3000/ will let you create an account and start blogging.
In a production environment though, you're more likely to want to deploy Typo in an Apache2 or similar environment.
To do this you'll need apache2 installed (apt get install apache-mpm-prefork, etc) and fcgid, an alternative to fastcgi (apt-get install libapache2-mod-fcgid). After installing fcgid check /etc/apache2/mods-enabled to see if rewrite and fcgid are enabled, if they aren't you'll need to use a2enmod to enable them.
Then you'll need to mount your Typo installation somewhere in your Apache server space by editing your /etc/apache2/sites-enabled/your-sitename file:
This mounts your Typo installation under http://yourhost/blog/.
You'll also need to modify your typo/public/.htaccess file so that:
AddHandler fastcgi-script .fcgi
becomes:
AddHandler fcgid-script .fcgi
and that
RewriteBase /blog
is specified if you're mounting your Typo installation somewhere else than under your server root.
The final step is to ensure that you're running Typo in production, which is specified in typo/config/environment.rb:
ENV['RAILS_ENV'] = 'production'
Restart apache (/etc/init.d/apache2 restart) and you should be all good to go.
As for the blogging engine itself, it seems quite nice with some flash GUI and user interaction. I'm still playing around with it so I'll write another post about Typo itself once I've been able to use it some more. Happy Typo installing :)
Posted by crafterm at June 6, 2006 12:29 PM | TrackBack