We have setup a load-balancer enabled Azure DevOps Release Pipeline for Litium Cloud for Litium 7. I thought I’d share it here to see if others are doing it the same way, or if any improvements can be made.
The pipeline follows the deployment guidelines given to us by Litium Cloud Operations, and seems to work fine.
Some things to note:
- The “delay/wait” task we had to get from Azure DevOps Marketplace.
-
-UseBasicParsing
was necessary because PowerShell 1.0 uses Internet Explorer under the hood. We also had to add the wake-up URL to “Trusted Sites” in the Internet Explorer settings. - The wake-up URL is the external URL, and has been
hosts
d to 127.0.0.1. We couldn’t get it to work any other way, probably because of Internet Explorer or the low PowerShell version? - Manually stopping the Application Pool is necessary because
libsass
(IIRC) holds some files hostage otherwise.
All defaults removed, for brevity.
{
"environments": [
{
"name": "Litium production deployment",
"deployPhases": [
{
"deploymentInput": {
"deploymentHealthOption": "OneTargetAtATime"
},
"name": "Deploy to all deployment targets in \"Litium Production\" deployment group, one target at a time",
"workflowTasks": [
{
"name": "Remove deployment target from load balancer (by stopping the LoadBalancer IIS Website)",
"timeoutInMinutes": 1,
"retryCountOnTaskFailure": 5,
"inputs": {
"IISDeploymentType": "IISWebsite",
"ActionIISWebsite": "StopWebsite",
"StartStopWebsiteName": "LoadBalancer"
}
},
{
"name": "Wait for existing connections to finish",
"inputs": {
"seconds": "10"
}
},
{
"name": "Stop application pool (since libsass is always \"file in use\" otherwise)",
"timeoutInMinutes": 1,
"retryCountOnTaskFailure": 5,
"inputs": {
"IISDeploymentType": "IISApplicationPool",
"ActionIISApplicationPool": "StopAppPool",
"StartStopRecycleAppPoolName": "Litium-Production"
}
},
{
"name": "Deploy Litium",
"timeoutInMinutes": 1,
"retryCountOnTaskFailure": 5,
"inputs": {
"WebSiteName": "Litium-Production",
"Package": "$(System.DefaultWorkingDirectory)\\**\\*.zip"
}
},
{
"name": "Start application pool",
"inputs": {
"IISDeploymentType": "IISApplicationPool",
"ActionIISApplicationPool": "StartAppPool",
"StartStopRecycleAppPoolName": "Litium-Production"
}
},
{
"name": "Wake up deployment target (by invoking https://www.litium.se)",
"inputs": {
"script": "Invoke-WebRequest -UseBasicParsing -Uri https://www.litium.se",
"errorActionPreference": "stop"
}
},
{
"name": "Add target to load balancer",
"inputs": {
"IISDeploymentType": "IISWebsite",
"ActionIISWebsite": "StartWebsite",
"StartStopWebsiteName": "LoadBalancer"
}
}
]
}
],
"executionPolicy": {
"concurrencyCount": 1
}
}
],
"artifacts": [
{
"type": "Build",
"alias": "_Litium Production",
"definitionReference": {
"definition": {
"id": "182",
"name": "Litium Production"
}
}
}
],
"name": "Litium Production (Load Balancer-enabled)"
}