Image for post
Image for post

When onboarding and training new engineers at FlowUp, I started realizing how much time it takes to deeply understand how Dockerfiles work. Meanwhile, we were always maintaining that single “best-practice” Dockerfile for all of our projects. It suddenly made sense to get rid of Dockerfiles where possible.

We still use Dockerfiles for specific cases. However, I wanted to make sure, deep knowledge is not needed as a base knowledge to deploy to Cloud environments (Kubernetes, Cloud Run, or other container environments).

🐋 Making Dockerfiles Redundant

There’s a couple of projects that provide standard ways to build containers from languages or language frameworks. Basically, you…


It’s not been so long I’ve written how to post Terraform plan in Pull Requests with Google Cloud Build. In case you’re looking for the simplest way to post a comment into a PR, that’s still the preferred way.

But let’s be honest. Using Personal Access Tokens inside organizations? I bet you’ll have a scary security officer after you 3 seconds after you click the “generate” button.

The solution: a private Github App. Using a Github App comes with plenty of shiny stuff:

  • Permissions are granular for every API. For example, you can only allow Pull Request APIs for your…


Running Terraform locally just to review a pull request always was a bit of a pain in the ass. Good thing is, there are some nice people running projects like Atlantis and if you host them by yourself or use Spacelift, you’re good to go.

I just always felt like it’s a bit too much work to manage Atlantis just to run plans and applies. Instead, I deep dived into Cloud Build and tried to replicate the same idea, but in a serverless way.

Image for post
Image for post

PR Comments were a Problem

At the time I was trying to stitch all the components together, there was a missing…


Image for post
Image for post

Serverless, gRPC, containers. The dream has been becoming real with the first releases of Google Cloud Run , which only supported HTTP. However, with the recent releases, the fully-managed platform now also supports unary gRPC requests. Let’s find out what you need to do to run such a setup.


Image for post
Image for post

Legend says Go does not support optional parameters or method overloading, as it may be confusing or fragile in practice. However, there are occasions, where optional parameters are useful — often in initialization.

You’ll find some of these practices below, ranging from most verbose options to more parametrized, and extendable. 🚀

Using Multiple Initialization Functions

The simplest solution for dealing with a small number of variables is to use different functions. This technique uses WithX as a convention at the end of the function.

func NewAPIRequest() (*http.Request, error) {
return http.NewRequest(http.MethodGet, ServerURI, nil)
}

This function creates a new HTTP request for the ServerURI…


Image for post
Image for post

Living in a world where people don’t care about the response of others is no longer a joke, rather an optimization technique. However, actions have reactions, and sometimes even systems riot when we forget that YAML needs more space.

Before jumping on the asynchronous ship, remember, that synchronous error reporting is your friend — you don’t want to build the next Titanic. Don’t optimize too soon.


Image for post
Image for post

Cloud Run was recently released as a new serverless offering on Google Cloud Platform based on Knative. However, what struck me instantly was no support for Cloud SQL. Because most of our services are running SQL databases on Cloud SQL, I started searching for ways on how to connect to it until we have a proper solution from Google. We’ll build a simple Golang application with a single endpoint to demonstrate how to connect, however, the approach is language-agnostic. Cloud SQL proxy will also be used to run alongside the application to securely connect to the database.

I came to…


Image for post
Image for post

🚀 Tl;dr

Both readiness and liveness probe run in parallel throughout the life of a container. Use the liveness probe to detect an internal failure and restart the container (e.g. HTTP server down). Use the readiness probe to detect if you can serve traffic (e.g. established DB connection) and wait (not restart) for the container. A dead container is also not a ready container. To serve traffic, all containers within a pod must be ready.

🌊 Let’s Dive Deeper

Kubernetes comes with nice auto-healing capabilities out of the box. However, once deployed applications start to grow, one must tweak it a little to continue benefiting from…


Image for post
Image for post

The build time of Golang Docker images always frustrated me as there was always a need to do the go get ./... before we started building the binary. This resulted in fetching the dependencies every time we wanted to build the image. The Dockerfile then looked like this:

FROM golang:alpine AS build-envCOPY . $GOPATH/src/mypackage/myapp/
WORKDIR
$GOPATH/src/mypackage/myapp/
# go get and build <-- THIS IS THE IMPORTANT PART
RUN go get -d -v
RUN go build -o /go/bin/hello
FROM scratch # <- Second step to build minimal image
COPY --from=build-env /go/bin/hello /go/bin/hello
ENTRYPOINT ["/go/bin/hello"]

However. this Dockerfile comes with a…

Peter Malina

I like lasagnas

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store