It’s going to be a rainbow and unicorns kind of day – Ride the Sitecore Unicorn on a rainbow!

Alright let’s address the elephant in the room! Kam Figy is not the creator of Unicorn, Kamruz Jaman is. This post is not mean to sing praises of Unicon or the Kams as we callz it. It is mainly to show how we use Unicorn to build our end to end deployment from a dev machine to the production CD’s using Unicorn for serialization.

If I have not said so before, I love VSTS and Octopus Deploy. I am not a master of either but I got a great deal of experience in the past year setting them up. I will follow up this blog post with Octopus posts but this one is reserved for Unicorn.

Unicorn != TDS && TDS != Unicorn. This has been said multiple times. Each has a few features which are common but they have their own set of features. TDS being that its a paid product has a lot of great features especially to do with deployment, builds etc.

So lets start. First you install Unicorn from NuGet:

Install-Package Unicorn -Version 3.3.2

This installs a set of configs and adds appropriate references to your project. If you plan on serializing roles, you would also need Unicorn.Roles:

Install-Package Unicorn.Roles -Version 3.3.2

By default, Unicorn provides sample configurations. Here are some I use:

XHTML

1

2

3

4

5

6

7

8

9

10

11

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">

<sitecore>

<!-- A source folder param to be used later to specify folders where serialization will store files -->

Will result in writing your shared secret to the logs as part of the signature base,

so disable it unless you're debugging failed authentications.

-->

<WriteAuthFailuresToLog>true</WriteAuthFailuresToLog>

</authenticationProvider>

</unicorn>

</sitecore>

</configuration>

I make sure that the config transforms locally point to the local serialization folder outside of the wwwroot on my dev box. This helps a lot in structuring your configs on all the environments. Using Octopus, we set the path for the serialization folder dynamically.

For your deployment:

Package code and serialization separately in to different Nuget Packages. I use Nuspec files with Octopus Deploy.

Once code is deployed, make sure you remove the Unicorn.DataProvider.config file from the destination CD/CM so that Unicorn does not serialize on those servers.

Make sure the serialization folder on the destination system is wiped before your add it via Octopus or any other deployment tool.

Deploy the serialization Nuget package.

Use PowerShell to sync Unicorn serialized files automatically as part of your deployment process on the CM instances.

On CD’s remove the Rainbow.config and Project.Unicron.Serialization.config files.

Since we deployed this 5 months ago, we have not touched it. We run through a few hundred deploys per week.

From dev to prod, we do not do any manual steps, everything is handled by Octopus and so far we have not yet gotten any Unicorn issues. If you do end up with an odd situation, Kam is reachable on the Sitecore Slack and he is very responsive.

If you have any questions or concerns, please get in touch with me. (@akshaysura13 on twitter or on Slack).

no comment

This is a personal blog. Any views or opinions represented in this blog are my own and do not represent those of people, institutions or organizations that the I may or may not be associated with in professional or personal capacity including past, current and future employers, unless explicitly stated.