feat: Phase 3 — Runtime Orchestration + Environments #33

Merged
hsiegeln merged 21 commits from feat/phase-3-runtime-orchestration into main 2026-04-04 18:10:43 +02:00
Owner

Summary

Phase 3 delivers the core product differentiator: managed Camel runtime. Customers upload a JAR, the platform builds an immutable container image with the cameleer3 agent auto-injected, and deploys it to a logical environment.

  • Environment CRUD with tier-enforced limits (LOW=1, MID=2, HIGH+=unlimited). Default environment auto-created on tenant provisioning.
  • App CRUD with JAR upload — multipart upload, SHA-256 checksum, relative storage paths, tier-enforced app limits.
  • Async deployment pipelinePOST /deploy returns 202, background thread builds image (~1-3s via pre-built base), starts container with cgroups resource constraints, polls agent health. Status polling via GET /deployments/{id}.
  • RuntimeOrchestrator interface with DockerRuntimeOrchestrator (docker-java). K8s implementation deferred to Phase 5.
  • Container logs → ClickHouse — stdout/stderr captured via docker-java, buffered writes to ClickHouse, query API.
  • previous_deployment_id for rollback tracking.
  • Container naming: {tenant}-{env}-{app} for human-readable docker ps.
  • cameleer-runtime-base Dockerfile — JRE 21 + agent JAR, customer image is single-layer add.

New API endpoints

Method Path Purpose
POST /api/tenants/{tid}/environments Create environment
GET /api/tenants/{tid}/environments List environments
GET/PATCH/DELETE /api/tenants/{tid}/environments/{eid} Get/rename/delete
POST /api/environments/{eid}/apps Create app + upload JAR
GET /api/environments/{eid}/apps List apps
GET/DELETE /api/environments/{eid}/apps/{aid} Get/delete app
PUT /api/environments/{eid}/apps/{aid}/jar Re-upload JAR
POST /api/apps/{aid}/deploy Deploy (async, 202)
GET /api/apps/{aid}/deployments Deployment history
GET /api/apps/{aid}/deployments/{did} Poll deployment status
POST /api/apps/{aid}/stop Stop current deployment
POST /api/apps/{aid}/restart Restart (stop + redeploy)
GET /api/apps/{aid}/logs Query container logs

Stats

  • 53 files changed, +2941 lines
  • 39 unit tests + 13 integration tests = 52 tests, 0 failures
  • 3 new Flyway migrations (V007-V009)
  • New dependencies: docker-java 3.4.1, clickhouse-jdbc 0.7.1

Test plan

  • 39 unit tests pass (Mockito — services, config, orchestrator)
  • 13 integration tests pass (TestContainers PostgreSQL — controllers)
  • All 9 Flyway migrations apply cleanly
  • Docker client initializes against Docker Desktop
  • Manual: upload sample Camel JAR, deploy, verify container starts with agent
  • CI pipeline passes

Closes #26

🤖 Generated with Claude Code

## Summary Phase 3 delivers the core product differentiator: **managed Camel runtime**. Customers upload a JAR, the platform builds an immutable container image with the cameleer3 agent auto-injected, and deploys it to a logical environment. - **Environment CRUD** with tier-enforced limits (LOW=1, MID=2, HIGH+=unlimited). Default environment auto-created on tenant provisioning. - **App CRUD with JAR upload** — multipart upload, SHA-256 checksum, relative storage paths, tier-enforced app limits. - **Async deployment pipeline** — `POST /deploy` returns 202, background thread builds image (~1-3s via pre-built base), starts container with cgroups resource constraints, polls agent health. Status polling via `GET /deployments/{id}`. - **RuntimeOrchestrator interface** with `DockerRuntimeOrchestrator` (docker-java). K8s implementation deferred to Phase 5. - **Container logs → ClickHouse** — stdout/stderr captured via docker-java, buffered writes to ClickHouse, query API. - **previous_deployment_id** for rollback tracking. - **Container naming**: `{tenant}-{env}-{app}` for human-readable `docker ps`. - **cameleer-runtime-base Dockerfile** — JRE 21 + agent JAR, customer image is single-layer add. ### New API endpoints | Method | Path | Purpose | |--------|------|---------| | POST | `/api/tenants/{tid}/environments` | Create environment | | GET | `/api/tenants/{tid}/environments` | List environments | | GET/PATCH/DELETE | `/api/tenants/{tid}/environments/{eid}` | Get/rename/delete | | POST | `/api/environments/{eid}/apps` | Create app + upload JAR | | GET | `/api/environments/{eid}/apps` | List apps | | GET/DELETE | `/api/environments/{eid}/apps/{aid}` | Get/delete app | | PUT | `/api/environments/{eid}/apps/{aid}/jar` | Re-upload JAR | | POST | `/api/apps/{aid}/deploy` | Deploy (async, 202) | | GET | `/api/apps/{aid}/deployments` | Deployment history | | GET | `/api/apps/{aid}/deployments/{did}` | Poll deployment status | | POST | `/api/apps/{aid}/stop` | Stop current deployment | | POST | `/api/apps/{aid}/restart` | Restart (stop + redeploy) | | GET | `/api/apps/{aid}/logs` | Query container logs | ### Stats - 53 files changed, +2941 lines - 39 unit tests + 13 integration tests = **52 tests, 0 failures** - 3 new Flyway migrations (V007-V009) - New dependencies: docker-java 3.4.1, clickhouse-jdbc 0.7.1 ## Test plan - [x] 39 unit tests pass (Mockito — services, config, orchestrator) - [x] 13 integration tests pass (TestContainers PostgreSQL — controllers) - [x] All 9 Flyway migrations apply cleanly - [x] Docker client initializes against Docker Desktop - [ ] Manual: upload sample Camel JAR, deploy, verify container starts with agent - [ ] CI pipeline passes Closes #26 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claude added 20 commits 2026-04-04 18:07:14 +02:00
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
16-task plan covering environments, apps, deployments, Docker
runtime orchestrator, ClickHouse log ingestion, and CI updates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add docker-java and ClickHouse JDBC dependencies, RuntimeConfig and
ClickHouseConfig Spring components, AsyncConfig with deployment thread
pool, and runtime/clickhouse config sections in application.yml.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements EnvironmentService with full CRUD, duplicate slug rejection,
tier-based environment count limits, and audit logging for create/update/delete.
Adds ENVIRONMENT_CREATE, ENVIRONMENT_UPDATE, ENVIRONMENT_DELETE to AuditAction.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements POST/GET/PATCH/DELETE endpoints at /api/tenants/{tenantId}/environments
with DTOs, mapping helpers, and a Spring Boot integration test (TestContainers).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements AppService with JAR file storage, SHA-256 checksum computation,
tier-based app limit enforcement via LicenseDefaults, and audit logging.
Four TDD tests all pass covering creation, JAR validation, duplicate slug
rejection, and JAR re-upload.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds AppController at /api/environments/{environmentId}/apps with POST (multipart
metadata+JAR), GET list, GET by ID, PUT jar reupload, and DELETE endpoints.
Also adds CreateAppRequest and AppResponse DTOs, integration tests (AppControllerTest),
and fixes ClickHouseConfig to be excluded in test profile via @Profile("!test").

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements DeploymentService with TDD: builds Docker images, starts containers with Cameleer env vars, polls for health, and handles stop/restart lifecycle. All 3 unit tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add DeploymentResponse DTO, DeploymentController at /api/apps/{appId} with POST /deploy (202), GET /deployments, GET /deployments/{id}, POST /stop, POST /restart (202), and integration tests covering empty list, 404, and 401 cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feat: update Docker Compose, CI, and add runtime-base Dockerfile
Some checks failed
CI / build (push) Successful in 57s
CI / build (pull_request) Successful in 54s
CI / docker (pull_request) Has been skipped
CI / docker (push) Has been cancelled
abc06f57da
Add jardata volume, CAMELEER_AUTH_TOKEN/CAMELEER3_SERVER_ENDPOINT/CLICKHOUSE_URL env vars to cameleer-saas, CAMELEER_AUTH_TOKEN to cameleer3-server, runtime-base Dockerfile for agent-instrumented customer apps, and expand CI surefire excludes for new integration test classes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
claude added 1 commit 2026-04-04 18:08:45 +02:00
ci: add nightly SonarQube analysis workflow
All checks were successful
CI / build (push) Successful in 45s
CI / build (pull_request) Successful in 46s
CI / docker (pull_request) Has been skipped
CI / docker (push) Successful in 2m29s
af04f7b4a1
Runs at 02:00 UTC daily (same schedule as cameleer3 and cameleer3-server).
Uses cameleer-build:1 image, excludes TestContainers integration tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
hsiegeln merged commit 956eb13dd6 into main 2026-04-04 18:10:43 +02:00
Sign in to join this conversation.