Blue/Green deployments are a deployment strategy that reduces downtime and risk by running two environments, Blue and Green. In Google Cloud Platform (GCP), you can implement Blue/Green deployments using Cloud Build along with other GCP services like Cloud Run or Kubernetes. This guide provides an example of setting up a Blue/Green deployment using GCP Cloud Build.
trigger:
template:
message: "Building and deploying to Blue/Green environments"
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/my-app:latest', '.']
- name: 'gcr.io/cloud-builders/gcloud'
args: ['run', 'deploy', 'my-app-blue', '--image', 'gcr.io/$PROJECT_ID/my-app:latest', '--region', 'us-central1', '--platform', 'managed', '--quiet']
- name: 'gcr.io/cloud-builders/gcloud'
args: ['run', 'deploy', 'my-app-green', '--image', 'gcr.io/$PROJECT_ID/my-app:latest', '--region', 'us-central1', '--platform', 'managed', '--quiet', '--no-promote']
- name: 'gcr.io/cloud-builders/gcloud'
args: ['run', 'services', 'update-traffic', 'my-app-green', '--to-latest', '--region', 'us-central1', '--platform', 'managed']
How do I avoid rehashing overhead with std::set in multithreaded code?
How do I find elements with custom comparators with std::set for embedded targets?
How do I erase elements while iterating with std::set for embedded targets?
How do I provide stable iteration order with std::unordered_map for large datasets?
How do I reserve capacity ahead of time with std::unordered_map for large datasets?
How do I erase elements while iterating with std::unordered_map in multithreaded code?
How do I provide stable iteration order with std::map for embedded targets?
How do I provide stable iteration order with std::map in multithreaded code?
How do I avoid rehashing overhead with std::map in performance-sensitive code?
How do I merge two containers efficiently with std::map for embedded targets?