Upgraded to Typo 4

Typo 4.0 seems to be a major release from Typo 2.6.0. I remember the panic that occurred when Rails 1.1. was released and how it broke my Typo installation. Fortunately, freezing the version of Rails was a good solution that has sustained my blog until today. Anyway, Typo 4.0 was released a couple of days back and there was no major bugs reported for the past few days. So, I took the plunge into upgrading my blog. And in the process moved it over to a new subdomain.

Upgrading Typo is a relatively pain free process especially since there is now a ruby gem for first time users. However, there are some issues that deterred me from using the gem. First: railsapphosting.com does not have that gem installed (yet?). Second: the gem wants to use sqlite as the database backend. I much prefer using MySQL since I will save myself the trouble of converting my previous blog entries into sqlite format.

Anyway, here is how I upgraded. Some of these steps might not be necessary especially if you have a decent backup of everything. However, I am using the safe route here because I really do not want to lose any of my previous blog entries.

  1. Create subdomain
    I created a subdomain called blog.vazexqi.com from the CPanel interface. This is probably specific to railsapphosting.com but all other hosts should have some web-based interface for doing this. Anyway, the steps are clearly described here .
  2. Create new database
    I plan to keep my old database around for the time being so that the original website can still access it. I noticed that Typo 4.0 has a new schema compared to Typo 2.6 so there is no way to share the same database between different installations. Again, the CPanel in railsapphosting.com offers a good way to set up a new MySQL database. Make sure that you remember the database name, username and password. You will need them when you fill in the database.yml file in Typo.
  3. Transfer old database to new database
    There must be an easier way to do this but I did it using two commands.
    1. mysqldump -u <username> -p <database_to_export_from> > <filename>.sql
    2. mysql -u <username> -p <database_to_import_into> < <filename>.sql
    Originally, I wanted to use CocoaMySQL but it was not able to do it and keep throwing NULL errors at me.
  4. Obtain Typo 4.0
    Get it and untar it into the directory that we created from Step 1. We must be careful not to overwrite the dispatch.* files inside the public folder.
  5. Fill in config/database.yml
    Use the fields from Step 2 above. This should be fairly simple. For the time being, we are going to run it in development mode. So make sure you fill in the right fields in the development slot. Also, fill in the same details for the production mode slot.
  6. Do a rake migrate
    In the Typo folder that you have untarred, execute rake migrate. This will migrate the database from version 2.6 to the newer version. Make sure that there are no errors.
  7. Edit config/environment.rb
    Uncomment the line that allows you to run your rail application in production mode. This is one way of forcing your application into production mode. And it seems like the easiest way.
  8. Initial login
    Since you upgraded from a previous installation, your username/password will still work. Log in to <the_domain_from_step1>/admin. You can tweak around with whatever settings you want. However, the MOST important step is to go to the Themes tab and activate one of the two themes included by default. Without doing this, your blog will not render and will throw a Rails Application Error.
  9. Visit your blog
    Try opening your blog at this stage. It should appear with no problems. Also try posting a new entry.
  10. Finishing touches
    Install a new theme, configure your domain names and do whatever else it takes to make you satisfied with your new Typo blog.

In conclusion, upgrading to the latest version of Typo is not as hard as it seems. In fact, it was rather painless for me except for the problems copying my previous database over using CocoaMySQL.

One new feature of Typo 4.0 is support for macros. One of those macros allow nicely formatted code! At the moment, it only supports ruby, yaml and xml so for Scheme code I will still have to revert to vi for the 2html.vim. Here is a sample of the syntax-highlighted code blocks: class Foo def bar "abcde" end end

The Sparklines macro is also cool. Here is an example:

Here is a link to another site detailing how to get Typo 4.0 to work on DreamHost.

Here is the guide from the railsplayground wiki. Replace the file with wget http://rubyforge.org/frs/download.php/12330/typo-4.0.2.tgz if you are upgrading to Typo 4.0.2 to fix the issue with Rails 1.1.4

comments powered by Disqus