Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom Madden 253 posts 455 karma points MVP 4x c-trib
    Oct 13, 2020 @ 11:09
    Tom Madden
    0

    Azure additional deployment tips?

    Hi,

    we have an Azure site which regularly gives uses when we carry out a deployment (not consistently though). We're using deployment slots and the site is load balanced. We've got it set up for load balancing etc and have checked the setup with Umbraco, so...

    I was wondering if anyone carried out any additional steps when deploying to Azure that helps with stability immediately after a deployment? I was thinking of things like republishing the entire site, deleting umbraco.xml or any other additional steps that people might carry out to make sure a deployment goes smoothly? (BTW, we don't do these 2 things, they're just examples of things I think some people may perform.)

    We are running V7 and have followed the documentation here https://our.umbraco.com/Documentation/Getting-Started/Setup/Server-Setup/azure-web-apps-v7#web-worker-migrations

    TIA tom

  • Euan Rae 105 posts 135 karma points
    Oct 13, 2020 @ 11:35
    Euan Rae
    0

    Hi Tom,

    One thing I always do for any Umbraco deployment is call a few of the urls on the site before doing the swap, so the process would be something like:

    • Deploy new site to the slot (making sure all the App_Data is cleared)
    • Ping a few of the urls (e.g. root/home, and whatever the major listing pages are)
    • check your pings get 200 responses in an acceptable time frame
    • swap the slots

    Pinging the site in the deployment slot before you swap the slots makes sure the site is 'warmed up' (cache is built, examine indexes rebuilt, etc) and should mean a proper 0 downtime deployment.

    Hope this helps!

    Euan

  • Tom Madden 253 posts 455 karma points MVP 4x c-trib
    Oct 13, 2020 @ 12:24
    Tom Madden
    0

    Hi Euan,

    I forgot to include that in my initial question, but we deploy via and Azure Pipeline and the last step pauses until we warm up the pre-deployment slot.

    It's now got me thinking whether the way we warm up the slot might be an issue. I tend to hit a dozen or so different specific pages (each with different doctypes) and I do this one at a time, while others in the team may use a script which hits all the pages at once in different Chrome tabs.

    I'll look into that a bit further.

    thanks t

  • Euan Rae 105 posts 135 karma points
    Oct 14, 2020 @ 09:37
    Euan Rae
    0

    Hey Tom,

    They way I do it is to have a powershell script that hits the endpoints so you can automate the warmup + swapping (or not).

  • Paul 184 posts 646 karma points
    Oct 14, 2020 @ 09:56
    Paul
    0

    Sounds good - have you got a version of that you could share at all?

    We currently do the warm-up manually, so I'm hitting pages on the staging slot to warm it up before the slot swap happens.

    Slightly off topic is anyone using multiple App Service Plans in different regions with Azure Front Door? I was considering this for one of our ASPs, but haven't had time to investigate it fully yet.

  • Euan Rae 105 posts 135 karma points
    Oct 15, 2020 @ 09:55
    Euan Rae
    1

    This one is for Octopus Deploy, so you may need to tweak the way the variables are passed in, but it should get you most of the way there:

    // Start Script
        $ErrorActionPreference = "Stop" 
    function Get-Parameter($Name, $Default, [switch]$Required) {
        $result = $null
    
    if ($OctopusParameters -ne $null) {
        $result = $OctopusParameters[$Name]
    }
    
    if ($result -eq $null) {
        if ($Required) {
            throw "Missing parameter value $Name"
        } else {
            $result = $Default
        }
    }
    
    Write-Verbose "Get-Parameter for '$($Name)' [value='$($result)' default='$($Default)']"
    
        return $result
    }
    function HandleError($message) {
        if (!$whatIf) {
            throw $message
        } else {
            Write-Host $message -Foreground Yellow
        }
    }
    
    Function Invoke-UrlWarmup{
        param(
            [Parameter(Mandatory=$true)]
            [string] $url,
            [Parameter(Mandatory=$true)]
            [int] $maxResponseMilliseconds
        )
    
    Write-Host "Requesting $url until response time less than $maxResponseMilliseconds and with response code Ok(200)"
    
    $warmedUp = 0
    
    Do {
        $statusCode = -1
        $timeInMs = 9999999999
        $time = Measure-Command {
            $response = Invoke-WebRequest $url -UseBasicParsing
    
            $statusCode = $response.StatusCode
        }
    
        $timeInMs = $time.TotalMilliseconds
    
        if ($statusCode -ne 200){
            Write-Host "Request responded with $statusCode - trying request again" -ForegroundColor Cyan
            continue
        }
    
        if ($timeInMs -gt $maxResponseMilliseconds){
            Write-Host "Response time $timeInMs greater than maximum threshold: $maxResponseMilliseconds - trying request again" -ForegroundColor Cyan
            continue
        }
    
        # All criteria passed
        Write-Host "Url "$url" resonded within all criteria:"
        Write-Host "Respons Code: 200"
        Write-Host "Request response time ($timeInMs) within threshold of $maxResponseMilliseconds milliseconds"
        Write-Host "*****************"
        Write-Host ""
    
        $warmedUp = 1
    
    } While ($warmedUp -eq 0)
    
    }
    
    $websiteDomain = Get-Parameter "websiteDomain" -Required
    $urls = Get-Parameter "urls" -Required
    $maxResponseMilliseconds = Get-Parameter "maxResponseMilliseconds" -Required
    
    Write-Host "Doing website warmup on $websiteDomain"
    
    $urlList = $urls.Split(",")
    
    foreach ($url in $urlList) {
        [System.UriBuilder] $uriBuilder = [System.UriBuilder]::new($websiteDomain)
        $uriBuilder.Path = $url
    
        $fullUrl = $uriBuilder.Uri.AbsoluteUri
    
        Invoke-UrlWarmup -url $fullUrl -maxResponseMilliseconds 
    
    $maxResponseMilliseconds
    }
    
    Write-Host "All urls successfully warmed up" -ForegroundColor Green
    
    
        // End Script
    

    hope this helps, Euan

    (Please exuse the formatting)

Please Sign in or register to post replies

Write your reply to:

Draft