Are you a morning or evening person?

I am not a morning person. I’ve really tried but there’s something in me that just stops me from getting out of bed, even though I know I should.

I have friends who get up at 05:30 every day and for me, that’s the middle of the night!

It doesn’t really matter however, I’m a productive person…just not before 9am in the morning. I tend to do most of my personal work (blogging, writing/practicing presentations) in the evening so have always made time when I am most productive.

I’m also really lucky with my current position as the rest of my team is based in the US so there’s no point in me getting up early to work, as I’d completely miss their work day.

Well, that’s what I tell myself anyway (and I’m sticking to it).

What about you? I’d love to know if you’re a morning or evening person? Would be interesting to see the ratio for DBAs out there.

Have a good week!

Friday Reading 2018-07-27

Phew, I’m not going to complain about the hot weather…I’ll miss it when it’s gone.

Linux Load Averages: Solving the Mystery
Good post by Brendan Gregg (t) explaining a critical metric

SQL Server on Linux – I/O internal thoughts
David Barbarin (t) on IO internals for SQL on Linux

The History of Kubernetes & the Community Behind It
It’s 3 years since Kubernetes 1.0 was announced so Brendan Burns (t) tells us the story of its creation

July 10, 2018 Windows updates cause SQL startup issues due to “TCP port is already in use” errors
Literally had this happen to me yesterday, something to watch out for

Have a good weekend!

Creating SQL images in Azure with ACR Build – Part Two

EDIT – 2018-10 – ACR Build is now known as ACR Tasks

In Part One I detailed how we can use ACR Build to push SQL Server docker images to the Azure Container Registry.

But that all seems a bit manual, doesn’t it?

One of the cool things about ACR build is that we can hook it into GitHub so when we commit to a repository it will build us a new image (very, very cool 🙂 ). Let’s run through how to set that up now…

There’s a couple of pre-reqs required to follow the code here. The first thing to do is fork and clone the following repository: –
https://github.com/dbafromthecold/AzureContainerRegistryBuild

The next thing to do is create a Personal Access Token (PAT) in GitHub.
Go to https://github.com/settings/tokens and select the following options for the new PAT: –

Scroll to the bottom of the page and hit Generate Token (make sure to copy the token)

Ok, now we’re set up to create a build task in ACR. I’m going to continue on from my previous post so will log into Azure: –

az login

 


N.B. – In Part One I used a powershell console however in this post I’ve switch to Bash for Windows. This is because if you try to create a build task in powershell, it’ll error out: –

I’ve played around a bit but couldn’t get it to work, so I cut my losses and jumped into bash. Probably shouldn’t be running the Azure-CLI commands in a powershell window but I needed to previously as I had to build a docker image locally, we don’t need to do that now.


 

Before we do anything else let’s just verify that we can see the existing repository created in Part One and the tagged image in it: –

az acr repository show-tags --name TestContainerRegistry01 --repository testimage<a 

Great! Now let’s create the build task: –

az acr build-task create \
    --registry TestContainerRegistry01 \
    --name buildsqlimage \
    --image testimage:{{.Build.ID}} \
    --context https://github.com/<your-github-username>/AzureContainerRegistryBuild \
    --branch master \
    --git-access-token YOUR_PERSONAL_ACCESS_TOKEN


N.B. – The {{.Build.ID}} will generate a tag for the new image created within the repository (based on the number created by ACR Build)

Fantastic, one build task created! How easy was that??

Let’s test by running: –

az acr build-task run --registry TestContainerRegistry01 --name buildsqlimage

And the progress of the build task can be monitored: –

az acr build-task logs --registry TestContainerRegistry01

After a while (be patient 🙂 ) a new tag will be in the repository: –

az acr repository show-tags --name TestContainerRegistry01 --repository testimage

Cool! Now let’s commit to the repository in GitHub and see if a new image is created. So navigate to where you cloned the repository: –

cd AzureContainerRegistryBuild

What we’re going to do is drop an environment variable into the dockerfile to change the port that SQL is listening on.

nano Dockerfile

Drop the following into the dockerfile:-

ENV MSSQL_TCP_PORT=15666

Now commit and push!

git add .
git commit -m "Changed the port for SQL Server"
git push

And then a new tag will be in the repository!

az acr repository show-tags --name TestContainerRegistry01 --repository testimage

Awesome! How cool is that?!

To make sure that it’s worked, let’s run an Azure Container Instance (using the credentials stored in the Key Vault created in Part One): –

az container create \
    --resource-group containers1 \
    --image testcontainerregistry01.azurecr.io/testimage:aa4 \
    --registry-username $(az keyvault secret show \
                        --vault-name aptestkeyvault01 \
                        --name testcontainerregistry-pull-usr \
                        --query value --output tsv) \
    --registry-password $(az keyvault secret show \
                        --vault-name aptestkeyvault01 \
                        --name testcontainerregistry-pull-pwd \
                        --query value --output tsv) \
    --name testcontainer2 \
    --cpu 2 --memory 4 \
    --environment-variables SA_PASSWORD=Testing1122 \
    --ip-address public \
    --ports 15666

N.B. – Make sure the image tag is correct!

Confirm that the ACI is up and running: –

az container show --name testcontainer2 --resource-group containers1

And BOOM! Connect to SQL Server: –

How. Cool. Is. That? Automatically creating SQL images in ACR with just a commit to a Github repo!

Thanks for reading!

Taking the Linux plunge

I’m a Windows guy.

Kinda have had to be, given my profession as a SQL Server DBA. But recently I’ve become a bit discontent with Windows. Nothing out of the usual has contributed to this, just things like UAC, updates etc.

Now in the past, I’ve had to suck these annoyances up and deal with them. But the world (well Microsoft) has changed.

With the release of SQL Server Operations Studio, Visual Studio Code, and powershell available as a snap on Linux; I now have tools required to be a SQL Server DBA on multiple platforms. Even SQL Server itself runs on Linux! (Anyone else still getting over that?)

So last week I took the plunge and bought a Dell XPS 13 running Ubuntu.

I’ve dual booted with Ubuntu for years so have always had the fallback to Windows there (just in case) but I’ve always seemed to manage. This isn’t to say that my Linux skills are up to par, I have a huge learning curve ahead of me.

Alright, I’ll admit that there’s a bit of shiny tech syndrome going on here but I am really looking forward to using something other than Windows as my primary laptop.

I’ll write a post after a couple of weeks of using it, hopefully I won’t have reformatted and installed Windows 10 🙂

Have a good week!

Friday Reading 2018-07-20

Haven’t posted one of these for a while! It’s good to have some time back to be able to read/write.

I’ve had a pretty mixed week, but the highlight has definitely been pulling the trigger on buying a Dell XPS 13 running Ubuntu. The Dell is a pretty slick machine, I’ve seen a few people at events with them and I’ve always been really envious so I finally went and bought myself one 🙂

Will write a post about how I get on with it after a couple of weeks. Anyway, this week I’ve been reading…

Azure Container Registry Build Supports All Windows Versions
I’ve been playing around with ACR build recently (see here), more options are always welcome!

Azure Container Instances now available in Australia East, East US 2, and Central US
New regions available for deployment of ACIs

Public Preview of Row Mode Memory Grant Feedback in Azure SQL Database
More adaptive query processing improvements in Azure SQL Database

Day 1 of 4 – My life as a Production DBA (Technical Lead)
Garry Bargsley’s (t) series on his day to day life as a DBA

RESTORE VERIFYONLY what does WITH LOADHISTORY do?
Kenneth Fisher (t) tells us about the LOADHISTORY option. I honestly didn’t know this existed.

Have a good weekend!