Fix all factual inaccuracies (Ed25519 methods, syncOidcRoles reference, cpuShares->cpuRequest, deployment sub-tab order, ClickHouseLogStore package, OidcConfig fields) and add 30+ missing classes/controllers. Move reference material (class maps, Docker orchestration, metrics tables, UI structure, CI/CD) into .claude/rules/ with path-scoped loading. Remove duplicated GitNexus section (already in AGENTS.md, now in .claude/rules/). Startup context reduced from ~13K to ~4K tokens (69% reduction). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6.5 KiB
6.5 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project
Cameleer Server — observability server that receives, stores, and serves Camel route execution data and route diagrams from Cameleer agents. Pushes config and commands to agents via SSE. Also orchestrates Docker container deployments when running under cameleer-saas.
Related Project
- cameleer (
https://gitea.siegeln.net/cameleer/cameleer) — the Java agent that instruments Camel applications - Protocol defined in
cameleer-common/PROTOCOL.mdin the agent repo - This server depends on
com.cameleer:cameleer-common(shared models and graph API)
Modules
cameleer-server-core— domain logic, storage interfaces, services (no Spring dependencies)cameleer-server-app— Spring Boot web app, REST controllers, SSE, persistence, Docker orchestration
Build Commands
mvn clean compile # Compile all modules
mvn clean verify # Full build with tests
Run
java -jar cameleer-server-app/target/cameleer-server-app-1.0-SNAPSHOT.jar
Key Conventions
- Java 17+ required
- Spring Boot 3.4.3 parent POM
- Depends on
com.cameleer:cameleer-commonfrom Gitea Maven registry - Jackson
JavaTimeModuleforInstantdeserialization - Communication: receives HTTP POST data from agents (executions, diagrams, metrics, logs), serves SSE event streams for config push/commands (config-update, deep-trace, replay, route-control)
- Environment filtering: all data queries filter by the selected environment. All commands target only agents in the selected environment. Backend endpoints accept optional
environmentquery parameter; null = all environments (backward compatible). - Maintains agent instance registry (in-memory) with states: LIVE -> STALE -> DEAD. Auto-heals from JWT
envclaim + heartbeat body on heartbeat/SSE after server restart (priority: heartbeatenvironmentId> JWTenvclaim >"default"). Capabilities and route states updated on every heartbeat (protocol v2). Route catalog falls back to ClickHouse stats for route discovery when registry has incomplete data. - Multi-tenancy: each server instance serves one tenant (configured via
CAMELEER_SERVER_TENANT_ID, default:"default"). Environments (dev/staging/prod) are first-class. PostgreSQL isolated via schema-per-tenant (?currentSchema=tenant_{id}) andApplicationName=tenant_{id}on the JDBC URL. ClickHouse shared DB withtenant_id+environmentcolumns, partitioned by(tenant_id, toYYYYMM(timestamp)). - Storage: PostgreSQL for RBAC, config, and audit; ClickHouse for all observability data (executions, search, logs, metrics, stats, diagrams). ClickHouse schema migrations in
clickhouse/*.sql, run idempotently on startup byClickHouseSchemaInitializer. UseIF NOT EXISTSfor CREATE and ADD PROJECTION. - Log exchange correlation:
ClickHouseLogStoreextractsexchange_idfrom log entry MDC, preferringcameleer.exchangeIdovercamel.exchangeId(fallback for older agents). ForON_COMPLETIONexchange copies, the agent setscameleer.exchangeIdto the parent's exchange ID viaCORRELATION_ID. - Log processor correlation: The agent sets
cameleer.processorIdin MDC, identifying which processor node emitted a log line. - Logging: ClickHouse JDBC set to INFO (
com.clickhouse), HTTP client to WARN (org.apache.hc.client5) in application.yml - Security: JWT auth with RBAC (AGENT/VIEWER/OPERATOR/ADMIN roles), Ed25519 config signing (key derived deterministically from JWT secret via HMAC-SHA256), bootstrap token for registration. CORS:
CAMELEER_SERVER_SECURITY_CORSALLOWEDORIGINS(comma-separated) overridesCAMELEER_SERVER_SECURITY_UIORIGINfor multi-origin setups. Infrastructure access:CAMELEER_SERVER_SECURITY_INFRASTRUCTUREENDPOINTS=falsedisables Database and ClickHouse admin endpoints. Last-ADMIN guard: system prevents removal of the last ADMIN role (409 Conflict). Password policy: min 12 chars, 3-of-4 character classes, no username match. Brute-force protection: 5 failed attempts -> 15 min lockout. Token revocation:token_revoked_beforecolumn on users, checked inJwtAuthenticationFilter, set on password change. - OIDC: Optional external identity provider support (token exchange pattern). Configured via admin API/UI, stored in database (
server_configtable). Resource server mode: accepts external access tokens (Logto M2M) via JWKS validation whenCAMELEER_SERVER_SECURITY_OIDCISSUERURIis set. Scope-based role mapping viaSystemRole.normalizeScope(). System roles synced on every OIDC login viaapplyClaimMappings()inOidcAuthController(callsclearManagedAssignments+assignManagedRoleonRbacService) — always overwrites managed role assignments; uses managed assignment origin to avoid touching group-inherited or directly-assigned roles. Supports ES384, ES256, RS256. - OIDC role extraction:
OidcTokenExchangerreads roles from the access_token first (JWT withat+jwttype), then falls back to id_token.OidcConfigincludesaudience(RFC 8707 resource indicator) andadditionalScopes. All provider-specific configuration is external — no provider-specific code in the server. - Sensitive keys: Global enforced baseline for masking sensitive data in agent payloads. Merge rule:
final = global UNION per-app(case-insensitive dedup, per-app can only add, never remove global keys). - User persistence: PostgreSQL
userstable, admin CRUD at/api/v1/admin/users - Usage analytics: ClickHouse
usage_eventstable tracks authenticated UI requests, flushed every 5s
Database Migrations
PostgreSQL (Flyway): cameleer-server-app/src/main/resources/db/migration/
- V1 — RBAC (users, roles, groups, audit_log)
- V2 — Claim mappings (OIDC)
- V3 — Runtime management (apps, environments, deployments, app_versions)
- V4 — Environment config (default_container_config JSONB)
- V5 — App container config (container_config JSONB on apps)
- V6 — JAR retention policy (jar_retention_count on environments)
- V7 — Deployment orchestration (target_state, deployment_strategy, replica_states JSONB, deploy_stage)
- V8 — Deployment active config (resolved_config JSONB on deployments)
- V9 — Password hardening (failed_login_attempts, locked_until, token_revoked_before on users)
- V10 — Runtime type detection (detected_runtime_type, detected_main_class on app_versions)
ClickHouse: cameleer-server-app/src/main/resources/clickhouse/init.sql (run idempotently on startup)
Disabled Skills
- Do NOT use any
gsd:*skills in this project. This includes all/gsd:prefixed commands.