More On Migrating From Drupal To Blogofile
I wrote an earlier post on converting a Drupal site to Blogofile. I couldn’t be happier with how that turned out as it allowed me to immediately start using Blogofile while still keeping my old Drupal content online. Sweet! But who wants to continue running the two systems in parallel forever? I certainly don’t, and after a code sprint I came up with a way to completely transition off Drupal.
First, I manually converted the most popular nodes on my Drupal site to Blogofile. I moved all of my Project content to GitHub, and wrote a Blogofile photo album that replaced 99% of the Drupal photo album functionality that I actually used. At the end of this process, there were only Blog, Story, and Page nodes left in Drupal.
Next, I changed drupalmigrate.py to generate a bunch of Blogofile post files for each of those remaining Drupal nodes. I added these settings to my _config.py:
controllers.drupalmigrate.makeposts = False controllers.drupalmigrate.mainusername = 'kirk' controllers.drupalmigrate.startpostnum = 1000
then ran “../bin/blogofile build -v” to create about 70 new post files. When that finished successfully, I removed those settings.
Finally, I added new code to drupalmigrate.py to generate a different set of RewriteRules that redirect the old Drupal node permalinks to their new Blogofile locations. It makes rules like:
RewriteRule ^/yet-another-python-map(/|$) /2008/04/16/yet-another-python-map/ [R=301,L]
controllers.drupalmigrate.makepermalinkredirs = True controllers.drupalmigrate.redirectrulefile = '_generatedfiles/redirectrewriterules.txt'
With this in place, there was nothing left in Drupal so I decommissioned it and changed my Apache configuration to something like:
<VirtualHost *:80> ServerName honeypot.net ServerAlias www.honeypot.net CustomLog /var/log/httpd/honeypot.net-access.log combined DirectoryIndex index.html DocumentRoot /usr/local/www/honeypot.net/honeypot/_site <Directory /usr/local/www/honeypot.net/honeypot/_site> Order Deny,Allow Allow from All </Directory>
RewriteEngine On Include /usr/local/www/honeypot.net/honeypot/_generatedfiles/redirectrewriterules.txt </VirtualHost>
I’ll leave the Drupal node redirects in there permanently so that all the links to my site will continue to work.