Apr
17

Yesterday I posted about upgrading my blog to BlogCFC 5.9.3. How I went about the upgrade process is probably just as important as getting on the latest version. What follows is a run-down of how I upgraded, what tools I used to make it painless, and the SQL scripts I wrote you can use to get your own blog upgraded. Hit the more link for all the goodness.

Helpful Software

I always say you're only as good as the tools in your toolbox. If someone hits you with a question or problem and you can say: "I have a tool for that," then you have an appropriate response. Otherwise, you are setting yourself up for failure. The last time I upgraded my blog it took an entire day. Seriously, that's ridiculous. I spent one whole day comparing my code customizations against the latest code of BlogCFC's Subversion repository. I used some file/directory comparison tools, all of which were crap, which accounted for most of the headache.

This time around I did some serious research on Mac OS X file/directory compare tools and tried out several applications including: Beyond Compare (Windows) via CrossOver, Araxis Merge, Changes, and Xcode's FileMerge (the one I said was crap).

I'm a big fan of Beyond Compare and even purchased licenses for my entire development team (all on Windows, but me) so I was hopeful it would work well under CrossOver. It didn't. It crashed over and over when refreshing the compare view or trying to open a single file side-by-side view. Araxis Merge was a nice tool but I didn't spend too much time with it since you can't compare directories and files at the same time. At least, I couldn't figure out how. Every time you fire it up you have to select whether you want to compare a directory or a file and it doesn't appear to do file comparisons when you select "directory." As far as Xcode's FileMerge goes, I'm not even going to spend time on it. It's a piece of crap that no one should bother using. And please oh pretty please don't download the multi-gigabyte Xcode OS X development environment JUST to get FileMerge. Ack.

In the end, Changes sparkled as it sat in the spotlight-filled winner's circle. Until I found this application I was thinking there was no hope for OS X file/directory comparisons. I was pleasantly surprised by the ease of use, small footprint, feature set, and Apple-esque design. Changes works and it works REALLY well! It integrates with several text editors including BBEdit, TextMate, and TextWrangler, as well as source control software such as Subversion (my choice), CVS, Perforce, Git, and more.

It took me three hours to compare my entire blog code to Ray's blog code and that includes time to consider each difference and make a decision on how to proceed. After I was finished I could've just ignored the software and let the free 15 day trial expire. I was so impressed by Changes I immediately threw down the $50 to get a licensed copy.

For all database level introspection, script writing, and script execution I used Sequel Pro. It beats the pants off of the free GUI tools from MySQL (MySQL Query Browser and MySQL Administrator) though I had to use the MySQL Admin tool for one backup task. More on that later.

My Process

My upgrade process wasn't much different this time than before. I refreshed my localhost environment to ensure I had the latest and greatest code as well as a production copy of my current database. With this rolling, I refreshed my CFEclipse / BlogCFC / SVN project in order to get version 5.9.3 from Ray.

Next, I used Changes to synchronize the latest 5.9.3 code into my local 5.5 codebase. This took about 3 hours. To verify my blog was still working I switched the datasource in my blog.ini.cfm file to the default database that came from SVN for 5.9.3. I tested by creating and editing a few entries and everything was good. I had my code updated and working with a "known good" database.

The database synchronization wasn't too bad either. Ray's code ships with CREATE TABLE scripts for MySQL and SQL Server and I could easily generate CREATE TABLE scripts from my localhost 5.5 database. I compared the two versions and wrote ALTER TABLE statements to bring new columns, column changes, and indexes into my local 5.5 database. After double-checking all the scripts I executed them in Sequel Pro. Next, I switched my datasource back to the original setting, cleared the blog cache, and refreshed. No problems. No errors. It all worked. Sweet!

I now had a completely upgraded 5.9.3 codebase and MySQL database running on my Macbook Pro. Production changes would come next.

Before doing anything in production I prepared a few things. Sure this is only a blog we're talking about and not a business that makes millions but I don't care. My blog is kind of my baby and I don't want people seeing errors and craziness while I'm upgrading.

To accommodate this goal I created an HTML file called maintenance.cfm and saved it in my blog's home directory. I created the file by saving the generated HTML source code of the main page of my blog. Wanting the page to be a shell of sorts, with a simple maintenance message, I deleted all the HTML for the pods and other nonessentials. I updated Application.cfm with a "if we're in maintenance mode" conditional that cfincluded maintenance.cfm and then promptly cfaborted. The cfabort was harmless since maintenance.cfm is a fully functional and encapsulated HTML file. No bad HTML here. Why did I do this? Foresight. I knew it was going to take a while to upload all the code changes and execute the database scripts, and it did, about an hour.

I pushed the maintenance template and Application.cfm live essentially cutting my blog off from the rest of the world. I didn't want or need any entry views or comments to come in during the upgrade process.

The next thing I prepared was the database. I used MySQL's default Administrator GUI to connect to my remote MySQL server and backup all table schema and data.

With everything prepared it was FTP time. I nuked a good portion of the /blog folder on my server (a few things had to stay like the maintenance code) and started uploading all the new code. Following that I used Sequel Pro to connect to my remote database and execute all the ALTER TABLE scripts. Finally, I removed the maintenance conditional in Application.cfm, cleared the blog cache, and waited. It took about 2 seconds before a huge CF error was thrown in my face. Ouch, not good. To make a long story short, my hosting provider (this site is still not on my VPS) had my datasource set up using the default ColdFusion 7 MySQL 3.x driver. This driver doesn't play well with certain SQL statements ran against a MySQL 4/5 database. The problem was with the Recent Comments pod. I disabled the pod and notified the hosting company of the problem. The next morning they had my DSN updated to the 4/5 driver and I enabled the pod.

Overall, the process of upgrading was much smoother than last time. The best reason I have for this is the tools I used were simply better.

The SQL Scripts

Like last time, I'm making my SQL scripts available to everyone. I don't know how many people have found them useful but right now they have been downloaded 2,228 times. That's all the motivation I need to provide my 5.5 to 5.9.3 scripts as a download. You can get the scripts (with full, detailed documentation) by clicking here, or using the Downloads pod in the right margin.

What's Next?

With version 5.9.3 live I'll simply continue blogging. If you notice anything funky or out of place please let me know. You can use the "Contact Blog Owner" link in the footer (which is new) to send me an e-mail. If you're curious about what other features are new or what has changed, check out my previous blog post.

Aaron West's Gravatar
About this post:

This entry was posted by Aaron West on April 17, 2009 at 1:00 PM. It was filed in the following categories: ColdFusion, Subversion, BlogCFC, CFEclipse, SQL, Blogging. It has been viewed 7729 times and has 4 comments.

1 related blog entries

4 Responses to Upgrading to BlogCFC 5.9.3 - The Tools, The Process, The Result

  1. thanks, I'll have to do an upgrade too and have been avoiding it... I'm on 5.5 too and have recently upgrade MySQL from 4.x to 5.x which introduced some weird date issue already. My knowledge is not quite up to the task of fixing that so now every time I post a new blog post I need to manually swap the day and month over. Not sure where and how to fix that but I can tell it'd be easy if I knew :-)

    Have you used Navicat on OSX for administering MySQL? I quite like it. It has it's issue but backups for example are really simple with it.

  2. @Stefan I used Navicat several years ago but not since. At the time it was a great administration app for MySQL but I believe it was a paid app. I'm not sure why I didn't stick with it. I don't mind paying for apps if they're great (like the Changes compare app).

  3. gerald guido's Gravatar gerald guido

    Thanx Aaron. Worked like a charm.

  4. I recommend free MySQL-manager for OSX - Valentina Studio, check it out if you haven’t tried it yet: http://www.valentina-db.com/valentina-studio-overv...

Leave a Reply

Leave this field empty

If you subscribe, any new posts to this thread will be sent to your email address.

RSS