FOUNDRY
C8 Platform
← Tasks

Rebrand: Update Dockerfile + Cloud Run service names

completedcode_genP2weekend-jack-poc

Description

Update Dockerfile, Dockerfile.heartbeat, .gcloudignore references from dutypay to c8. Plan Cloud Run service rename with zero-downtime migration.
Assignee
Cloud Lu
Claimed By
Cloud Lu → Claude Sonnet
Created
13h ago
Completed
11h ago

Quality

Overall
72%
Pass
PASS
Graded By
-
Graded At
-

Cost

Input Tokens
-
Output Tokens
-
Est. USD
-

Result

{
  "cost": {
    "input_tokens": 57,
    "estimated_usd": 0.039066,
    "output_tokens": 2593
  },
  "model": "claude-sonnet-4-20250514",
  "status": "success",
  "transport": "anthropic_api",
  "latency_ms": 34824,
  "response_text": "I'll help you rebrand from dutypay to c8 with a comprehensive update plan and zero-downtime migration strategy.\n\n## 1. Dockerfile Updates\n\n### Main Dockerfile\n```dockerfile\n# Before: dutypay references\nFROM node:18-alpine\nWORKDIR /app\nCOPY package*.json ./\nRUN npm ci --only=production\nCOPY . .\nEXPOSE 8080\nCMD [\"npm\", \"start\"]\n\n# After: c8 references\nFROM node:18-alpine\nWORKDIR /app\nCOPY package*.json ./\nRUN npm ci --only=production\nCOPY . .\nEXPOSE 8080\nCMD [\"npm\", \"start\"]\n# Update any internal labels or environment variables\nLABEL app=\"c8\"\nENV APP_NAME=\"c8\"\n```\n\n### Dockerfile.heartbeat\n```dockerfile\n# Before\nFROM node:18-alpine\nWORKDIR /app\nCOPY heartbeat/package*.json ./\nRUN npm ci --only=production\nCOPY heartbeat/ .\nEXPOSE 8080\nCMD [\"node\", \"index.js\"]\n\n# After\nFROM node:18-alpine\nWORKDIR /app\nCOPY heartbeat/package*.json ./\nRUN npm ci --only=production\nCOPY heartbeat/ .\nEXPOSE 8080\nLABEL app=\"c8-heartbeat\"\nENV APP_NAME=\"c8-heartbeat\"\nCMD [\"node\", \"index.js\"]\n```\n\n## 2. .gcloudignore Updates\n\n```bash\n# .gcloudignore\n# Before: dutypay-specific ignores\n.git\n.gitignore\nREADME.md\nDockerfile\n.dockerignore\nnode_modules\nnpm-debug.log\n.nyc_output\n.coverage\n*.log\ndutypay-local/\ndutypay-dev/\n\n# After: c8-specific ignores\n.git\n.gitignore\nREADME.md\nDockerfile\n.dockerignore\nnode_modules\nnpm-debug.log\n.nyc_output\n.coverage\n*.log\nc8-local/\nc8-dev/\n```\n\n## 3. Zero-Downtime Migration Plan\n\n### Phase 1: Preparation\n```bash\n# 1. Create new Cloud Run services with c8 naming\ngcloud run deploy c8-api \\\n  --image gcr.io/PROJECT_ID/c8:latest \\\n  --platform managed \\\n  --region us-central1 \\\n  --allow-unauthenticated \\\n  --port 8080 \\\n  --memory 1Gi \\\n  --cpu 1 \\\n  --min-instances 1 \\\n  --max-instances 10 \\\n  --no-traffic\n\ngcloud run deploy c8-heartbeat \\\n  --image gcr.io/PROJECT_ID/c8-heartbeat:latest \\\n  --platform managed \\\n  --region us-central1 \\\n  --allow-unauthenticated \\\n  --port 8080 \\\n  --memory 512Mi \\\n  --cpu 1 \\\n  --min-instances 1 \\\n  --max-instances 5 \\\n  --no-traffic\n```\n\n### Phase 2: Build and Deploy New Images\n```bash\n#!/bin/bash\n# build-and-deploy.sh\n\nPROJECT_ID=\"your-project-id\"\nREGION=\"us-central1\"\n\n# Build new images with c8 branding\ndocker build -t gcr.io/$PROJECT_ID/c8:latest .\ndocker build -f Dockerfile.heartbeat -t gcr.io/$PROJECT_ID/c8-heartbeat:latest .\n\n# Push images\ndocker push gcr.io/$PROJECT_ID/c8:latest\ndocker push gcr.io/$PROJECT_ID/c8-heartbeat:latest\n\n# Deploy to new services\ngcloud run deploy c8-api \\\n  --image gcr.io/$PROJECT_ID/c8:latest \\\n  --platform managed \\\n  --region $REGION\n\ngcloud run deploy c8-heartbeat \\\n  --image gcr.io/$PROJECT_ID/c8-heartbeat:latest \\\n  --platform managed \\\n  --region $REGION\n```\n\n### Phase 3: Traffic Migration Strategy\n\n#### Option A: Gradual Traffic Split\n```bash\n# Get new service URLs\nC8_API_URL=$(gcloud run services describe c8-api --region=us-central1 --format='value(status.url)')\nC8_HEARTBEAT_URL=$(gcloud run services describe c8-heartbeat --region=us-central1 --format='value(status.url)')\n\n# Configure load balancer or API Gateway to split traffic\n# 10% to new services\ngcloud compute url-maps add-path-matcher dutypay-to-c8-migration \\\n  --path-matcher-name=c8-migration \\\n  --default-service=dutypay-backend \\\n  --backend-service-path-rules=\"/api/v2/*=c8-api-backend:10\"\n\n# Gradually increase: 25%, 50%, 75%, 100%\n```\n\n#### Option B: Blue-Green Deployment\n```bash\n#!/bin/bash\n# blue-green-migration.sh\n\n# Step 1: Deploy new version (Green)\necho \"Deploying Green environment (c8)...\"\ngcloud run services update-traffic c8-api --to-latest=100\ngcloud run services update-traffic c8-heartbeat --to-latest=100\n\n# Step 2: Update DNS/Load Balancer\necho \"Updating load balancer to point to c8 services...\"\n# Update your load balancer configuration here\n\n# Step 3: Verify health\necho \"Verifying new services...\"\ncurl -f $C8_API_URL/health || exit 1\ncurl -f $C8_HEARTBEAT_URL/health || exit 1\n\necho \"Migration completed successfully!\"\n```\n\n## 4. Configuration Updates\n\n### Cloud Build Configuration\n```yaml\n# cloudbuild.yaml\nsteps:\n  # Build main application\n  - name: 'gcr.io/cloud-builders/docker'\n    args: ['build', '-t', 'gcr.io/$PROJECT_ID/c8:$COMMIT_SHA', '.']\n  \n  # Build heartbeat service\n  - name: 'gcr.io/cloud-builders/docker'\n    args: ['build', '-f', 'Dockerfile.heartbeat', '-t', 'gcr.io/$PROJECT_ID/c8-heartbeat:$COMMIT_SHA', '.']\n  \n  # Push images\n  - name: 'gcr.io/cloud-builders/docker'\n    args: ['push', 'gcr.io/$PROJECT_ID/c8:$COMMIT_SHA']\n  \n  - name: 'gcr.io/cloud-builders/docker'\n    args: ['push', 'gcr.io/$PROJECT_ID/c8-heartbeat:$COMMIT_SHA']\n  \n  # Deploy to Cloud Run\n  - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'\n    entrypoint: 'gcloud'\n    args:\n      - 'run'\n      - 'deploy'\n      - 'c8-api'\n      - '--image'\n      - 'gcr.io/$PROJECT_ID/c8:$COMMIT_SHA'\n      - '--region'\n      - 'us-central1'\n      - '--platform'\n      - 'managed'\n```\n\n### Terraform Configuration (if using)\n```hcl\n# main.tf\nresource \"google_cloud_run_service\" \"c8_api\" {\n  name     = \"c8-api\"\n  location = var.region\n\n  template {\n    spec {\n      containers {\n        image = \"gcr.io/${var.project_id}/c8:latest\"\n        ports {\n          container_port = 8080\n        }\n        \n        env {\n          name  = \"APP_NAME\"\n          value = \"c8\"\n        }\n      }\n    }\n    \n    metadata {\n      annotations = {\n        \"autoscaling.knative.dev/maxScale\" = \"10\"\n        \"autoscaling.knative.dev/minScale\" = \"1\"\n      }\n    }\n  }\n}\n\nresource \"google_cloud_run_service\" \"c8_heartbeat\" {\n  name     = \"c8-heartbeat\"\n  location = var.region\n\n  template {\n    spec {\n      containers {\n        image = \"gcr.io/${var.project_id}/c8-heartbeat:latest\"\n        ports {\n          container_port = 8080\n        }\n      }\n    }\n  }\n}\n```\n\n## 5. Monitoring and Rollback Plan\n\n### Health Check Script\n```bash\n#!/bin/bash\n# health-check.sh\n\nC8_API_URL=$(gcloud run services describe c8-api --region=us-central1 --format='value(status.url)')\nC8_HEARTBEAT_URL=$(gcloud run services describe c8-heartbeat --region=us-central1 --format='value(status.url)')\n\necho \"Checking c8-api health...\"\nif ! curl -f \"$C8_API_URL/health\"; then\n    echo \"c8-api health check failed!\"\n    exit 1\nfi\n\necho \"Checking c8-heartbeat health...\"\nif ! curl -f \"$C8_HEARTBEAT_URL/health\"; then\n    echo \"c8-heartbeat health check failed!\"\n    exit 1\nfi\n\necho \"All services are healthy!\"\n```\n\n### Rollback Script\n```bash\n#!/bin/bash\n# rollback.sh\n\necho \"Rolling back to dutypay services...\"\n\n# Revert load balancer to point to old services\n# Update DNS entries\n# Scale down c8 services\n\ngcloud run services update-traffic dutypay-api --to-latest=100\ngcloud run services update-traffic dutypay-heartbeat --to-latest=100\n\necho \"Rollback completed!\"\n```\n\n## 6. Migration Checklist\n\n- [ ] Update Dockerfile with c8 branding\n- [ ] Update Dockerfile.heartbeat with c8 branding  \n- [ ] Update .gcloudignore file\n- [ ] Build and push new container images\n- [ ] Deploy new Cloud Run services with --no-traffic\n- [ ] Test new services thoroughly\n- [ ] Update load balancer/DNS configuration\n- [ ] Implement traffic splitting (10% → 25% → 50% → 75% → 100%)\n- [ ] Monitor error rates and performance\n- [ ] Update CI/CD pipelines\n- [ ] Update documentation and API endpoints\n- [ ] Clean up old dutypay services after successful migration\n- [ ] Update monitoring and alerting configurations\n\nThis plan ensures zero-downtime migration while maintaining full rollback capabilities at each step."
}
Task ID: 1c90cfd6-37c2-4759-be14-623a012f3619