Persist JWT signing secret across server restarts #38

Closed
opened 2026-03-13 13:41:13 +01:00 by claude · 0 comments
Owner

Problem

JwtServiceImpl generates a random signing secret on each server startup. This means every server restart invalidates all issued JWTs, forcing all agents to re-register and all UI users to re-login.

In an HA/LB setup with multiple server instances, each instance would have a different secret, making tokens non-portable between instances.

Proposed Change

Make the JWT signing secret configurable via environment variable (e.g. CAMELEER_JWT_SECRET). If not set, fall back to generating a random one (current behavior, suitable for dev).

For production, the secret should be stored in a K8s Secret and mounted as an env var, shared across all server replicas.

Context

Identified during UI planning. Acceptable for single-instance v1 deployments, but blocks HA/LB scenarios where the UI connects to any backend instance behind a load balancer.

## Problem `JwtServiceImpl` generates a random signing secret on each server startup. This means every server restart invalidates all issued JWTs, forcing all agents to re-register and all UI users to re-login. In an HA/LB setup with multiple server instances, each instance would have a different secret, making tokens non-portable between instances. ## Proposed Change Make the JWT signing secret configurable via environment variable (e.g. `CAMELEER_JWT_SECRET`). If not set, fall back to generating a random one (current behavior, suitable for dev). For production, the secret should be stored in a K8s Secret and mounted as an env var, shared across all server replicas. ## Context Identified during UI planning. Acceptable for single-instance v1 deployments, but blocks HA/LB scenarios where the UI connects to any backend instance behind a load balancer.
Sign in to join this conversation.