Developer | Gamer | Bogan
 

How I migrted to FunnelWeb from WordPress

So as mentioned previously, I migrated my blog from WordPress to FunnelWeb - in this post I'm going to explain the steps I went through to get from the idea of moving the blog, to the text you're reading on your screen right now.

Getting the code

FunnelWeb is an open source project, hosted on BitBucket - so the first step was getting myeslf a copy of the code to be able to play around with. Given that I had no experience with mercurial before this, I had to do a little bit of playing around with things to get it all sorted. I began by installing TortoiseHg to give me a GUI, and then creating a clone of the repository locally on my laptop.

hg clone https://bitbucket.org/FunnelWeb/release

I did this part via the command line tool, but after a while it had downloaded my clone of the repository and I could attempt to run the tool locally

Customising my install

So before I rolled it out, I wanted to customise a few things about the app - all of which were essentially look and feel realted. To achieve this, I created myself a new theme to apply to the blog (this meant all my customisations would be in new files rather than modifying existing files, which would mean that it would be easier to merge changes in to the app later on). I created myself a new folder under src\FunnelWeb.Web\Themes called BrianFarnhill, and the added myself a style sheet, some images and then added a few views to overwrite the out of the box ones where I needed to make minor HTML changes.

Hosting and deploying

Once I was ready to try pushing it out I had a look around at hositng options, and I was recommended to look at AppHarbor. Appharbor is a great way to host .NET applications and it does some very cool stuff around running tests and deploying files to the web servers for you. So to get my code on to thier servers I needed to push it to somewhere that they could deploy from. I decided to push mine to a private repo on BitBucket (so seperate from the main FunnelWeb one that I got the code from) and have it deploy from there. There is a good guide on Appharbor about how to do this, but basically the premise is that you grant read only access to the AppHarbor account and add a POST request to the BitBucket actions for what happens on a commit. This means that when I do a push, BitBucket will let AppHarbor know and they will grab the code, build it and run tests and if the tests pass, deploy the files to the web server.

I did add the SQL Server add on to my AppHarbor app which gives me 20MB worth of database space to run the application. It's important to keep in mind that with Appharbor everytime they deploy your app they wipe out the files on the server and replace it with the build output. Having the database meant that my blog posts were protected from being wiped out - but I needed an alternative for images and attachments. From another recommendation I looked at RackSpace's CloudFiles. This was a dirt cheap way of hosting files in the cloud, and using a tool like CyberDuck it's easy to upload them and then the files are published across the Akami CDN as well. So I got that set up and moved all my attachments to that.

Configuration

To get my app playing nice in both the local install and the remote AppHarbor install I needed to be able to tweak the config files use use configuration transformations. FunnelWeb puts some of its config in the "my.config" file, things like admin username, password and SQL connection string. So I created my.Debug.config and my.Release.config and used some transformations in there so that AppHarbor would be able to resolve the release settings for it's deployment and locally it would use the default settings in the my.config file. In the release file I had the following code:

<?xml version="1.0" encoding="utf-8"?>
<funnelweb xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <setting key="funnelweb.configuration.database.connection" value="[my connection string]" xdt:Locator="Match(key)" xdt:Transform="Replace" />
    <setting key="funnelweb.configuration.authentication.username" value="[My username]" xdt:Locator="Match(key)" xdt:Transform="Replace" />
    <setting key="funnelweb.configuration.authentication.password" value="[my password]" xdt:Locator="Match(key)" xdt:Transform="Replace" />
</funnelweb>

The xdt tags are used to dictate how the tags should be merged in to the original config. Each tag I specifiy that they should replace a tag in the source, and that tag should be found by matching the 'Key' attribute.

Migrating content

Once I had the code running I needed to work out how I could move the content I had in my existing blog across to this new one. FunnelWeb has a BlogML import option, so I needed to get the content across. I spoke about the tool I wrote for this (called WXRtoBlogML) in my previous post so I wont elaborate on it too much.

Issues I came across

Once I got the content in to the new blog, I did still have some issues to address before going live - and these were all to do with content and stemmed from decisions I made many moons ago when working with the very first version of my blog which ran on Windows Live Spaces. To get my source code to appear formated in that blog I used a tool which generated the HTML styles needed from the source code, and it saved the HTML. This was great at the time, but when it came to using this elsewhere it was painful. I needed to manually clean up a lot of this rubbish as when I tried to run it through a couple of tools it all went a bit pear shaped. So I spent a lot of time working to manually clean up my posts and convert them all from HTML to Markdown. As part of this I cleaned up source code, uploaded images to my CloudFiles account, and corrected any tags and added introductions to each post. This was the most painful and time consuming part of the migration, and looking back I should have automated some of this, but oh well - it's done now.

The other issue I found (and in honesty was too lazy to solve) was around having AppHarbor run the unit tests for FunnelWeb - it was always failing them, and it's because there was no SQL express install for it to test those methods against, meaning that it would always fail no matter what. To get around this I basically got AppHarbor to ignore the tests all together (told you it was lazy!). If you create a solution file called AppHarbor.sln it will be the solution that gets build in place of any other solution file in the code repository. So I copied the original solution file, renamed it and then took out the test project. Cheating, I know - but it got it going and I can run the tests locally to be sure that I haven't broken anything major (I know the tests should be running in Appharbor to ensure there are no environment specific things affecting them, but whatever!)


So that's the gist of the process involved in moving from WordPress to FunnelWeb - hopefully it will help others who are thinking about making the move. I've got a bunch of ideas of things I want to do with the blog now I have control over the source code. It's also proving to be a neat way for me to start understanding ASP.NET MVC3 as well, so it's all a winner in my book!

FunnelWebAppHarborBitBucket
Posted by: Brian Farnhill
Last revised: 29 Jan, 2012 05:35 AM History

Comments

09 Sep, 2012 05:14 PM

Hi Brian,

I would like to migrate my wordpress blog to Appharbor and I am following your suggestions. I have success to deploy it, but I don't know how keep secret the username/password in my.config.

I would like to keep public my repository on bitbucket, but in this case everyone could read password.

Appharbor has an interesting feature to add configuration variables but it is only for web.config appsettings.

Do you solve this problem?

Thanks

Giorgio

No new comments are allowed on this post.