Member-only story

Application Health Check with Golang and Multi-Stage Docker Build

Stefan Pöltl
4 min readAug 1, 2018

--

Recently I developed an application which had some random downtimes because of some unstable components that are under control by an external company. The operations department forced me to provide a http based health check route to support the uptime 24/7. I was free to use whatever I like, it just has to respond with HTTP code 200 if all checked application components are up and with 503 (Service unavailable) if there is some issue.

So the first step for me was to think about, what is the simplest technology I can use to setup a little Webhook that checks all my components and is easy to spin up with the current Docker based workflow. Some people might think about a simple AWS Lambda function, but sadly there’s no setup given at the moment. My choice fell on a Docker Multi stage build for a simple Golang Webhook, which was really fast to code and to build.

In general, I started from zero with coding in Golang, because my license for the JetBrains IDE called GoLand already expired and I don’t want to spend some money for it. I researched for an IDE and decided to go with Visual Studio Code and the corresponding Go Plugin (https://code.visualstudio.com/docs/languages/go). Setting this up on my MacBook took me 5 minutes and I was well prepared for the battle.

Dockerfile to build…

--

--

Stefan Pöltl
Stefan Pöltl

Responses (3)