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
peakgateway-stagingDevelopment and stagingStaging
pinpoint-gatewayProduction workloads and shared Artifact RegistryProduction

Both projects are in the same GCP organization and use the same unsuffixed Cloud Run service names. Always supply --project on operational commands.


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

All eight services use 1 CPU and 2 GiB memory by default. Terraform applies the following source-controlled scaling defaults; Terrakube workspace variables can override them.

ServiceWarm in stagingWarm in productionMax instances
authyesyes30
managementnoyes30
online-txnnoyes30
processingnoyes20
card-presentnono20
merchant-onboardingnoyes10
statusnono10
mcpnono10 (global fallback)

Warm services keep one minimum instance; request-based services scale from zero. Verify active Cloud Run settings before capacity or incident decisions.

Cloud Spanner

PropertyStagingProduction
Instance Configregional-us-east1regional-us-east1
DialectPostgreSQLPostgreSQL
Multi-regionalNoNo (single-region HA)
EncryptionCMEKCMEK

Processing units, autoscaling bounds, and backup retention are workspace configuration. Read the active Spanner instance and Terrakube variables rather than relying on static sizing numbers.


5. Domain & DNS Configuration

DomainPoints ToPurpose
api.peakgateway.coGlobal external Application Load BalancerAuth, management, status, MCP
pay.peakgateway.coGlobal external Application Load BalancerOnline transaction and card-present APIs

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

  • Root /.well-known/* and /oauth2/* routes -> gateway-auth
  • /auth/* -> gateway-auth (prefix removed)
  • /management/* -> gateway-management (prefix removed)
  • /status/* -> gateway-status (prefix removed)
  • /mcp and /mcp/* -> gateway-mcp
  • default -> gateway-management

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

  • /online-txn/* -> gateway-online-txn (prefix removed)
  • /card-present/* -> gateway-card-present (prefix removed)
  • default -> gateway-online-txn

NOTE: The gateway-processing and gateway-merchant-onboarding services have no external routes. They are reachable only through authenticated service-to-service calls. 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 internalDeny (403)Block public access to internal service routes
900cve-canaryDeny (403)Block CVE canary patterns
1000sqli-v33-stableDeny (403)Block SQL injection attacks
1001xss-v33-stableDeny (403)Block cross-site scripting attacks
1002lfi-v33-stableDeny (403)Block local file inclusion attacks
1003rce-v33-stableDeny (403)Block remote code execution attacks
2000source-IP rate limitThrottleCoarse emergency limit, default 10,000 requests/minute
2147483647DefaultAllowDefault allow all

7. TLS Certificates

TLS uses Certificate Manager DNS authorizations, managed certificates, and a certificate map attached to the global HTTPS proxy:

resource "google_certificate_manager_certificate" "gateway_api" {
name = "gateway-api-cert"
managed {
domains = [var.gateway_domain]
dns_authorizations = [google_certificate_manager_dns_authorization.gateway_api.id]
}
}

resource "google_certificate_manager_certificate" "payment_api" {
name = "payment-api-cert"
managed {
domains = [var.pay_domain]
dns_authorizations = [google_certificate_manager_dns_authorization.payment_api.id]
}
}

8. Monitoring & Alerts

Uptime Checks

No Cloud Monitoring uptime checks are currently provisioned by Terraform. Service availability is measured by the per-service Cloud Monitoring SLOs.

Alert Policies

AlertConditionNotification
Per-service SLO fast burnBurn rate > 10× over 5 minutesSlack (#gateway-alerts) + managed email fallback
Per-service SLO slow burnBurn rate > 2× over 1 hourSlack (#gateway-alerts) + managed email fallback
Pub/Sub DLQ has messagesConfigured DLQ depth > 0 for 5 minutesSlack (#gateway-alerts) + managed email fallback
Webhook DLQ depthwebhook_dlq_depth > 0 for any organization for 15 minutesSlack (#gateway-alerts) + managed email fallback
Per-service SLO error budget lowLess than 10% remaining for 15 minutesCloud Monitoring only unless slo_budget_alert_channels is configured

These notifications do not trigger automated paging, acknowledgement, or escalation. Operators coordinate the response manually in Slack.


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-east1 --project pinpoint-gateway

# Route traffic back to a known-good revision
gcloud run services update-traffic gateway-processing \
--to-revisions=gateway-processing-PREVIOUS_REVISION=100 \
--region us-east1 \
--project pinpoint-gateway

Database Migration

  • Schema changes are published as bounded, immutable, forward-only revisions under db/schema-revisions/
  • Staging applies and verifies the revision before production
  • Each DDL operation must reach terminal success before the schema lease is released
  • Migrations must be resumable because earlier statements in a failed Spanner DDL batch remain committed

10. Cost and Capacity

Static monthly estimates age quickly and are not an operational source of truth. Use Cloud Billing reports for actual spend, Cloud Run revision settings for active capacity, and the target Terrakube workspace for intended scaling and Spanner configuration.