If you see this, you’re looking at all of my old site’s content running on my self-hosted WordPress server… Phew!
I think that’s enough for tonight, but there will be more soon. I’ve got a bunch of details I want to write up about this project. Plus now that I have the tools I wrote to migrate from Manila to WordPress, I’ve got a bunch of other old content I want to migrate.
I suppose I should first figure out some redirects though, at least so my RSS subscribers don’t all break.
Stay tuned… 😉
Ps. All of the <guid>’s in my feed are now changed to a new format. I apologize that your RSS aggregator is probably about to freak out now. Fixing this was sadly not worth the effort at this point. 🙁
Pps. I realize it’s now 4:30 am, but I couldn’t let my links rot. I modified my WordPress permalink format to make legacy incoming links continue to work. I still need to do some testing, but for the moment things are much better than having basically every incoming permalink go 404.
This is something I have been wanting to do in my spare time for many months now — probably two years or more. But with family and work obligations, a couple of job changes, and a move from Woodinville to Seattle last fall, carving out the time to do this well was beyond my capacity.
Now that I’m recently between jobs, the only big obligation I have outside of spending time with my wife and son is to find another job. Some learning can’t hurt that effort. Plus I seem to have a surplus of spare time on my hands right at the moment.
Managed or Self-hosted?
The first question I needed to answer before even starting this process is whether I want to host on a managed service (most likely WordPress.com), or if I should self-host. There are trade-offs either way.
The biggest advantages of the managed option come from the very fact that the servers are run by someone else. I wouldn’t have to worry about network outages, hardware failures, software installation and updates, and applying an endless stream of security patches.
But some of the same features which are good if I were to go with a hosted solution, are also limiting. I would have limited control over customization. I wouldn’t be able to install additional software along-side of WordPress. I would be limited to the number of sub-sites I was willing to pay for. I wouldn’t necessarily have direct access to the guts of the system (database, source code, etc).
Most importantly, I wouldn’t be in control of my web presence end-to-end — something which has been important to me ever since I first started publishing my own content on the Web in 1997.
There’s one more advantage of self-hosting which is important to me: I want to learn how WordPress itself actually works. I want to understand what’s actually required to administer a server, and also start learning about the WordPress source code. The fringe benefit of this is also learning some PHP, which while some web developers prefer alternate languages like Ruby, Python, or Node.js, the install-base of WordPress itself is so enormous, that from a professional development perspective, learning some PHP is a pretty sensible thing to do.
I decided to go self-hosted, on my relatively new Synology DS-412+ NAS. It’s more than capable of running the site along with the other services I use it for. It’s always on, always connected to the Internet, and has RAID redundancy which will limit at least somewhat, the risks associated with hardware failure.
Develop a Strategy
The next thing I needed to work out was an overarching plan for how to do this.
Aside from getting WordPress installed and running on my NAS, how the heck am I going to get all the data ported over?
First, I made a list of what’s actually on the site:
A bunch of blog posts (News Items) sitting in a Frontier object database
Comments on those posts
A small amount of discussion in the threaded discussion group
User accounts for everyone who commented or posted in the discussion group
A bunch of pictures and other media files
A few “stories”
Some “departments” that blog posts live in
A site structure that put some pages on friendlier URLs
Logs and stats that I don’t care much about
A sub-site I never posted much to, and abandoned years ago
For the most part, there aren’t any types of information that don’t have an allegory in WordPress. News items are blog posts, comments are comments, stories are pages, pictures are image attachments, departments are categories. The stats and logs I’m happy to throw away. Not sure what to do with the site structure, but if push comes to shove, I can just use .htaccess files to redirect the old URLs to their new homes.
Next I needed a development environment — someplace where I can write and refine code that would extract the data and get it into WordPress.
On the Manila side, I did some work a little over a year ago to get Manila nominally working in Dave Winer’s OPML editor, which is based on the same kernel and foundation as UserLand Frontier, over which Manila was originally developed. The nice thing about this is that I have a viable development environment that I can use separately from the Manila server that’s currently running the production site.
On the WordPress side it makes sense to just host my development test sites on my MacBook Air, and then once I have the end-to-end porting process working well, actually port to my production server — the Synology NAS.
Leaving the media files and comments aside for a moment, I needed to make a big decision about how to get the blog post data out of my site, and into my WordPress site. This was going to involve writing code somewhere to pull the data out, massage it in an as-yet unknown way, and then put it somewhere that WordPress could use it to (re-)build the site.
It seemed like there were about five ways to go and maybe only one or two good ones. Which method I picked would determine how hard this would actually be, how long it might take, and if it’s even feasible at all.
Method 1: Track down Erin Clerico
A bunch of years ago, Erin Clerico (a long-time builder and hoster of Manila sites in the 2000’s) had developed some tools to port Manila sites to WordPress.
As it turned out, a couple years back I’d discussed with Erin the possibility of porting my site using his tools. Sadly he was no longer maintaining them at that time.
If I remembered correctly, his tools used the WordPress API to transmit the content into WordPress from a live Manila server — I have one of those. It might be possible, I thought, to see if Erin would share his code with me, and I could update and adapt it as necessary for my site, and the newer versions of WordPress itself.
But this was unknown territory: I’ve never looked at Erin’s code, know very little about what may have changed over the years in the WordPress API, and don’t even know if Erin still has that code anywhere.
Method 2: Use the WordPress API
I could of course write my own code from scratch that sends content to WordPress via its API.
This would be a good learning exercise, since I would get to know the API well. And the likelihood that WordPress will do the right thing with the data I send it is obviously pretty high. Since that component is widely used, it’s probably quite well tested and robust.
This approach would also work equally well, no matter where I decided to host the site — on my own server or whatever hosted service I chose.
But there potential problems:
Manila/Frontier may speak a different dialect on the wire than WordPress — I haven’t tested it myself.
Client/server debugging can be a pain, unless you have good debugging tools on both sides of the connection. I’ve got great tools on the Manila side, but basically no experience debugging web services in PHP on the WordPress side.
It’s likely to be slow because of all the extra work the machines will have to do in order to get the data to go between the “on-the-wire” format and their native format. (This will also make debugging more tedious.)
Method 3: Use Manila’s RSS generator
Of course Manila speaks RSS (duh). And WordPress has an RSS import tool — Cool!
In theory I should be able to set Manila’s RSS feed to include a very large number of items (say 5,000), and then have WordPress read and import from the feed.
The main problem here is that I would lose all the comments. Also I’m not sure what happens to images and the like. Would they be imported too? Or would I have to go through every post that has a picture, upload the picture, and edit the post to link to the new URL?
I’m less worried about the images, since I can just maintain them at their current URLs. It’s a shame not to have real attachment objects in my WordPress site, but not the end of the world.
Loss of the comments however would be a let-down to my users, and would also limit the export tool’s potential usefulness for other people (or my other sites).
Method 4: Make Manila impersonate another service
In theory it should be possible to make Manila expose RPC interfaces that work just like Blogger, LiveJournal, or Tumblr. WordPress has importers that work with all of these APIs against the original services.
Assuming there aren’t limitations of Frontier (for example no HTTPS, or complications around authentication) that would prevent this from working, this should get most or all of the information I want into WordPress.
But there are limitations with some of the importers:
The Tumblr importer imports posts and media, but I’d lose comments and users (commenters’ identities)
The LiveJournal importer seems to only understand posts
The Movable Type and TypePad importer imports from an export/backup file, and understands posts and comments, but not media
The only importer that appears to work directly from an API, and supports posts, comments, and users is the Blogger importer. (It doesn’t say it’ll pick up media however.)
In the Movable Type / TypePad case, I’d have to write code to export to their file format, and it’s not clear what might get lost in that process. It’s probably also roughly the same amount of work that would be needed to export to WordPress’ own WXP format (see below), so that’s not a clear win.
When it comes to emulating the APIs of other services (Blogger, Tumblr, LiveJournal), there’s potentially a large amount of work involved, and except for Blogger, there would be missing data. There’s also the non-trivial matter of learning those APIs. (If I’m going to learn a new API, I’d rather learn the WordPress API first.)
Method 5: Make Manila pretend to be WordPress
While researching the problem, I discovered quickly that WordPress itself exports to a format they call WXR, which stands for WordPress eXtended RSS. Basically it’s an XML file containing an RSS 2.0 feed, with additional elements in an extension namespace (wp:). The extension elements provide additional information for posts, and also add comments and attachment information.
On first glance, this seemed like the best approach, since I wouldn’t be pretending to understand the intricacies of another service, and instead would be speaking RSS with the eXtended WordPress elements — a format that WordPress itself natively understands.
Also since I’m doing a static file export, my code-test-debug cycle should be tighter: More fun to do the work, and less time overall.
Method 6: Reverse-engineer the WordPress database schema
I did briefly consider diving into MySQL and trying to understand how WordPress stores data in the database itself. It’s theoretically possible to have Manila inject database records into MySQL directly, and then WordPress wouldn’t be the wiser that the data didn’t come from WordPress itself.
This idea is pretty much a non-starter for this project though, for the primary reason that reverse-engineering anything is inherently difficult, and the likelihood that I would miss something important and not realize it until much later is pretty high.
Time to get started!
I decided on Method 5: Make Manila pretend to be WordPress. It’s the easiest overall from a coding perspective, the least different from things I already know (RSS 2.0 + extensions), and should support all of the data that I want to get into WordPress from my site. It also has the advantage of being likely to work regardless of whether I stick with the decision to self-host, or decide to host at WordPress.com or wherever else.
Implementing the Blogger API was a close second, and indeed if Manila still had a large user-base I almost certainly would have done this. (There are many apps and tools that know how to talk to Blogger, so there would have been multiple benefits from this approach for Manila’s users.)
In the next post I talk about some differences between the way Manila and WordPress store data, and some requirements that surfaced while investigating how to export data from Manila to WXR.
There are super-simple instructions there (scroll down) for adding a modal or banner to your site, to show your support. The modal like the one you saw here is best because visitors to your site can very easily add their names to the letter for congress, and also get connected to their representative by phone–without even having to dial. Either way all it takes is a few lines of HTML code in your site’s <head> element.
The Web and indeed the Internet as we know it today wouldn’t exist if it weren’t for equal access to bandwidth without the throttling and corporate favoritism that the big ISPs and carriers are lobbying for. Without Net Neutrality, we will be forced to pay more for services we love, and miss out on continued incredible innovation that’s only possible if new and small players have the same access to Internet bandwidth as the BigCo’s.