Go Protobuf Plugin Versioning

Update on Go 1.24 tool dependencies Go 1.24 introduced the -tool flag to go get and the tool stanza to go.mod. This makes tool dependencies an excellent way to manage protobuf plugins. I have rewritten this post with that in mind. Background When working with Protobuf and gRPC, one of the first things that you as a user has to figure out is how to generate code from your Protobuf definitions....

October 20, 2022 · 7 min

Serverless Application Stack

The dream of a serverless, general-purpose, portable application stack is finally a reality. TL;DR: deploy your application to GCP Cloud Run with a CockroachDB Serverless instance for persistence. Read on for a deeper dive. Serverless compute AWS Lambda revolutionized the industry by introducing the concept of “serverless” computing to the masses. Today it lets devs and companies alike pay for exactly the amount of compute they need, down to the millisecond it takes to execute the code....

November 20, 2021 · 11 min

gRPC-Web vs the gRPC-Gateway

Ever since I first started using gRPC in 2016, I’ve been interested in learning how to use it well with browser clients. It’s a common question to ask once you’ve decided that you are going to use gRPC for service-to-service and mobile app communication. Here’s this great technology that abstracts away the problems I was having when making RPC calls between my services. How do I use it for my front-end applications?...

October 24, 2021 · 5 min

How I use Postgres with Go

Most developers will have to interact with SQL at some point in their career, and often nowadays that means working with Postgres. I’ve been using Postgres with Go for a few years now and have found a couple of libraries that work really well together to make the Go Postgres experience productive, safe and fun. TL:DR; I have created an example repo that puts all of the below into practice: github....

April 7, 2019 · 6 min

The state of gRPC in the browser

gRPC 1.0 was released in August 2016 and has since grown to become one of the premier technical solutions for application communications. It has been adopted by startups, enterprise companies, and open source projects worldwide. Its support for polyglot environments, focus on performance, type safety, and developer productivity has transformed the way developers design their architectures. So far the benefits have largely only been available to mobile app and backend developers, whilst frontend developers have had to continue to rely on JSON REST interfaces as their primary means of information exchange....

January 8, 2019 · 6 min

gRPC Client Authentication

Introduction Best practices for performing client authentication with gRPC is a question that comes up again and again, so I thought I’d dive into a few different methods for performing authentication, using the tools provided by the Go gRPC packages. Today we’ll explore 3 methods of authentication: TLS Client certificate authentication Token Header authentication HTTP Basic authentication For the TL:DR; check the example repo. Note: Go-gRPC interceptors are being redesigned, so if you implement this in your server today, you may want to keep in mind that it will change again in the future....

July 22, 2018 · 4 min

Using gRPC with JSON

Introduction It’s often said that gRPC is tied to the Google Protocol Buffers payload format, but this is not strictly true. While the default format for gRPC payloads is Protobuf, the gRPC-Go implementation exposes a Codec interface which allows arbitrary payload encoding. This could be used for all kinds of things, like your own binary format, using flatbuffers, or, as we shall see today, using JSON for requests and responses....

July 21, 2018 · 3 min

Replacing Docker Cloud

Introduction Last year I wrote a post about automating deployment of your application, all the way from git push to redeploying your application in your environment. It relied on the free version of Docker Cloud, which allowed the use of a single node for free. Of course, the idea was that you should eventually want to scale your deployment, and then you’d need to pay. As long as all you needed was a single node, Docker Cloud and its Bring Your Own Host was powerful, flexible and simple....

April 24, 2018 · 3 min

Automatic TLS certificate distribution with Vault

It’s often recommended that microservice communications are encrypted, especially if they cross the public internet. Even when you control the network, whether virtually or physically, encrypting traffic can still be valuable. Lets Encrypt has revolutionized the distribution of certificates for publically facing servers; unfortunately, encrypting internal traffic often involves complicated certificate generation setups. Hashicorp Vault is a project for storing secrets and performing authentication. It has a PKI Secret Engine backend which allows you to use it as a certificate authority in an internal public key infrastructure deployment....

March 25, 2018 · 3 min

Advanced gRPC Error Usage

How to best handle errors in Go is a divisive issue, leading to opinion pieces by illustrious bloggers such as Dave Cheney, the commander himself Rob Pike as well as the official Go blog. I’m not going to tackle those opinions here, instead I’m going to talk about best practices for errors when using gRPC and Go. The gRPC Status package The Go gRPC implementation has a status package which exposes a nice simple interface for creating rich gRPC errors....

March 19, 2018 · 5 min