Thumbnail image

Multi Region REST Service on GCP using GitHub Template

I learn best by doing. And recently, most of the projects I’ve been building are either REST or gRPC-base services deployed as container images into Cloud Run on GCP. That means that I increasingly find myself recreating a lot of the same infra and app deployment flows.

Over time, the stack for these services started getting also more complex. Multi-region deployment in Cloud Run, fronted by Load Balancer with custom domain and SSL cert, throttled by Cloud Armor policies, and pushing images to GCR from GitHub action without the need to provision service account keys.

So, over the holidays, I’ve decided to automate the provisioning of the entire stack in a GitHub template project so I can quickly bootstrap new services, in a more reproducible fashion, and focus on actually writing the code, not tweaking the infra.

The result, restme. It’s a Terraform-based configuration to provision into your GCP project a fully functional, multi-region, REST service with a secure developer release pipeline in GitHub.

Here is what’s included:

The template project also includes Go source code for very rudimentary REST services based on gin framework to expedite bootstrapping new app dev:

  • [GET] Request info - client request, headers and environment variables
  • [POST] Echo message - simple echo message

This entire setup is available as a template with prerequisites and deployment instructions my GitHub repo. I hope you find it as helpful as I do.