Previewing Environments in Google Cloud
We've recently migrated from Heroku Review Apps to a custom preview environment in Google Cloud for 2 reasons:
- Heroku Review Apps weren't very flexible
- We wanted a customisable preview environment flow
The move allowed us to fully customise our application deployment while working on a git branch, and we wanted to see how it would behave in production.
How have we achieved this?
Our application is deployed to a Google Cloud Kubernetes cluster using a custom Helm chart and, thanks to Github actions, we have control over creating, updating and deleting the app. It also allows us to scale resources if we need more power, but this is seldom needed.
A custom helm chart helps you install all the dependencies that your app has, such as databases, and also how your application will behave while using Kubernetes: config maps, deployment, jobs, etc. And when you build your chart, you can host it in a place like Github registry, so you can use it in your Github action workflows.
By running the Github action workflow, the helm chart will install the app in a given namespace inside the Kubernetes cluster and that namespace will then be picked from the git branch. This setup will make it easy to destroy the app when it is no longer needed, because all dependencies will be installed in one namespace, so they won't collide with any other applications installed in other namespaces.
Follow this blog to learn how we built every part of this flow in upcoming articles on kubernetes cluster configuration with certification manager, custom helm charts and github action workflows. I hope this series will be helpful for people trying to create their own custom preview environments.