-
Notifications
You must be signed in to change notification settings - Fork 3
Getting Started
It's easy to get rolling with Powerdeploy. This tutorial will get you from build to a working deployment in a few minutes.
This tutorial assumes that you have installed the Powerdeploy PowerShell module. If you haven't, install it now.
You'll obviously need something to deploy for Powerdeploy to be useful to you. Any application can be deployed, but some common ones are:
- Windows services
- Web applications
- Console applications
The tutorial uses the showconfig.exe application in the examples\tutorial\compiled folder included with the Powerdeploy module (you'll need to remember where you installed it). You can also use your own application if you'd like, just make sure you adjust the steps as necessary. The application is compiled from examples\tutorial\showconfig.cs and you can compile it on your own if you aren't the trusting type.
Powerdeploy expects your files to be structured a certain way within the deployment package. The only hard requirement is that you have a content folder with your application binaries in it. Let's set up a simple structure that we can use to create a package.
Create a staging folder for the files to be packaged
md c:\temp\package
Add a content folder (this is where your application will go)
md c:\temp\package\content
Add the application content
cp c:\temp\modules\powerdeploy\examples\tutorial\compiled\* c:\temp\package\content
Before you can can use Powerdeploy to create a package, you'll need to make sure that the module is loaded.
Import-Module powerdeploy
Once the module is loaded, use New-DeploymentPackage turn your your staging folder into a package.
New-DeploymentPackage `
c:\temp\package ShowConfiguration 1.2.3 `
-OutputDirectoryPath c:\temp
You should now have a new file called PD_ShowConfiguration_1.2.3.zip in c:\temp.
You could create the zip file yourself, but the cmdlet does some verification and will ensure everything gets packaged up and named the right way.
Although you'll often want to take advantage of Powerdeploy's two-stage deployment, you can always install an application locally as well, using Install-DeploymentPackage. This is also a great way to test a deployment.
# Install our application, configured for the UAT environment
Install-DeploymentPackage `
c:\temp\PD_ShowConfiguration_1.2.3.zip `
-Environment UAT `
-PackageTargetPath c:\temp\showconfig
It may seem odd that we need to supply the environment to install the application, but sometimes you'll have installation scripts within your package that will need to know which environment is being targeted.
That's it!
You should now have a new folder c:\temp\consoleapp with showconfig.exe inside.
Go ahead and run it. You should see the configuration settings that were part of your source app.config. Powerdeploy can automatically update your settings based on configuration variables as well. You may want to try it with the tutorial application.
You're still missing out on a big part of Powerdeploy's value. Two-stage deployment enables you to send Powerdeploy and your package to another computer for installation. If you're up for it, continue on with the tutorial.