|
| 1 | +# Groundwork Platform Adoption |
| 2 | + |
| 3 | +This pull request integrates your existing service with the Groundwork platform, enabling automated CI/CD, GitOps deployment, and compliance evidence collection. |
| 4 | + |
| 5 | +## What's Been Added |
| 6 | + |
| 7 | +### 1. CI/CD Pipeline (`.github/workflows/ci.yaml`) |
| 8 | + |
| 9 | +- Wraps Groundwork reusable workflows for consistency |
| 10 | +- Tests your existing code |
| 11 | +- Builds container image from your existing Dockerfile (`CompendiumUI/Dockerfile`) |
| 12 | +- Generates evidence artifacts: |
| 13 | + - **SBOM** (Software Bill of Materials) |
| 14 | + - **Vulnerability scan** (Trivy) |
| 15 | + - **Image signature** (Cosign) |
| 16 | + - **SLSA provenance** (build integrity attestation) |
| 17 | +- Pushes signed image to ECR |
| 18 | + |
| 19 | +### 2. Backstage Catalog Registration (`catalog-info.yaml`) |
| 20 | + |
| 21 | +- Registers service in Backstage developer portal |
| 22 | +- Links to source code, environment config, and ArgoCD |
| 23 | +- Provides service metadata for discovery and documentation |
| 24 | + |
| 25 | +### 3. Environment Configuration (Separate Repository) |
| 26 | + |
| 27 | +A new repository `env-config-copyright-compendium` has been created with: |
| 28 | + |
| 29 | +- **Kustomize overlays** for dev/stage/prod environments |
| 30 | +- **ArgoCD Applications** for GitOps deployment |
| 31 | +- **Kargo Stages** for progressive promotion (dev → stage → prod) |
| 32 | +- **Network policies** and security configurations |
| 33 | + |
| 34 | +## Required Changes Before Merging |
| 35 | + |
| 36 | +### ✅ Health Endpoints |
| 37 | + |
| 38 | +Ensure your service exposes these endpoints for Kubernetes health checks: |
| 39 | + |
| 40 | +#### Liveness Probe: `/health` |
| 41 | + |
| 42 | +Returns 200 OK if the service process is running. |
| 43 | + |
| 44 | +**Example responses by language**: |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +```javascript |
| 49 | +app.get("/health", (req, res) => { |
| 50 | + res.json({ status: "healthy" }); |
| 51 | +}); |
| 52 | +``` |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +#### Readiness Probe: `/ready` |
| 57 | + |
| 58 | +Returns 200 OK if ready to accept traffic, 503 if not ready (e.g., waiting for database). |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +```javascript |
| 63 | +app.get('/ready', async (req, res) => { |
| 64 | + // Check dependencies |
| 65 | + |
| 66 | + res.json({ status: 'ready' }); |
| 67 | +}); |
| 68 | +``` |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +### ✅ Dockerfile Verification |
| 73 | + |
| 74 | +Verify that `CompendiumUI/Dockerfile` exists and builds correctly: |
| 75 | + |
| 76 | +```bash |
| 77 | +docker build -f CompendiumUI/Dockerfile -t copyright-compendium:test . |
| 78 | +docker run -p 8080:8080 copyright-compendium:test |
| 79 | +``` |
| 80 | + |
| 81 | +Test the health endpoints: |
| 82 | + |
| 83 | +```bash |
| 84 | +curl http://localhost:8080/health |
| 85 | +curl http://localhost:8080/ready |
| 86 | +``` |
| 87 | + |
| 88 | +### ✅ Port Configuration |
| 89 | + |
| 90 | +Verify the service listens on port `8080`. If this is incorrect, update: |
| 91 | + |
| 92 | +- This PR: `.github/workflows/ci.yaml` (if needed for testing) |
| 93 | +- Environment config: `env-config-copyright-compendium/kustomize/base/values.yaml` |
| 94 | + |
| 95 | +### ✅ Test Configuration |
| 96 | + |
| 97 | +The CI workflow includes a test job. Verify the test commands are appropriate for your service: |
| 98 | + |
| 99 | +- Review `.github/workflows/ci.yaml` |
| 100 | +- Update test commands if needed for your specific setup |
| 101 | +- Ensure tests run successfully: `git checkout groundwork-adoption && [run your test command]` |
| 102 | + |
| 103 | +## What Happens After Merging |
| 104 | + |
| 105 | +1. **Automatic Build on Push to Main**: |
| 106 | + - GitHub Actions triggers on commits to `main` |
| 107 | + - Runs tests, builds container image |
| 108 | + - Scans for vulnerabilities (Trivy) |
| 109 | + - Signs image with Cosign (keyless signing) |
| 110 | + - Generates SBOM and SLSA provenance |
| 111 | + - Pushes to ECR: `<account>.dkr.ecr.us-east-1.amazonaws.com/copyright-compendium:latest` |
| 112 | + |
| 113 | +2. **Evidence Storage**: |
| 114 | + - All artifacts stored in S3 evidence bucket |
| 115 | + - Immutable Object Lock prevents tampering |
| 116 | + - Used for compliance audits and promotion gates |
| 117 | + |
| 118 | +3. **Ready for GitOps Deployment**: |
| 119 | + - Configure deployment in `env-config-copyright-compendium` |
| 120 | + - ArgoCD watches for changes and deploys to dev |
| 121 | + - Use Kargo to promote to stage/prod |
| 122 | + |
| 123 | +## Next Steps After Merge |
| 124 | + |
| 125 | +### 1. Configure Deployment |
| 126 | + |
| 127 | +Clone the environment config repository: |
| 128 | + |
| 129 | +```bash |
| 130 | +git clone https://github.com/adhocteam/env-config-copyright-compendium.git |
| 131 | +cd env-config-copyright-compendium |
| 132 | +``` |
| 133 | + |
| 134 | +Update deployment configuration: |
| 135 | + |
| 136 | +- **Image repository**: Verify ECR repository name in `kustomize/base/values.yaml` |
| 137 | +- **Port**: Ensure service port matches (`8080`) |
| 138 | +- **Environment variables**: Add any required env vars |
| 139 | +- **Resources**: Set CPU/memory limits based on your service's needs |
| 140 | + |
| 141 | + |
| 142 | +### 2. Deploy to Dev Environment |
| 143 | + |
| 144 | +Push changes to the env-config repository: |
| 145 | + |
| 146 | +```bash |
| 147 | +git add . |
| 148 | +git commit -m "Configure copyright-compendium deployment" |
| 149 | +git push origin main |
| 150 | +``` |
| 151 | + |
| 152 | +ArgoCD will automatically deploy to dev environment within minutes. |
| 153 | + |
| 154 | +Monitor deployment: |
| 155 | + |
| 156 | +```bash |
| 157 | +# Watch ArgoCD application |
| 158 | +kubectl get application copyright-compendium -n argocd --watch |
| 159 | + |
| 160 | +# Check pod status |
| 161 | +kubectl get pods -n copyright-compendium-dev |
| 162 | + |
| 163 | +# View logs |
| 164 | +kubectl logs -l app=copyright-compendium -n copyright-compendium-dev --follow |
| 165 | +``` |
| 166 | + |
| 167 | +### 3. Test Dev Deployment |
| 168 | + |
| 169 | +Once deployed, verify the service is healthy: |
| 170 | + |
| 171 | +```bash |
| 172 | +# Port-forward to test locally |
| 173 | +kubectl port-forward -n copyright-compendium-dev svc/copyright-compendium 8080:80 |
| 174 | + |
| 175 | +# Test endpoints |
| 176 | +curl http://localhost:8080/health |
| 177 | +curl http://localhost:8080/ready |
| 178 | +``` |
| 179 | + |
| 180 | +Or access via ingress/load balancer (if configured). |
| 181 | + |
| 182 | +### 4. Promote to Stage/Prod |
| 183 | + |
| 184 | +Use Kargo to promote between environments: |
| 185 | + |
| 186 | +```bash |
| 187 | +# Promote to stage (via Kargo CLI or UI) |
| 188 | +kargo promote --stage stage --project copyright-compendium |
| 189 | + |
| 190 | +# Promotion includes compliance checks: |
| 191 | +# - Image signature verification |
| 192 | +# - Vulnerability scan thresholds |
| 193 | +# - SLSA provenance validation |
| 194 | + |
| 195 | +# After validation in stage, promote to prod |
| 196 | +kargo promote --stage prod --project copyright-compendium |
| 197 | +``` |
| 198 | + |
| 199 | +Or use the Kargo UI: `https://kargo.mvp.groundwork.adhoc.dev` |
| 200 | + |
| 201 | + |
| 202 | +## Troubleshooting |
| 203 | + |
| 204 | +### Build Failing |
| 205 | + |
| 206 | +**Tests failing**: |
| 207 | + |
| 208 | +- Review test configuration in `.github/workflows/ci.yaml` |
| 209 | +- Run tests locally to debug |
| 210 | +- Check for missing dependencies or environment variables |
| 211 | + |
| 212 | +**Dockerfile build failing**: |
| 213 | + |
| 214 | +- Verify `CompendiumUI/Dockerfile` path is correct |
| 215 | +- Test build locally: `docker build -f CompendiumUI/Dockerfile .` |
| 216 | +- Check for syntax errors or missing files |
| 217 | + |
| 218 | +**Vulnerability scan blocking**: |
| 219 | + |
| 220 | +- Review Trivy scan results in GitHub Actions logs |
| 221 | +- Update dependencies with known vulnerabilities |
| 222 | +- For dev environment, you can temporarily disable `fail_on_critical` |
| 223 | + |
| 224 | +### Deployment Issues |
| 225 | + |
| 226 | +**ArgoCD not syncing**: |
| 227 | + |
| 228 | +- Check Application status: `kubectl get application copyright-compendium -n argocd` |
| 229 | +- Review ArgoCD logs for errors |
| 230 | +- Verify repository access and credentials |
| 231 | + |
| 232 | +**Pods crash looping**: |
| 233 | + |
| 234 | +- Check logs: `kubectl logs -l app=copyright-compendium -n <namespace>` |
| 235 | +- Verify health endpoints return 200 |
| 236 | +- Check for missing environment variables or configuration |
| 237 | + |
| 238 | + |
| 239 | +**Health check failures**: |
| 240 | + |
| 241 | +- Ensure `/health` and `/ready` endpoints exist and return 200 |
| 242 | +- Check readiness probe: `kubectl describe pod <pod-name>` |
| 243 | +- Port configuration mismatch: verify service listens on `8080` |
| 244 | + |
| 245 | +### Promotion Blocked |
| 246 | + |
| 247 | +**Pre-deploy verifier rejecting**: |
| 248 | + |
| 249 | +- Image not signed: Check Cosign signing in CI logs |
| 250 | +- Vulnerability threshold exceeded: Review and remediate CVEs |
| 251 | +- SLSA provenance missing: Ensure evidence pipeline completed |
| 252 | + |
| 253 | +**Check evidence artifacts**: |
| 254 | + |
| 255 | +```bash |
| 256 | +# List evidence in S3 |
| 257 | +aws s3 ls s3://<evidence-bucket>/mvp/copyright-compendium/ |
| 258 | +``` |
| 259 | + |
| 260 | +## Resources |
| 261 | + |
| 262 | +- **Original Repository**: https://github.com/adhocteam/copyright-compendium |
| 263 | +- **Environment Config**: https://github.com/adhocteam/env-config-copyright-compendium |
| 264 | +- **Platform Documentation**: [Adoption User Story](https://github.com/adhocteam/groundwork-redux/docs/user-stories/adopt-existing-service.md) |
| 265 | +- **Developer Guide**: [Groundwork Developer Guide](https://github.com/adhocteam/groundwork-redux/docs/guides/dev_guide.md) |
| 266 | + |
| 267 | +## Support |
| 268 | + |
| 269 | +- **File Issues**: [groundwork-redux/issues](https://github.com/adhocteam/groundwork-redux/issues) |
| 270 | +- **Slack**: #groundwork-support |
| 271 | + |
| 272 | +--- |
| 273 | + |
| 274 | +**Created by**: Backstage `adopt-existing-service` template |
| 275 | +**Service**: copyright-compendium |
| 276 | +**Language**: nodejs |
| 277 | +**Port**: 8080 |
0 commit comments