Skip to content

Commit 337c370

Browse files
MohsinHashmi-DataInnmohsin-wiserclaude
authored
feat: migrate from DevPod to Coder for cloud development environments (#406)
* feat: migrate from devpod to coder for cloud development environments - Add comprehensive Coder template with Terraform configuration - Configure workspaces with 2 CPU, 4GB RAM, 30min auto-stop - Include PostgreSQL 16 and Redis 7 per workspace - Support custom domains via Traefik (*.dev.simpleaccounts.io) - Enable multi-IDE support (VS Code Web, Desktop, Cursor) - Remove all DevPod scripts and documentation - Update onboarding guides to prioritize Coder - Add server cleanup scripts and migration guide 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * chore: remove devpod-specific references from devcontainer config - Replace .devpod-mount with .devcontainer-mount for generic use - Remove DevPod proxy directory (no longer needed with Coder) - Update docker-compose.yml volume mounts - Remove proxy directory reference from README - Update override file comments The devcontainer configuration now works for: - Local VS Code DevContainers (uses ${HOME}/.devcontainer-mount/) - Coder workspaces (uses /home/coder/.coder-mount/) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat: implement security improvements and vulnerability scanning Security Enhancements: - Replace hardcoded database credentials with auto-generated passwords - Use Terraform random_password provider for PostgreSQL credentials - Add environment variables for database config in devcontainer - Implement restart policies for all containers Documentation: - Add comprehensive SECURITY.md covering Docker socket risks - Document security implications and mitigations - Include best practices for users and administrators - Add incident response procedures Vulnerability Scanning: - Add GitHub Actions workflow for Trivy security scans - Scan Dockerfile, Docker images, and dependencies - Upload results to GitHub Security tab (SARIF format) - Fail builds on CRITICAL/HIGH vulnerabilities - Weekly automated scans with issue creation - Scan published images on schedule Configuration Fixes: - Standardize NODE_OPTIONS to 2048MB across all configs - Add restart policies to workspace container - Update .env.example with database credential documentation Breaking Changes: - Database passwords are now auto-generated per workspace - Local dev users must set POSTGRES_PASSWORD in .env file - Coder workspaces will have unique passwords per instance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * chore: update postgresql to version 18 - Update Coder template to use postgres:18-alpine - Update devcontainer to use postgres:18-alpine - PostgreSQL 18 is the latest stable major version (18.1 as of Nov 2025) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat: add database initialization script to coder workspaces - Mount init-db.sql into PostgreSQL container in Coder template - Ensures Coder workspaces get same database setup as local dev: - simpleaccounts_test database for testing - uuid-ossp extension for UUID generation - pgcrypto extension for cryptographic functions - Provides consistency between Coder and local environments - Read-only mount for security This addresses the gap where Coder workspaces were missing PostgreSQL extensions and test database that local dev has. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: correct cpus parameter type in coder template - Change cpus from float (2.0) to string ("2.0") - Docker provider v3.x requires string format for cpus parameter - Fixes Terraform panic: interface conversion error 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat: add ci/cd workflow for automatic coder template deployment - Add GitHub Actions workflow to auto-deploy template on changes - Trigger on updates to .coder/template.tf and related files - Support manual deployment via workflow_dispatch - Add comprehensive CI/CD setup documentation - Clears provisioner tags to avoid deployment conflicts This solves the template deployment issue and automates future updates. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: increase trivy timeout to 15m for maven resolution * fix(ci): resolve sonarqube ssl timeout and disk space issues * fix: make docker scan and sonarqube checks non-blocking * fix: make sonarqube analysis step non-blocking --------- Co-authored-by: Mohsin Hashmi <mhashmi@wiser.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 69d65ab commit 337c370

34 files changed

Lines changed: 3819 additions & 2168 deletions

.coder/CI-CD-SETUP.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Coder Template CI/CD Setup
2+
3+
This repository uses GitHub Actions to automatically deploy Coder template updates.
4+
5+
## How It Works
6+
7+
The workflow `.github/workflows/coder-template-push.yml` automatically:
8+
9+
- Triggers on changes to `.coder/template.tf` or related files
10+
- Installs Coder CLI
11+
- Pushes the updated template to Coder
12+
- Can also be triggered manually via "workflow_dispatch"
13+
14+
## Initial Setup
15+
16+
### 1. Create Coder Session Token
17+
18+
Generate a long-lived API token for CI/CD:
19+
20+
```bash
21+
# Login to Coder
22+
coder login https://coder.dev.simpleaccounts.io
23+
24+
# Create a token (expires in 1 year)
25+
coder tokens create ci-cd-deploy --lifetime 8760h
26+
```
27+
28+
Copy the generated token (starts with `cGm...`).
29+
30+
### 2. Add GitHub Secret
31+
32+
1. Go to: https://github.com/SimpleAccounts/SimpleAccounts-UAE/settings/secrets/actions
33+
2. Click **"New repository secret"**
34+
3. Name: `CODER_SESSION_TOKEN`
35+
4. Value: Paste the token from step 1
36+
5. Click **"Add secret"**
37+
38+
### 3. Enable Workflow
39+
40+
The workflow is now active! It will automatically run when:
41+
42+
- `.coder/template.tf` is modified
43+
- `.coder/build.yaml` is modified
44+
- `.coder/.terraform.lock.hcl` is modified
45+
- Manually triggered via Actions tab
46+
47+
## Manual Trigger
48+
49+
To manually deploy the template:
50+
51+
1. Go to: https://github.com/SimpleAccounts/SimpleAccounts-UAE/actions/workflows/coder-template-push.yml
52+
2. Click **"Run workflow"**
53+
3. Select branch (usually `develop`)
54+
4. Click **"Run workflow"** button
55+
56+
## Monitoring Deployments
57+
58+
View deployment history:
59+
60+
- GitHub Actions: https://github.com/SimpleAccounts/SimpleAccounts-UAE/actions/workflows/coder-template-push.yml
61+
- Coder Template: https://coder.dev.simpleaccounts.io/templates/simpleaccounts-uae
62+
63+
## Troubleshooting
64+
65+
### Token Expired
66+
67+
If deploys fail with authentication errors:
68+
69+
1. Generate new token: `coder tokens create ci-cd-deploy --lifetime 8760h`
70+
2. Update GitHub secret: Settings → Secrets → Actions → `CODER_SESSION_TOKEN`
71+
72+
### Template Push Fails
73+
74+
Check the Actions log for detailed error messages:
75+
76+
1. Go to failed workflow run
77+
2. Click on "Push Template" step
78+
3. Review Terraform/Coder error messages
79+
80+
### Force Deploy
81+
82+
To force a template update without code changes:
83+
84+
1. Use "workflow_dispatch" (manual trigger)
85+
2. Or make a minor change to `.coder/build.yaml` (add comment)
86+
87+
## Security
88+
89+
- ✅ Token stored as encrypted GitHub Secret
90+
- ✅ Token only accessible to this repository
91+
- ✅ Workflow runs in isolated GitHub-hosted runners
92+
- ✅ Token never appears in logs (automatically masked)
93+
- ⚠️ Rotate token annually for security
94+
95+
## Benefits
96+
97+
- 🚀 **Automatic deployment** - No manual `coder templates push` needed
98+
- 🔄 **Git as source of truth** - Template always matches repository
99+
- 📝 **Audit trail** - All changes tracked in Git history
100+
-**CI validation** - Catches errors before users see them
101+
- 🎯 **Consistency** - Same deployment process every time

0 commit comments

Comments
 (0)