Setting up the blog

So I am starting a blog now. About time!

My goal is to host the blog on azure, served from my primary domain. For this first part, I am just deploying content and media together, later I plan to move the media to a CDN.

As the blog platform I am going with the static site generator hugo.

Hugo setup

I am starting with a very simple setup which I will modify over time based on my needs, so no comments or extra content at the start. For the theme I chose Beautiful Hugo which is very clean with a lot of options for features. The only configuration changes I did was removing the date part from the url. The repository will be hosted in VSTS, with build and deployment to azure configured there.

Hugo build and deployment

A quick search on the Marketplace show that there already is an extension for building a hugo site on VSTS. Sadly since github now requires TLS 1.2 for all their api calls, the extension no longer works. I submitted a pull request for fixing that which was already merged, but the extension hasn’t been updated yet. As a workaround I am using this simple powershell script:

if ( -not( test-path "hugo.exe" )) {
    Write-Host "Downloading hugo executable"
    # github api now only accepts TLS 1.2

    # see

    [System.Net.ServicePointManager]::SecurityProtocol = @("Tls12")
    Invoke-WebRequest -Uri `
    "$(HugoVersion)/hugo_$(HugoVersion)" `
    Add-Type -AssemblyName System.IO.Compression.FileSystem ;`
    [System.IO.Compression.ZipFile]::ExtractToDirectory("", "$PWD\tmp")
    Move-Item tmp\hugo.exe .
    Remove-Item -Confirm:$false
    Remove-Item tmp -Recurse -Confirm:$false
.\hugo.exe --baseURL $(BASEURL)

This requires a windows agent, as does the hugo extension mentioned above. I may convert this to cross-platform at a later time, so that I can use my linux private agents. For deployment I use the default Azure App Service Deploy task.

I plan to handle image handling (optimizing and uploading to blob storage/cdn) as part of this build process.

Since you need to generate hugo with the target domain as an argument, there is no point in utilizing VSTS Release Management, so I set a custom condition for the deploy task to master branch only:


For copy+paste:

and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))

Let’s encrypt in Azure

As mentioned at the beginning, I want to use my main domain for the blog, ideally with SSL capability.

With Let’s Encrypt you can generate and automatically renew SSL certificates for your domain.

For my azure app service I basically followed this blog post, with the exception of step 5 - Register a Service Principal, where I created the application via the azure portal, as described in the docs.

That’s it for now

So now I have a rudimentary blog setup and can start producing content. Stay tuned for more.

blog  vsts  azure 

No comment