Blog

Sitecore Package Deployer

September 08, 2015 | Charlie Turano

Introduction

One of the coolest features of TDS is its ability to automatically generate Sitecore update packages as part of a build process. Our users occasionally email our support staff about automating the deployment of the update packages. In the past we have recommended using Sitecore ship or our Update Package Installer service. Both of these solutions require the deployment process to make HTTP requests to the Sitecore server, which require some additional deployment steps. The Sitecore Package Deployer simplifies this process.

Sitecore Package Deployer

The Sitecore Package Deployer uses a Sitecore Job to automatically deploy update packages that have been copied into a folder on the Sitecore server. This reduces the complexity of deployments because copying files to a web server is already something the deployment process does.

Description

There are three components that the Sitecore Package Deployer module uses to install update Packages. These components work together to deploy the Sitecore update package.

The first component is a scheduled task run the by the Sitecore task agent. This task runs one per minute and looks for packages in a folder specified by the configuration setting SitecorePackageDeployer.PackageSource. When an update package is found, it is installed using the Sitecore update API.

The second component is a pipeline step in the shutdown pipeline. This step sets a flag in the package installer task to indicate Sitecore is shutting down. The installer needs to know this so it doesn't attempt to run the update package post install steps until Sitecore restarts. If Sitecore is shutting down, the installer task creates a file in the SitecorePackageDeployer.PackageSource folder indicating the update package needs to have it's post steps executed.

The last component is a pipeline step in the initialize pipeline. This step looks for a file in the SitecorePackageDeployer.PackageSource folder that indicates the post steps for the update package need to run. If the file is found, the post steps are run as Sitecore is starting up.

Operation

To use the Sitecore Package Deployer, simply copy your update packages into the folder you have configured in SitecorePackageDeployer.PackageSource. I recommend you use a location in the /data folder, since it will have all the correct permissions needed to install the package.

If there are changes to the Sitecore configs or binaries during the installation of the package, the IIS AppPool will be recycled. The Sitecore Package Deployer is aware of this and will finish processing the update package when Sitecore restarts. This same process is how the Update Installation Wizard handles these scenarios.

If Sitecore is restarting, the Sitecore Package Deployer will make an HTTP request to the cms website just before shutting down to attempt to restart the server automatically. In some cases, the url for the server can't be determined, so the url from the setting SitecorePackageDeployer.RestartUrl is used instead.

Config files

One of the most popular questions the TDS support team receives about update packages questions the way Sitecore handles config files. When the update package installer determines that a config file needs to be replaced, the Sitecore installer creates config with a new name and leaves the original file in place. The replacement of the file is done manually by the developer performing the install. This makes it much more difficult to automate the installation process.

To make the deployment fully automatic, the Sitecore Package Deployer finds the new .config file(s), makes a backup of the existing .config file(s) and performs the replacement automatically. This happens before the post steps are run, and will cause the AppPool to recycle.

Installing the Sitecore Package Deployer

The Sitecore Package Deployer is distributed as an update package. You can find the update package in the root of the GitHub project. This is an update package and can be installed using the Update Installation Wizard in Sitecore. Once it is installed, the deploy folder will automatically be created in the default location of $(dataFolder)\SitecorePackageDeployer. Simply drop your update packages in that location and they will be automatically installed.

The Sitecore Package Deployer has been tested with the latest version of Sitecore 7.0, 7.1, 7.2, 7.5 and 8.0

If you wish to download the complete source, it can be found in our GitHub at: Sitecore Package Deployer

Continuous Integration Best Of TDS 2015

Related Blog Posts

Setting Visual Studio Online up with TDS
More and more people are starting to use Visual Studio Online. Since TDS 5.0, we supported use with Visual Studio Online. The set up; however, is a bit different with VSO than your local installation. This post will explain how to set up TDS within Visual Studio Online.
Custom TDS Validators
One of the coolest new features of TDS 5 was Validators. Validators allow a developer to have the build automatically check the Sitecore items in the TDS project against specific criteria and generate warnings or errors if the item meets the criteria. This blog post will document the process of setting up your own custom validator.
Enabling HTTPS Support in TDS
A lot of people ask about leveraging a HTTPS connection between their machine and the server. This connection is fully supported, out of the box with TDS. To implement this type of connection you simply need to make sure your certificates are properly managed.
Setting Up Authenticated Access with TDS
Every now and again TDS users want to use an authenticated connection to the server. A majority of our users use unauthenticated, but we still need to support authenticated connections. Setting up an authenticated connection is simple and only requires a few additions to your TDS .config files.