DATABASE_REDIS_URL) to an existing self-hosted OpenWork Helm deployment and optionally run multiple Den API replicas. Follow the stages in order: connect and verify Redis first, check pod resources and MySQL connection headroom second, and raise denApi.replicaCount last.
Before you start
You need:- Your complete, reviewed
openwork-values.yaml, Helm release name, and Kubernetes namespace. kubectlandhelmaccess to the cluster, plus read-only SQL access to your MySQL server to check connection limits.- A Redis instance reachable from the OpenWork namespace with
AUTHenabled,maxmemory-policy volatile-lru, and memory sized soevicted_keysstays0(512 MiBmaxmemoryis a practical starting point, monitor and adjust for your workload). Persistence (RDB or AOF) is optional because OpenWork treats Redis as a TTL-backed cache and short-lived authoring store. Prefer TLS (rediss://). - Cloud worker provisioning off (
config.provisioner.mode: stub, the default) if you plan to run more than one Den API replica. If cloud worker provisioning is enabled, keepdenApi.replicaCount: 1unless your worker provider operations are idempotent or externally coordinated.
Step 1: Connect Redis (DATABASE_REDIS_URL)
Adding Redis enables Den API’s shared session, membership, feature-flag, and inventory-revision caches. Run this stage before increasing denApi.replicaCount.
-
Supply
DATABASE_REDIS_URLthrough your Secret.- If
secret.create: false(secret.existingSecret, recommended for production): Add a key named literallyDATABASE_REDIS_URLto your existing Kubernetes Secret in the release namespace. Becauseden-apiloads the Secret throughenvFrom, keep the key nameDATABASE_REDIS_URLrather than remapping it withsecret.keys.databaseRedisUrl. - If
secret.create: true: Setsecret.values.databaseRedisUrlinopenwork-values.yamland keepsecret.keys.databaseRedisUrlat its defaultDATABASE_REDIS_URL.
- If
-
Configure TLS or an explicit private-network opt-in.
- Prefer
rediss://:<password>@<redis-host>:6379. If Redis uses a private certificate authority, enablecustomCawith your CA bundle (see Certificate trust and proxies). - For a non-public, cluster-internal
redis://endpoint protected by a NetworkPolicy or service-mesh mTLS, setredis.allowInsecureInternal: trueinopenwork-values.yaml. Without this setting, Den API refuses to start on non-loopbackredis://URLs.
- Prefer
-
Apply the change and restart Den API if you edited an external Secret.
If
secret.create: false, Helm does not detect edits inside an existing external Secret. Restart Den API so the pods pick upDATABASE_REDIS_URL:
Verify Step 1
- Confirm
den-apistartup logs report"redis cache configured"withredis_cache: "enabled"(and"redis cache connected"once the first cache call runs), show zeroopenwork_cache_redis_errororopenwork_cache_get_failedlines, and that the pod stays Ready. - On Redis (
INFO stats), confirmkeyspace_hitsis rising andevicted_keysstays0. - Re-run
kubectl --namespace "$NAMESPACE" top podsand the MySQLQuestionscheck to compare database query rate and CPU against your baseline before deciding whether to scale replicas.
DATABASE_REDIS_URL from your Secret (or clear secret.values.databaseRedisUrl), revert redis.allowInsecureInternal if added, and restart Den API. No database schema change is involved.
Step 2: Set pod resources and verify MySQL connection headroom
The Helm chart leavesresources: {} by default, which places pods in Kubernetes BestEffort QoS. Before running multiple API replicas, set explicit requests and limits and verify that MySQL has enough connection slots.
-
Add provisional resource requests and limits to
openwork-values.yaml. These values are starting envelopes to leaveBestEffortQoS, not load-tested sizing guarantees. Measure and adjust for your cluster.Leaveconfig.denApiNodeOptions: ""blank unless you need custom Node flags, so Node sizes its heap automatically from the container memory limit. If you set--max-old-space-sizeexplicitly, keep it roughly 25% belowdenApi.resources.limits.memory(for example--max-old-space-size=1536inside a2Gilimit) to avoid OOMKills. -
Check MySQL
max_connectionsbefore scaling. With default pool settings (config.database.pool), each pod opens its ownmysql2pool: up to10connections perden-apipod, and up to20connections per AI Gateway pod (10primary plus2 * 5auxiliary pools; releases prior to configurable pool defaults open up to30per AI Gateway pod). Double those per-pod totals ifDATABASE_READ_USERNAMEandDATABASE_READ_PASSWORDare configured for read replicas against the same MySQL server. Default rolling updates temporarily surge by 25% rounded up (one extra pod per Deployment up to four replicas), and the pre-upgrade migration Job uses up to10connections:MySQL’s defaultmax_connections(151) fitsdenApi=2, gateway=1(~95 peak without read replicas; ~115 on earlier releases with 30-connection Gateway defaults), but becomes tight atdenApi=3, gateway=2(~125 peak; ~155 on earlier releases) and leaves little margin if you raiseconfig.database.pool.connectionLimit. Raise MySQLmax_connectionsto300or higher, and verify MySQL CPU and memory headroom, before scaling beyond two Den API replicas or one Gateway replica, or before raising pool limits inconfig.database.pool.
Step 3: Scale Den API replicas (optional)
Proceed only after Step 1 (Redis) and Step 2 (resources and MySQL headroom) are verified. RunningdenApi.replicaCount > 1 without Redis degrades caching and breaks cross-pod workflow authoring receipts.
-
Set
denApi.replicaCount(and optionallydenWeb.replicaCountfor web redundancy) inopenwork-values.yaml: -
Render with
helm template, verify the Deployment replica counts and resource blocks, and apply withhelm upgrade --reset-values --values openwork-values.yaml --wait --timeout 15m.
Verify Step 3
- Run
kubectl --namespace "$NAMESPACE" get podsand confirm allden-apireplicas are Ready and balanced underkubectl top pods. - On MySQL, confirm
Max_used_connectionsstays safely belowmax_connections(target under 50%). - Verify end-to-end flows across replicas: sign in and sign out (confirming session revocation), open the dashboard and AI Gateway pages, run an MCP tool call from desktop, and test saving a workflow if enabled.
- If you mount local desktop installers on
den-api, use a shared read-only PVC across replicas (see Installer delivery).
denApi.replicaCount: 1 in openwork-values.yaml and run helm upgrade --reset-values. No data is lost.
Reference
See the Helm chart reference for the completesecret, redis, database.pool, denApiNodeOptions, and worker-provisioning configuration options.