The Unfold deployment tasks

In the previous post I explained how to install and use Unfold, the PowerShell deployment solution for .net web applications. Several times I mentioned the default unfold tasks. That’s right, Unfold comes with a set of Psake tasks that are the framework for a typical deployment flow. In this blog post, we’ll explain the different tasks and how they cooperate to perform the deployment.

Let’s start by listing all of the tasks that are available for your deployment. Simply

.\unfold.ps1 -docs

This will print out a list of all tasks that you can invoke from the command-line. The deploy task is the most important one. It performs all necessary operations to fully deploy your application. This is an explanation of the subtasks that is it invokes. These tasks are simply defined using psake.

So if you execute

.\unfold.ps1 deploy -to staging

Then these are the tasks that get executed.

Set-Config scm git
Set-Config repository "git@github.com:your-account/your-repository.git"

Currently we support two scm’s: git and svn. We take pull requests for others.

It’s important to note that by default this fetch from source control happens on the deployment machine. So you have to make sure that your deployment machine can access source control (ssh keys, firewall restrictions, etc). This also means your code will also be built on the remote machine. If you don’t want code on the remote machine, you can force unfold to perform all tasks up to release to be executed on the local machine. To do so, add this to your deploy recipe.

Set-Config localbuild $true
Set-Config localbuildpath "c:\path\to\perform\local\build"
Set-Config msbuild @('.\code\path\to\your\Project.csproj')
Set-Config buildConfiguration "Release"

That’s all we need to know.

Set-Config iisname "www.yoursite.com"
Set-Config bindings @(
                      @{protocol="http";bindingInformation="*:80:www.yoursite.com"},
                      @{protocol="http";bindingInformation="*:80:yoursite.com"}
                     )

This IIS Name, is the name that’s used inside IIS, the bindings configuration defines the IIS bindings for your website. For more information on defining bindings, simply check the WebAdministration documentation.

Set-Config keep 10

Conclusion

You’ve now seen which steps Unfold performs in order to fully deploy your application. Most of them have options which you can simply configure using Set-Config calls.

It’s important to note that this flow is completely extensible. We’ll dedicate a future blog post to how you can create custom tasks and hook them to the default flow or how you can override them. By doing so, you can perfectly tailor deployments for your own needs.

comments powered by Disqus