Landing page cookbook implementation (Weeks 1-4): Domain Infrastructure: - Add project_domains table with migration (013_project_domains.sql) - Add ProjectDomain model with domain types (primary_auto, primary_custom, alias) - Add SlugGenerator and ProjectDomainRepository interfaces - Implement postgres adapters for domain and slug management Service Layer: - Add domain CRUD methods to ProjectInfraService - Generate 8-char random slugs for auto-domains - Support custom subdomains during project creation - Add site_live health check to project status - Trigger CI build after template seeding Handler Updates: - Add DomainService interface and adapter pattern - Rewrite domain handlers to use database-backed service - Add proper error handling for duplicate/missing domains CI Integration: - Add TriggerBuild to CIProvider interface - Implement TriggerBuild in Woodpecker adapter - Manually trigger initial build after template seed Cookbook & Scripts: - Add landing-test.sh script for E2E testing - Add release.sh for version releases - Add logs.sh for quick log access Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
6.3 KiB
6.3 KiB
rdev - Remote Developer
Run Claude Code instances in isolated Kubernetes pods with REST API control. Enables bots, CI/CD systems, and external orchestrators to dispatch agentive development work to isolated environments.
Platform: threesix.ai - Agent-driven development at scale with shared worker pools.
Find Your Guide
| If you need to... | Read this |
|---|---|
| Set up local dev | local/setup.md |
| Run tests | local/testing.md |
| Write Go code / handlers | backend/go-guidelines.md |
| Understand pkg/api | packages/api-framework.md |
| Add a new handler/endpoint | backend/adding-handlers.md |
| Understand hexagonal architecture | backend/hexagonal.md |
| Deploy to k3s | ops/deploying.md |
| Release a new version | ops/releasing.md |
| Work with Kubernetes adapters | services/kubernetes.md |
| Database / migrations | ops/database.md |
| Manage credentials | ops/credentials.md |
| Work queue system | services/work-queue.md |
| Worker pool management | services/worker-pool.md |
| Project templates | services/templates.md |
| Build orchestration | services/build-orchestration.md |
Critical Rules
- KUBECONFIG: ALWAYS set
export KUBECONFIG=~/.kube/orchard9-k3sf.yamlbefore kubectl commands - Hexagonal: Domain models in
internal/domain/must have ZERO external dependencies - Ports: All adapters implement interfaces from
internal/port/ - Migrations: NEVER modify committed migrations. Create NEW ones.
- 500-line limit: Files exceeding 500 lines must be split
- Tests: All handlers and services require tests
Quick Reference
# Required env vars (add to ~/.zshrc)
export KUBECONFIG=~/.kube/orchard9-k3sf.yaml
export RDEV_API_URL="https://rdev.masq-ops.orchard9.ai"
export RDEV_API_KEY="<from rdev-credentials secret>"
# Run locally
go run ./cmd/rdev-api
# Run tests
go test ./...
# Release new version
./scripts/release.sh v0.8.1 "Description of changes"
# Deploy (after release)
kubectl apply -f deployments/k8s/base/rdev-api.yaml
kubectl rollout restart -n rdev deployment/rdev-api
# Verify pods
kubectl get pods -n rdev
# View logs
./scripts/logs.sh # Last 100 lines
./scripts/logs.sh -f # Follow/stream
./scripts/logs.sh -n 500 # Last 500 lines
./scripts/logs.sh -e # Errors only
./scripts/logs.sh -p # Previous crashed container
# Shell aliases (after source ~/.zshrc)
rdev-logs # Last 100 lines
rdev-logs-f # Follow/stream
rdev-pods # List pods
# API calls (NOTE: $RDEV_API_KEY doesn't expand in curl -H, use the test script instead)
# ./cookbooks/scripts/landing-test.sh run|status|teardown <name>
curl -H "X-API-Key: $RDEV_API_KEY" $RDEV_API_URL/health
curl -H "X-API-Key: $RDEV_API_KEY" $RDEV_API_URL/projects
curl -H "X-API-Key: $RDEV_API_KEY" $RDEV_API_URL/work/stats
Architecture Overview
cmd/rdev-api/ # Entry point, DI, OpenAPI spec
internal/
├── domain/ # Pure business models (no deps)
├── port/ # Interface contracts
├── service/ # Business logic orchestration
├── handlers/ # HTTP handlers (REST endpoints)
├── adapter/ # Infrastructure implementations
│ ├── kubernetes/ # K8s client, pod executor
│ ├── postgres/ # Audit, queue, webhooks, credentials
│ ├── gitea/ # Git repository management
│ ├── cloudflare/ # DNS provider
│ └── woodpecker/ # CI provider
├── auth/ # API key auth, scopes
├── middleware/ # Rate limiting
├── worker/ # Background queue processor
└── webhook/ # Event dispatcher
pkg/api/ # HTTP framework (app, responses)
deployments/k8s/ # Kustomize manifests
└── base/templates/ # Project templates
scripts/ # Operational scripts
├── load-credentials.sh # Load secrets to rdev-api
├── release.sh # Build, tag, push releases
└── logs.sh # View rdev-api logs
cookbooks/ # End-to-end workflow guides
├── landing-page.md # Landing page deployment flow
└── scripts/ # Executable cookbook scripts
Key Concepts
- Projects: Kubernetes pods with Claude Code, discovered by label
rdev.orchard9.ai/project=true - Workers: Shared claudebox pods that execute any project's tasks, labeled
rdev.orchard9.ai/role=worker - Work Queue: Async task queue for build/test/deploy jobs
- Credentials: Infrastructure secrets (tokens, keys) stored encrypted in PostgreSQL
- Commands: Claude/shell/git commands executed via kubectl exec, streamed via SSE
- API Keys: Scoped auth with project restrictions, IP filtering, expiration
- Webhooks: Event subscriptions with retry delivery
- Templates: Project scaffolding with .woodpecker.yml, .claude/, and stack files
threesix.ai Platform Status
| Feature | Status | Description |
|---|---|---|
| Woodpecker Auto-Activation | Done | CI enabled on project creation via SDK |
| Project Templates | Done | Embedded templates (astro-landing, go-api, default) |
| Work Queue | Done | PostgreSQL with atomic dequeue, retry logic |
| Multi-Provider Agents | Done | Claude Code + OpenCode via registry |
| Webhooks | Done | Event dispatcher with retry delivery |
| Embedded Worker | Done | Goroutine in rdev-api, polls queue |
| Build Orchestration | Planned | Structured build specs via API |
Constraints
- ON-PREM k3s - not GKE, always set KUBECONFIG
- Kustomize only - no ArgoCD
- chi/v5 router - no gin, echo, or other frameworks
- sqlx for DB - no GORM
- slog for logging - no logrus, zap