I’m sure everyone will be glad to know I’m up and running with the latest trunk revision of Typo—the blogging software I’m using. Although it was far easier than expected, here’s a little guide to how I did it (in case others aren’t so familiar with Subversion).
Firstly, I wanted to make sure that if it didn’t go smoothly I’d have a full backup of my MySQL database, so I ran the following
mysqldump typo_production > before_migration.sql
That scripts all of the database to the `before_migration.sql` file, which can then be restored (if necessary) as follows:
mysql typo_production < before_migration.sql
All of my Rails based apps are now running under Lighttpd (a good choice by the way), with the current application folder as follows:
/var/www/servers/_domain_name/current
In most sites this is just a symbolic link to the actual directory created by Switchtower when doing `rake deploy`. However, for Typo, since I don’t deploy via. Switchtower it just has a current directory that contains the 2.6.0 release. So, I renamed the folder and linked to it from current as follows (note this is within the domain’s directory):
mv current typo-2.6.0ln -s typo-2.6.0/ current
That ensured that I am now in a position to switch over to the edge revision whenever I want to.
Now, all I need to do is pull down the latest typo trunk as follows (again within the domain’s directory in my case):
svn checkout svn://leetsoft.com/typo/trunk typo-latest
That should display a little info about Subversion setting up your working directory, and at the end inform you which revision you’ve just checked out. Since at the time I did it, it reported revision 855, I then renamed `typo-latest` to `typo-rev-855`.
I then copied over my old `database.yml` configuration file, and double checked everything looked ok. As it did, I then performed the database migration:
rake migrate RAILS_ENV=production
You should see a little info as it goes through about what it’s migrating, and (assuming all went well) you should then be in a position to switch over from the 2.6 release to the trunk (again, within the domain directory for my setup):
rm currentln -s typo-rev-855/ current
Finally, I then gave Lighttpd a boot and watched it come back up. Although this worked in the main, I tried switching over themes and viewing the blog and came across some Rails errors. Checking in the `production.log` revealed the some entries such as:
Errno::ENOENT (No such file or directory -/var/www/servers/www.oobaloo.co.uk/current/cache)
Couldn't create cache directory: META/DATA/ACTION_PARAM/www.oobaloo.co.uk/articles/index/ (Permission denied - /var/www/servers/www.oobaloo.co.uk/current/cache/META)
To remedy, I created a cache directory with the necessary permissions for the app to write to, all now seems to be running well!