I have used TDS for most of my packages for deployment or creating modules for co-workers and friends. TDS is great at creating update packages. Is there a process to take all Unicorn items and convert them into a Sitecore package?
As far as I know, I can say no there isn't at this point. Please correct me if I am wrong someone. However you can do the following to deploy sitecore items.
With Unicorn you've got two options for automated deployment of item changes, for example from a Continuous Integration server or production deploy scripts.
Use Transparent Sync
When using Transparent Sync, the items on disk magically appear in Sitecore without syncing. So one automated deployment option is to simply use Transparent Sync and copy your updated serialized items to the deployment target alongside your code. This is advantageous because it's simple to set up and requires no direct intervention with the deployed server after deployment (e.g. a HTTP call).
Use the Automated Tool API
Unicorn has an automated tool API whereby you can invoke actions in the Unicorn control panel from a script, such as invoking a sync after a code deployment.
NOTE: Automated Tool API is completely overhauled in Unicorn 3.1, and these instructions are for 3.1 only
Tools are authenticated using a shared secret between the tool and the Sitecore server running Unicorn, which is relayed via CHAP+HMAC-SHA512. The practical upshot of this is that the shared secret never travels over the wire, the authentication key is unique every time, and replay attacks are not possible. You should still use the tool API over a TLS connection if possible.
Calls to the control panel from an automated tool behave a little differently from interactive control panel sessions. Specifically:
- Automated calls are not streaming (nothing is written to the response until everything is complete)
- Automated calls return HTTP 500 if an error occurs (interactive calls that fail return HTTP 200, because the HTTP headers have been sent long before the error occurs). In the example PS script above, this will throw a PowerShell exception.
- The output is text formatted, instead of HTML formatted, so it is much easier to read in logs.
Ok, ok. Shut up about crypto and tell me how to set it up.
- Generate a very long random shared secret key, preferably using a password generator. There are no limits on character count, character types, etc but it must be > 30 characters.
- Install the shared secret into the
Unicorn.UI.configfile - or a patch thereof, under the
authenticationProvider/SharedSecretnode. There are comments to help.
- To call the tool API from a script, a PowerShell module is provided. Acquire the module and its supporting files from the
doc\PowerShell Remote Scriptingfolder of the Unicorn git repository.
- Review the
sample.ps1file and adapt it to your needs, including putting the shared secret into it and setting the URL as needed. Don't worry the guts of
sample.ps1are two simple lines of code :)
NOTE: When deploying to a Content Editing or Content Delivery server, the Unicorn configuration should be trimmed down from development. Each config file in
App_Config/Include/Unicorn has comments at the top designating what environment(s) it should live on. If you opt to use Transparent Sync as a deployment mechanism, make sure you do not disable the data provider config file.
Darren Guy has written a practical dissertation on his experiences setting up Unicorn 3 with TeamCity and Octopus Deploy that goes all the way from install to automated deployment. A recommended read if you're wanting to use a similar setup.
Andrew Lansdowne has also written a post (for version 1, so some of it is outdated but the concepts still apply) about setting up Unicorn with TeamCity and WebDeploy that may be useful when setting up automated deployments.
For anyone coming to this question far in the future, you can explicitly combine your Unicorn configuration into a package with SPE
# Create a new Sitecore Package (SPE cmdlet) $pkg = New-Package # Get the Unicorn Configuration(s) we want to package $configs = Get-UnicornConfiguration "Foundation.*" # Pipe the configs into New-UnicornItemSource # to process them and add them to the package project # (without -Project, this would emit the source object(s) # which can be manually added with $pkg.Sources.Add()) $configs | New-UnicornItemSource -Project $pkg # Export the package to a zip file on disk Export-Package -Project $pkg -Path "C:\foo.zip"