Monday 20 June 2011

Upgrading an EPiServer CMS 5 site to EPiServer CMS 6

Overview

I've built a few websites in the EPiServer CMS now, and because I've developed those websites in quick succession, I have rarely needed to use the deployment center's upgrade wizard.

I've recently had to upgrade an EPiServer site from version 5R2SP1 to version 6, and had to initally provide a scope for any areas that might go wrong.

The upgrade wizard's upgrade process makes changes to the EPiServer database, adds some extra files to the site's /bin/ directory, and also makes some fairly significant changes to the web.config.

Changes to the file system are quite easy to spot (the upgrade wizard produces a log file for your perusal), but the major issue that I encountered with upgrading was changes made to the database.

The problem

When hosting an EPiServer website on one server and the database on a separate server, the upgrade wizard must make modifications to the data on both servers. The upgrade wizard is part of the deployment center, and so changes to the filesystem were done with no problem. However, the upgrade wizard kept throwing an error complaining that it couldn't connect to the database, and that authentication failed. This is because unless your servers are hosted on the same domain, your windows account is unlikely to be authenticated. Regardless of whether you specify windows authentication or sql authentication with the SA password, you'll get the same problem.

There are two main methods for working around this problem, namely a manual upgrade using SQL scripts, or the method I chose.

For the manual upgrade, you can see Bjorn Isaksen's blog on it here:
Upgrade EPiServer database manually from 5 to 6

The solution

The method I chose was to do the following:

1) Ensure a code and CMS freeze to ensure that no data is updated and no content is updated during the upgrade.

2) Take a copy of the live database, and restore it to our development server.

3) Take a copy of the latest development code, happy that this is a codeset you're okay to go live with.

4) Set this copy of the code up in IIS as a separate EPiServer site.

5) Point the connection strings in that copy to point to your newly restored EPiServer database.

6) Run the upgrade wizard, following the prompts and ensuring that the upgrade's successful.

7) Publish the newly modified code (whether you export that from your source control directory, or build it manually, it's up to your current development process model).

8) Attach the new database from your development site to the user acceptance testing database server (essentially your backup copy of the live site). I restored this to a fresh database so that I could have a clean swap in the connectionstrings.config file.

9) Upload the code to the user acceptance testing development server.

10) Change the connectionstrings.config file to point to your newly restored database.

I then tested the functionality of the site to ensure that everything was behaving as it should, and hey presto! One upgraded site!

Reference

For further information on the upgrade process and what's involved in the filesystem changes, you can see Fredrik Haglund's blog here:

Configuration management and EPiServer CMS 6

No comments: