Migration: Re-Potting Your Site

   —   

When using Kentico, you may need to migrate your database, your website, or both to a different environment. If you’re feeling lost on where to start with this kind of project, this article should help.

Before starting, make sure both the source and target environments meet the system requirements for your version of Kentico. Then, you can begin.

First, open SQL Server Management Studio and create a backup of the database. Depending on whether you’re using AzureSQL or a standard SQL Server installation, this process may differ. For a standard installation, there is a Backup option in the Tasks menu that will create a .bak file, useful for moving databases between SQL servers. If you’re exporting from or importing to an AzureSQL instance, you can choose the Export data-tier application option instead.

Migration-0-backup.png

Now, copy the filesystem of your Kentico application into a zip file. (“Filesystem” includes the CMS directory, as well as all of its siblings, such as the Lib folder and the Solution file.) If you’re using the MVC development model, copy your MVC application to a zip file as well. Now you can move your zip file(s), along with the database backup to the new environment(s).

Once the database backup has been copied over, open SQL Server Management Studio.

  • If you have a .bak file,
    1. Right click on the Databases folder.
    2. Choose Restore Database.
    3. Tick the radio button for Device and click the button.
    4. Click Add, and then select your backup file.
    5. Click OK in the selection dialog, and again in the restore dialog.
  • If you have a .bacpac file,
    1. Right click on the Databases folder
    2. Chose Import Data-tier Application
    3. Go through the wizard.

Now you can unzip the filesystem(s) onto the new environment. In the web.config of each application, change the connection string to point to the newly copied database.

Once the connection string has been updated, the applications are ready to talk to the database. They just need to be set up in IIS, which can vary depending on your desired setup. A few of the common setups are described below:

  • If you want to set up a virtual application beneath an existing IIS site,
  1. Unzip the filesystem into that site’s directory, right click on the folder in IIS Manager, and choose “Convert to application.”
    Migration-1-convert1.png
  • If you want to set up a web site instead,
  1. right click on the Sites folder in IIS manager, and choose “Add Website.”
    Migration-2-convert2.png

Then in either case,

  1. Set the application pool that you want it to use, and save the changes.
  2. In the Advanced settings of the Kentico application, change the physical path to point to the CMS directory, rather than its parent.
    Migration-3-CMS.png
  3. If your Kentico instance is a web application project, open the solution in Visual Studio and run a Clean and Build.
  4. If you have an MVC application, open its solution in Visual Studio and run a Clean and Build.

Now the application should run, so you can log into Kentico and configure the settings. In particular, you may need to alter the domain settings, considering the DNS settings of the server you’ve moved to, as well as settings related to things like staging and external integrations relating to your environment.

This process will allow you to move your site to a new server, or make copies of your site for sandbox environments and testing. For example, it can be particularly useful if you’re trying to set up identical Kentico instances to configure staging. It can also come in handy when upgrading, as it allows you to perform the upgrade in a separate environment, then copy the upgraded project back to the original server afterwards.

I hope this helps! If you run into any Kentico issues during this process, you can reach Kentico Support here.

Share this article on   LinkedIn

Matthew Sandstrom

Hello! I'm a Technical Training Specialist here at Kentico.