-
Notifications
You must be signed in to change notification settings - Fork 0
The Backup Module
This module is used when you want to perform a content backup of your IIS site before you deploy a new version to it. Internally it uses the Backup-WDApp Cmdlet and that in itself is just a fancy wrapper around the iisApp Provider.
First install via NuGet Install-Package WDP.Backup
.
Given that the WDP.Backup.psm1 script file exists in the same direcory from where you execute it here's a basic example that backups a local IIS site called test.xample.com
Import-Module .\WDP.Backup.psm1
Invoke-Backup test.xample.com
Below is a listing of all the conventions (the defaults) that we're using. If you don't like them just change them.
default: optional [not set]
We will backup the site on the local IIS server that the script is running on.
If you wish to backup a site on a remote, or several, server this property will contain an array of the paths to .publishsettings files that represents these servers.
default: .Backups
We will place all the backups in the current directory + a sub directory called Backups.
default: [set by TeamCity]
The default is if the code executes within TeamCity this parameter will default to true. Otherwise it's false.
It controls whether or not the backup file will be published as a build artifact in TeamCity.
default: [not set]
Custom Provider Settings that you can enable. Read more on the iisApp Provider.
default: [not set]
Folders you want to skip. TODO: add example
default: [not set]
Files you want to skip. TODO: add example
If you don't like the conventions (defaults) that we have setup you can always change them. The basic idea is that you'd call Set-Properties before invoking the function with a the keys and values you'd like to change.
This example backups a site on two remote servers and doesn't use TeamCity artifact publishing.
Import-Module .\WDP.Backup.psm1
Set-Properties @{
SourcePublishSettingsFiles = @(".\serverA.publishsettings",".\serverB.publishsettings")
PublishArtifacts = $false
}
Invoke-Backup
Important!!
In this situation, where no IIS application is specified as parameter to Invoke-Backup, the .publishsettings files need to include that information. Like this: