webstatus.dev icon indicating copy to clipboard operation
webstatus.dev copied to clipboard

[ENHANCEMENT] Use GCP Cloud Deploy to automate deployments

Open jcscottiii opened this issue 5 months ago • 0 comments

Is your feature request related to a problem? Please describe. Currently, project maintainers have to manually deploy the project to both staging and production

Describe the solution you'd like GCP provides a relatively new solution called Cloud Deploy. Cloud Deploy depends on a project using Skaffold, which we already use, to know which resources to deploy. It works with Cloud Run targets out of the box. Additionally, Cloud Deploy supports Custom Targets. This will be useful for the terraform code that should run first. They have examples of using terraform in a custom target too.

Additionally, if we ever need to do a rollback, there is a UI for that.

It gives us the ability to automatically or manually promote releases between environments image

Since this uses Skaffold, we can enable the gitCommit tagPolicy to automatically tag our deployments with the git commit sha too.

Here's a first draft of the steps needed to complete this card

  • [ ] Create a new deployer GCP project. Or maybe call it an admin project so that it can do more things in the future.
  • [ ] Create two new profiles in the existing Skaffold configs called staging and prod. This config should only deploy the services and jobs and not things like the database emulator (which happens in the existing local skaffold profile).
  • [ ] For each service and job, follow the instructions in this section.
  • [ ] Remove the deployment of the cloud run services and jobs from terraform
  • [ ] Update the instructions on how users can deploy their own version still (this may need to be split out to a separate card with a lower priority)

A few downsides that I saw initially with this:

  • We will need to create a lot of service.yaml / job.yaml files (one per app per region per project)
  • We currently configure environment variables dynamically from output from terraform. We would need to hard code these values in the service.yaml / job.yaml files
  • We still need a way to build the images before running the pipeline according to this doc
  • We still need a way to create the release (could have developers run gcloud deploy releases create)

jcscottiii avatar Sep 09 '24 16:09 jcscottiii