Tip:
Highlight text to annotate it
X
In this video I’ll show how Octopus can be used to deploy a Windows Service.
I’ve used the standard C# Windows Service project template to create a Windows Service application.
I’ve also used OctoPack to package this application into a NuGet package, so that it is ready to be deployed.
You can see that the NuGet package just contains the DLL’s, executables and
configuration files needed to make this application run.
I’m going to be deploying this Windows Service to my application server role machines in Octopus.
You can see that I have one app server machine in each environment.
In the previous video I created a project, which I used to deploy the SQL Server database.
I’m going to edit this project, to add my Windows Service deployment step.
I’ll tell the step to run on my application server roles, and enter the ID of the NuGet package I’m deploying.
I’m going to enable two features.
The Configuration Variables feature is used to update my application settings and connection strings in any .NET configuration files;
I need this because I have an app.config file with a connection string.
In the previous video I showed how you can use Variables to tell Octopus what to change this value to on deployment.
I’ve also enabled the Windows Service feature.
When Octopus deploys this package, it will look for a Windows Service that we can specify.
If the service doesn’t exist, Octopus will install and start the service.
If it already exists, Octopus will stop, reconfigure it to use the current executable, and start it again.
I’ll tell Octopus the name of the service to use.
I’m going to make use of an Octopus variable here, so that I can name the service differently depending on the environment I am deploying to.
I also need to tell Octopus the relative path to the executable that contains my service.
With my service package step defined, I’ll now create a new release.
I’ll deploy this release to my Test environment.
I can view the logs as the deployment runs.
I can see that my configuration file was updated, and that the Windows Service was installed.
In the next video, we’ll look at deploying the ASP.NET MVC web application.