Azure DevOps & Octopus Deploy
Problem: I needed to implement a CI/CD to a target environment which does not have access to the internet. We use Azure DevOps for our CI/CD but it cannot serve the purpose alone because our target has no internet access.
There comes the need to look for an alternative to compliment azure devops which i came accross Octopus deploy.
Solution: I setup an Octopus server on the DMZ environment which has a line of sight to the target environment through the intranet. while Azure DevOps does all the build and octopus plugins does the release.
Check here for the installation guide to the Octopus Deploy.
Back to Azure DevOps get the octopus plugin to azure from the marketplace here.
Create an API Key on the octopus server that would be used for the service connection on azure devops. This is done from your user profile page.
Create the service connection for the Octopus Deploy from the AzureDevOps to create an handshake.
server url: This is the url for your octopus server. e.g http://localhost:8080
API Key: your generated key from the server.
when all of this isdone then your Azuredevops should be able to connect to your Octopus server, and you can use the server during your build or release pipeline.
When the Octopus plugins is installed to your DevOps project then you can have access to the octopus tasks and wigets from your pipelines (build or release)
For this project the target environment is an IIS web application and i had to do some file transformations for the variables to the different environments i had. So Azure DevOps does the build and it was pretty consistent with how you setup your build pipelines.
Typically IIS Web Deploy Task is what i need for this IIS deployment to the production environment but since i have to use octopus tasks i needed to get equivalent tasks needed to achieve this.
File Transform task: was used for the vairable transforms needed with variables changes at the appsettings.
Extract File Task: I needed to extract the files which is from the build artifacts, so it can be packaged for an octopus file format.
Octopus CLI: Optional. Use this task to supply the Octopus CLI tool to other tasks, by downloading them or using a built-in copy.
Alternatively, you can supply the tool using the system
PATH environment variable, or allow the other tasks to download the latest version themselves
Package App Task: The source path was the destination where i extracted the files into from the extract task. $(System.DefaultWorkingDirectory)/drop/extract
destination: path to set.
package version: $(build.buildId) so it can be dynamic and tied to each build.
Push Octopus Task: This pushes the packages to the octopus server
package: the packaged file from the package octopus task from the output. $(System.DefaultWorkingDirectory)\drop2\WebAppDeploy.$(Build.BuildId).zip
Create Release: i had to have an additional arguments where i needed to specify the version to deploy everytime.
— packageVersion $(build.buildId) this way it would not deploy the first matching vesion which could be an older package.
You can observe the release been created on your octopus server and you can also check the progress from your azure devops page.
Ther other couple of use case that might require more robust implementation but this is just a simple guide into octopus and Azure DevOps for an isolated target environment without internet access.