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.
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 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.
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.
1 related blog entries
- Now Running BlogCFC 5.9.3 (April 16, 2009)