Skip to main content

Deployment

Overview

TargetTriggerPipeline
Cloud Run (staging)Push to main.github/workflows/deploy.yml
Cloud Run (production)Manual dispatch with release tag.github/workflows/deploy.yml
Cloudflare PagesPush to main.github/workflows/cloudflare-pages.yml
Kotlin SDK (Maven)GitHub release.github/workflows/sdk-publish.yml
TypeScript SDK (npm)GitHub release.github/workflows/sdk-npm-publish.yml

Cloud Run Deployment Flow

  1. Build: Bazel builds OCI images for all 6 services
  2. Push: Images pushed to Artifact Registry (us-east1-docker.pkg.dev/pinpoint-gateway/gateway/{service}:{tag})
  3. Deploy: gcloud run deploy to Cloud Run with appropriate env vars and secrets

Image Tagging

EnvironmentTagExample
Stagingdevgateway-processing:dev
ProductionRelease taggateway-processing:v0.0.3

CRITICAL: Production must use a pinned immutable release tag. Never use latest or dev for production.

Cloud Run Services

ServiceStagingProduction
authgateway-auth-staginggateway-auth
processinggateway-processing-staginggateway-processing
managementgateway-management-staginggateway-management
online-txngateway-online-txn-staginggateway-online-txn
merchant-onboardinggateway-merchant-onboarding-staginggateway-merchant-onboarding
statusgateway-status-staginggateway-status

Region: us-east1

Scaling Configuration

SettingStagingProduction
Min instances01
Max instances510
CPU12
Memory512Mi1Gi

Checking Deployment Status

# List Cloud Run revisions
gcloud run revisions list --service=gateway-processing-staging --region=us-east1 --project=pinpoint-gateway

# View logs
gcloud logging read 'resource.labels.service_name="gateway-processing-staging"' --project=pinpoint-gateway --limit=20 --format='value(jsonPayload.message)'

# Check health
curl https://staging-api.peakgateway.co/processing/health

Website Deployment

Websites deploy to Cloudflare Pages automatically on push to main:

WebsiteProduction URLStaging URL
Portalsupport.peakgateway.costaging-support.peakgateway.co
Checkoutcheckout.peakgateway.costaging-checkout.peakgateway.co
Merchant Portalmerchant.peakgateway.costaging-merchant.peakgateway.co
Marketingpeakgateway.costaging.peakgateway.co
Docsdocs.peakgateway.coN/A
Support Docssupport-docs.peakgateway.coN/A

Infrastructure Changes

Terraform manages all GCP infrastructure:

cd infra/terraform
terraform plan # Review changes
terraform apply # Apply (requires approval)

State is stored in Terraform Cloud (org: peaksystems, workspace: gateway).

Maintenance

Cleaning old Cloud Run revisions

# Dry run (default)
./infra/scripts/cleanup-cloud-run-revisions.sh \
--project pinpoint-gateway \
--region us-east1 \
--all-services \
--keep 3

# Apply
./infra/scripts/cleanup-cloud-run-revisions.sh \
--project pinpoint-gateway \
--region us-east1 \
--all-services \
--keep 3 \
--apply

This runs automatically hourly via .github/workflows/infra-maintenance.yml.

CI/CD Pipelines

WorkflowTriggerPurpose
ci.ymlPR, push to mainBuild + test all services/libs
deploy.ymlPush to main, release, manualBuild, push, deploy to Cloud Run
cloudflare-pages.ymlPush to mainBuild + deploy all websites
pre-commit.ymlPRLinting, formatting checks
iac-security.ymlinfra/** changesCheckov + Terraform validation
infra-maintenance.ymlHourlyClean old revisions + artifacts
sdk-publish.ymlGitHub releasePublish Kotlin SDK to Maven
sdk-npm-publish.ymlGitHub releasePublish TypeScript SDK to npm