Monday, October 15, 2012

My experiences from migrating EPiServer Relate+ 1 to EPiServer Relate+ 2

Recently I’ve been migrating an EPiServer Relate+ 1 site to EPiServer Relate+ 2, and I think it might be useful for others contemplating doing the same to get an overview of the troubles I had on the way.

First of all, some background information. The website I migrated was based on the Relate+ 1 template package, with some modifications and additional integrations. I decided to go through with the migration in the following steps:

1) Migrate both database and code in the development environment. I then did some brief testing to ensure that all data had been migrated.

2) Migrate the database in the test environment, and then deploy the code from step 1. I then let the customer test the site thoroughly while I did some bugfixing.

3) Migrate the database in the production environment, and then deploy the code from step 1.

Useful resources:

My main resource for migrating the site was the ”Migrate EPiServer Relate+ to EPiServer Relate+ 2” article written by Klas Wikström. What I especially appreciated about his way of doing it was that you end up with two databases, one for CMS content and one for Community content.

When it came to the code migrations needed in order to make the site run on Community 4, I was in for quite a surprise as there were a lot of them! Some I could fix with a simple “Find and Replace”, but unfortunately many of them involve changes in method definitions, for example where the parameters have switched places. Either way, the “EPiServerCommunity code migration” section of the “Migrating EPiServer Community 3.2 to 4.0 and EPiServer Mail 4.4 to 5.0” tech note will tell you everything you need.

Bumps in the road:

1) SQL Error when running the “migration_tool.sql” script:

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tblEPiServerCommunityClubMember_tblClub". The conflict occurred in database "dbFKWorldCommunity", table "dbo.tblEPiServerCommunityClub", column 'intID'.
The statement has been terminated.”

I got about 5 of these errors the first time I ran the migration script. After a couple of rollbacks and some debugging, I figured I could change the failing script from “SELECT intID FROM” to “SELECT TOP 1 intID FROM”. Turns out the script expects one record, but in my case several were found. So I rewrote the script a bit, if you want to take a look at it you can find it here (note: I cannot guarantee that this will work for you, but for me it did the trick).

2) Error when installing a new Relate+ 2 site:

Error - Exception calling ‘WorkerProcessAccounts’ with ‘1’ argument(s): ‘Invalid application pool name’

I found the solution for this error on the forum (see Tommy’s solution).

Final words of advice:

1) Document every single step on the way! As I, in reality, did the migration three times (once in each environment) it was very useful to keep a journal of every single step on the way to make sure I didn’t forget a small detail.

2) Backup your database before you start a new step! There are quite a lot of things that can go wrong, and I had to roll back three or four times during the first migration. If I’d forgotten a database backup, I would have been in a lot of trouble.

3) Take your time! A migration is not something you do in a couple of hours. This migration included moving the site into a new environment which took some extra time, but still you should set aside at least a day per migration (and that’s not including code migrations).

4) Breath. The migration script can run for ages while you bite your nails wondering if you’re about to mess everything up. Go get a coffee, don’t sit there staring at the “Executing query” message waiting for it to explode. Most likely, everything will be fine.