|
| 1 | +# GitHub Actions Workflows |
| 2 | + |
| 3 | +## Active Workflows |
| 4 | + |
| 5 | +### `deploy-mig-staging.yml` - Production Deployment Pipeline |
| 6 | + |
| 7 | +**Purpose**: Deploy application to GCP Managed Instance Group (MIG) with Terraform |
| 8 | + |
| 9 | +**Trigger**: Manual (`workflow_dispatch`) |
| 10 | + |
| 11 | +**Required Input**: |
| 12 | +- `tag`: Docker image tag to deploy (e.g., `v1.0.2`) |
| 13 | + |
| 14 | +**What it does**: |
| 15 | +1. Builds Docker image from specified tag |
| 16 | +2. Pushes to Google Artifact Registry |
| 17 | +3. Updates Terraform configuration with new image tag |
| 18 | +4. Applies Terraform changes to update instance template |
| 19 | +5. Performs rolling restart of MIG instances |
| 20 | +6. Runs comprehensive health checks |
| 21 | +7. Verifies HTTPS endpoints and CORS headers |
| 22 | + |
| 23 | +**Environment**: `staging` |
| 24 | + |
| 25 | +**Required Secrets**: |
| 26 | +- `WIF_PROVIDER`: Workload Identity Federation provider |
| 27 | +- `WIF_SERVICE_ACCOUNT`: Service account email |
| 28 | + |
| 29 | +**Duration**: ~10-15 minutes |
| 30 | + |
| 31 | +**Usage**: |
| 32 | +```bash |
| 33 | +# Go to Actions tab in GitHub |
| 34 | +# Select "Deploy to GCP MIG Staging" |
| 35 | +# Click "Run workflow" |
| 36 | +# Enter tag: v1.0.2 |
| 37 | +# Click "Run workflow" |
| 38 | +``` |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +### Other Workflows |
| 43 | + |
| 44 | +- **`go-test.yml`**: Runs Go tests on pull requests |
| 45 | +- **`golangci-lint.yml`**: Runs linting checks |
| 46 | +- **`conventional-commits.yml`**: Validates commit messages |
| 47 | +- **`release.yml`**: Creates GitHub releases |
| 48 | +- **`clear_cache.yaml`**: Clears GitHub Actions cache |
| 49 | + |
| 50 | +## Deployment Flow |
| 51 | + |
| 52 | +``` |
| 53 | +Tag Release (v1.0.2) |
| 54 | + ↓ |
| 55 | +Trigger Workflow (Manual) |
| 56 | + ↓ |
| 57 | +Build & Push Image |
| 58 | + ↓ |
| 59 | +Update Terraform Config |
| 60 | + ↓ |
| 61 | +Apply Infrastructure Changes |
| 62 | + ↓ |
| 63 | +Rolling Restart MIG |
| 64 | + ↓ |
| 65 | +Health Checks & Verification |
| 66 | + ↓ |
| 67 | +Deployment Summary |
| 68 | +``` |
| 69 | + |
| 70 | +## Infrastructure Details |
| 71 | + |
| 72 | +- **Project**: `merkle-oracle-staging` |
| 73 | +- **MIG**: `merkle-oracle-node-mig-staging` |
| 74 | +- **Domain**: `https://merkle-staging4.zengate-dev.com` |
| 75 | +- **Registry**: `europe-west1-docker.pkg.dev/merkle-oracle-staging/merkle-oracle-node` |
| 76 | + |
| 77 | +## Endpoints Verified |
| 78 | + |
| 79 | +After deployment, these endpoints are automatically tested: |
| 80 | + |
| 81 | +- ✅ `/healthcheck` - Application health |
| 82 | +- ✅ `/objects` - API functionality |
| 83 | +- ✅ `/docs` - API documentation |
| 84 | +- ✅ `/docs/swagger.json` - OpenAPI spec |
| 85 | +- ✅ CORS headers - Cross-origin support |
| 86 | + |
| 87 | +## Rollback |
| 88 | + |
| 89 | +To rollback to a previous version: |
| 90 | +1. Trigger workflow with previous tag |
| 91 | +2. Wait for deployment to complete |
| 92 | +3. Verify endpoints |
| 93 | + |
| 94 | +## Monitoring |
| 95 | + |
| 96 | +View deployment status: |
| 97 | +- GitHub Actions: Real-time logs |
| 98 | +- GCP Console: Instance health and metrics |
| 99 | +- Application logs: Via SSH to instances |
| 100 | + |
| 101 | +## Notes |
| 102 | + |
| 103 | +- Old `deploy-gcp.yml` workflow has been removed (single-instance deployment) |
| 104 | +- New workflow uses MIG for production-ready deployments |
| 105 | +- Terraform manages all infrastructure |
| 106 | +- Zero-downtime deployments via rolling updates |
| 107 | +- Automatic health checks and rollback on failure |
0 commit comments