Skip to main content

GCP Deployment

1. Overview

All gateway components are deployed on Google Cloud Platform (GCP). This document covers the deployment topology, resource sizing, domain configuration, and operational procedures.


2. GCP Projects

ProjectPurposeEnvironment
peak-gateway-stagingDevelopment and stagingStaging
peak-gateway-prodProduction workloadsProduction

Both projects are in the same GCP organization, under the Myriad Ventures/Peak billing account.


3. Deployment Topology

Internet

┌───────┴────────┐
│ Cloud DNS │
│ *.peakgateway.co │
└───────┬────────┘

┌───────┴────────┐
│ Cloud Load │
│ Balancer │
│ (Global L7) │
│ + Cloud Armor │
└───────┬────────┘

┌────────────┼────────────┐
│ │ │
┌──────┴─────┐ ┌────┴────┐ ┌─────┴─────┐
│ api.peakgateway.co │ │ pay.peakgateway.co │ │ internal-only │
└──────┬─────┘ └────┬────┘ └─────┬─────┘
│ │ │
┌──────┴────────────┴────────────┴──────┐
│ VPC (10.0.0.0/24) │
│ │
│ ┌───────────────────────────────┐ │
│ │ Private services │ │
│ │ │ │
│ │ Cloud Spanner (CMEK) │ │
│ │ Cloud Pub/Sub │ │
│ │ Secret Manager │ │
│ │ Identity Platform │ │
│ └───────────────────────────────┘ │
└───────────────────────────────────────┘

4. Resource Sizing

Cloud Run Services

ServiceStagingProduction
processing1 CPU, 1Gi, 0 to 5 instances2 CPU, 2Gi, 1 to 20 instances
management1 CPU, 1Gi, 0 to 5 instances1 CPU, 1Gi, 1 to 20 instances
online-txn1 CPU, 1Gi, 0 to 5 instances2 CPU, 2Gi, 1 to 20 instances
auth1 CPU, 1Gi, 0 to 5 instances1 CPU, 1Gi, 1 to 20 instances
merchant-onboarding1 CPU, 1Gi, 0 to 5 instances1 CPU, 1Gi, 1 to 20 instances
status1 CPU, 1Gi, 0 to 5 instances1 CPU, 1Gi, 1 to 20 instances

Cloud Spanner

PropertyStagingProduction
Instance Configregional-us-central1regional-us-central1
Processing Units100 PU1000 PU (1 Node)
Multi-regionalNoNo (Single region HA)
BackupsDaily, 7-day retentionDaily, 7-day retention

5. Domain & DNS Configuration

DomainPoints ToPurpose
api.peakgateway.coCloud Run (via LB)Management, Auth, Status
pay.peakgateway.coCloud Run (via LB)Online Transaction Service

Cloud Load Balancer URL Map (api.peakgateway.co)

  • /auth/* -> gateway-auth
  • /management/* -> gateway-management
  • /status/* -> gateway-status
  • default -> gateway-management

Cloud Load Balancer URL Map (pay.peakgateway.co)

  • /online-txn/* -> gateway-online-txn
  • default -> gateway-online-txn

NOTE: The gateway-processing and gateway-merchant-onboarding services have no external routes. Both are reachable only internally via service-to-service calls on the VPC's internal load balancer (Cloud Run ingress is set to INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER, and neither is listed in externally_routed_services in infra/terraform/main.tf). See Ops > Internal-Only Services for the verification checklist.


6. Cloud Armor WAF Rules

Cloud Armor is configured with the following rules:

PriorityRuleActionDescription
850request.path.contains('internal')Deny (403)Block public access to internal service routes
900evaluatePreconfiguredExpr('cve-canary')Deny (403)Block CVE canary patterns
1000evaluatePreconfiguredWaf('sqli-v33-stable')Deny (403)Block SQL injection attacks
1001evaluatePreconfiguredExpr('xss-v33-stable')Deny (403)Block cross-site scripting attacks
1002evaluatePreconfiguredExpr('lfi-v33-stable')Deny (403)Block local file inclusion attacks
1003evaluatePreconfiguredExpr('rce-v33-stable')Deny (403)Block remote code execution attacks
2000Rate Limit (SRC_IPS_V1)Throttle100 req/min per IP
2147483647DefaultAllowDefault allow all

7. TLS Certificates

resource "google_compute_managed_ssl_certificate" "gateway" {
name = "gateway-gateway-domain-cert"
project = var.project_id
managed {
domains = ["api.peakgateway.co"]
}
}

resource "google_compute_managed_ssl_certificate" "pay" {
name = "gateway-pay-domain-cert"
project = var.project_id
managed {
domains = ["pay.peakgateway.co"]
}
}

8. Monitoring & Alerts

Uptime Checks

TargetIntervalTimeout
api.peakgateway.co/status/health60s10s
pay.peakgateway.co/online-txn/health60s10s

Alert Policies

AlertConditionNotification
Service downUptime check fails 2 consecutive timesPagerDuty (P1)
Error rate > 5%Cloud Run 5xx rate > 5% for 5 minutesPagerDuty (P2)
Latency p95 > 5sCloud Run request latency p95 > 5s for 10 minutesSlack (#gateway-alerts)
DB Storage > 80%Cloud Spanner storage utilization > 80%Slack (#gateway-alerts)
DB CPU > 80%Cloud Spanner CPU utilization > 80% for 15 minutesSlack (#gateway-alerts)

9. Operational Procedures

Deploy New Version

  1. Merge PR to main
  2. CI builds and tests
  3. Staging auto-deploys via GitHub Actions
  4. Verify staging health checks
  5. Trigger production deploy via GitHub Actions workflow dispatch
  6. Monitor production health post-deploy

Rollback

# List revisions
gcloud run revisions list --service gateway-processing --region us-central1 --project peak-gateway-prod

# Route traffic back to previous revision
gcloud run services update-traffic gateway-processing \
--to-revisions=gateway-processing-PREVIOUS_REVISION=100 \
--region us-central1 \
--project peak-gateway-prod

Database Migration

  • Spanner DDL migrations are applied via versioned SQL files
  • Staging runs migrations first
  • Production migrations run during the deploy step
  • Always backward-compatible migrations

10. Cost Estimates (Monthly)

ResourceStagingProduction
Cloud Run~$50~$200 to 800
Cloud Spanner~$65~$650
Cloud Load Balancer~$20~$50
Cloud Armor~$5~$5
Artifact Registry~$5~$5
Secret Manager~$1~$1
Cloud DNS~$1~$1
Pub/Sub~$1~$10
Total~$155~$922 to 1,522