Every KIMS v2 process reads its configuration from environment variables only. On KIMS they come from three places:
| Source | Holds | Read by | Page |
|---|---|---|---|
Helm values file, env: |
Plain values | Every pod: CMS, worker, CronJobs, migrate Job (each gets the whole set) | deploy/helm-values |
Kubernetes Secrets, named in the values under secretEnv: |
Secrets | Every pod | deploy/secrets |
Jenkins folder credentials kims-site-env (secret file) and kims-database-url (secret text) |
The site build's settings and its database string | The kims-site-build job only |
jenkins/credentials |
A setting marked secret never goes into the values file, kims-site-env, Git, a ticket or a log.
#CMS, worker, CronJobs and migrate (Helm)
#Required
| Variable | Read by | Secret | Set in | Production | UAT |
|---|---|---|---|---|---|
DATABASE_URL |
All | Yes | Secret kims-database, key url |
postgres://kims:<PASSWORD>@<RDS_ENDPOINT>:5432/kims?sslmode=require |
The UAT RDS endpoint |
S3_REGION |
All | env |
The cluster's region: ap-south-2 (Hyderabad, recommended) or ap-south-1 (Mumbai) |
Same | |
ASSETS_BUCKET |
CMS, worker | env |
<ASSETS_BUCKET> |
<UAT_ASSETS_BUCKET> |
|
WEBSITE_BUCKET |
Not read by the pods (kept in the values for reference) | env |
<WEBSITE_BUCKET> |
<UAT_WEBSITE_BUCKET> |
|
KEYCLOAK_ISSUER |
CMS | env |
https://<KEYCLOAK_HOST>/realms/<REALM> |
Same realm | |
KEYCLOAK_CLIENT_ID |
CMS | env |
Production's CMS client id | UAT's CMS client id | |
KEYCLOAK_CLIENT_SECRET |
CMS | Yes | Secret kims-keycloak, key client-secret |
Production client's secret | UAT client's secret |
KEYCLOAK_ACCESS_ROLE |
CMS | env |
cms-access |
cms-access |
|
CMS_URL |
CMS, worker | env |
https://<CMS_HOST> (no trailing slash) |
https://<CMS_UAT_HOST> |
|
SESSION_SECRET |
CMS | Yes | Secret kims-app, key session-secret |
Generated, 32 characters or more | Generated, its own |
SECRETS_KEY |
CMS, worker | Yes | Secret kims-app, key secrets-key |
Generated, 32 bytes base64. Never changes | Generated, its own |
SITE_URL |
CMS | env |
https://<SITE_HOST> |
https://<SITE_UAT_HOST> |
|
JENKINS_JOB_URL |
CMS, worker | env |
https://<JENKINS_HOST>/job/kims-production/job/kims-site-build |
https://<JENKINS_HOST>/job/kims-uat/job/kims-site-build |
|
JENKINS_USER |
CMS, worker | env |
The CMS's Jenkins user | Same user or a UAT one | |
JENKINS_TOKEN |
CMS, worker | Yes | Secret kims-jenkins, key token |
That user's API token | Same or UAT's |
KIMS_BOOTSTRAP_ADMINS |
CMS | env |
The first Admin's KIMS email | Same or a tester | |
KIMS_ENVIRONMENT |
CMS, worker | env |
production (the platform job checks it) |
uat |
What each means:
DATABASE_URLmust ask for TLS with?sslmode=require; RDS enforces TLS. If the Node driver refuses RDS's certificate (self-signed certificate in certificate chain), use?sslmode=require&uselibpqcompat=truein both the Secret and the Jenkins credential: aws/rds-postgresql.CMS_URLis the CMS's public origin. The Keycloak redirect (<CMS_URL>/api/auth/callback/keycloak), the back-channel logout URL (<CMS_URL>/api/auth/backchannel-logout) and the Google reviews callback (<CMS_URL>/api/reviews/google/callback) are built from it, so it must be exactly the host people type.SITE_URLis used by the CMS for links to the live site and for media it does not have.JENKINS_JOB_URL: the controller's root (for the queue API) is everything before the first/job/. Unset, the Builds screen says Jenkins is unavailable.KIMS_BOOTSTRAP_ADMINS: comma-separated. Read only while the CMS has no people, so it can stay set. Each must also holdcms-accessin Keycloak.KIMS_ENVIRONMENT: used in alert lines and in the Google client instructions. The platform job refuses a values file whose value does not match the branch.
#Optional tuning
| Variable | Default | Read by | Change when |
|---|---|---|---|
DATABASE_POOL_MAX |
10 (set in values.yaml) |
All | RDS's connection limit is tight. Each process opens up to this many; count CMS replicas + worker replicas + running CronJobs |
WORKER_CONCURRENCY |
2 |
Worker | Jobs queue up |
WORKER_LOCK_SECONDS |
300 |
Worker | A job legitimately runs longer than 5 minutes between heartbeats |
WORKER_POLL_MS |
2000 |
Worker | Rarely |
WORKER_SHUTDOWN_GRACE_SECONDS |
25 |
Worker | Keep it under the pod's terminationGracePeriodSeconds (the chart sets 60) |
WORKER_HEALTH_PORT, WORKER_LIVENESS_FILE |
Unset | Worker | Adding a worker liveness probe |
#Set by the image or the chart, never by hand
MODE (cms, worker, cron, migrate, data-bundle), CRON_TASK, PORT (3000), KIMS_PROCESS_NAME (shown in pg_stat_activity), KIMS_GIT_SHA (the commit the image was built from).
#Never set on KIMS
S3_ENDPOINT, S3_FORCE_PATH_STYLE, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY (the pods use the IAM role through IRSA), DATABASE_URL_TEST, KIMS_AUTH_STUB (a production image does not contain the stub), KIMS_LOCAL_*, KIMS_CONTENT_ROOT, KIMS_PUBLISH_WORKER_FUNCTION.
#Site build (kims-site-env and Jenkins)
#In the kims-site-env file
One NAME=value per line, # for comments, no spaces around =. Windows line endings are tolerated. Start from deploy/jenkins/site-env-production.example or site-env-uat.example.
| Variable | Required | Production | UAT | Meaning |
|---|---|---|---|---|
KIMS_ENV |
Yes | production |
uat |
Must match the branch, or the job stops at Check environment |
S3_REGION |
Yes | ap-south-2 or ap-south-1 |
Same | The buckets' region |
AWS_REGION |
Yes | The same region as S3_REGION |
Same | The CloudFront and KeyValueStore clients in scripts/site-build/cloudfront.mjs are created with no region of their own and read it from here. Missing: Region is missing; the invalidation becomes a warning (old pages may be served) and a redirects sync fails the build |
ASSETS_BUCKET |
Yes | <ASSETS_BUCKET> |
<UAT_ASSETS_BUCKET> |
Read: media copied into the build |
WEBSITE_BUCKET |
Yes | <WEBSITE_BUCKET> |
<UAT_WEBSITE_BUCKET> |
Written: the build owns all of it and deletes what it no longer has |
SITE_URL |
Yes | https://<SITE_HOST> |
https://<SITE_UAT_HOST> |
Baked into canonicals and the sitemap |
SITE_NOINDEX |
UAT only | Absent (or true only to hold production out of search before launch) |
true |
Keeps search engines away |
CLOUDFRONT_DISTRIBUTION_ID |
Yes on KIMS | <DISTRIBUTION_ID> |
<UAT_DISTRIBUTION_ID> |
Invalidated after each deploy. Unset skips it |
GTM_ID |
No | GTM-XXXXXXX if KIMS uses Tag Manager |
Usually none | google/tag-manager |
KIMS_REDIRECTS_KVS_ARN |
No | Only once redirects use a KeyValueStore | Same | Unset skips the Redirects stage |
#Elsewhere in Jenkins
| Variable | Set by | Secret | Meaning |
|---|---|---|---|
DATABASE_URL |
Folder credential kims-database-url (secret text) |
Yes | The same string as the kims-database Secret |
PUBLISH_VERSION |
Job parameter (sent by the CMS worker) | The content version to build | |
CAUSE |
Job parameter, default manual |
publish, retry, rebuild, platform or manual |
|
TRIGGER_ACTOR |
Job parameter | Name <email>; empty for a publish |
|
BUILD_URL |
Jenkins | Stored as the Builds screen's log link. Needs Jenkins's own URL set (Manage Jenkins > System) | |
NODE_OPTIONS |
The Jenkinsfile: --max-old-space-size=4096 |
Static generation memory |
#Operator switches, for one run
| Variable | Effect |
|---|---|
ALLOW_PAGE_DROP=1 |
Lets one build ship far fewer pages than the last (a deliberate mass archive) |
KIMS_ALLOW_LOGO_LOSS=1 |
Lets one build drop a hospital logo the last build had |
KIMS_LIGHTHOUSE=skip |
Records the Lighthouse gate as skipped. Never on KIMS's agent: install Chrome instead |
Put a switch in kims-site-env for one build, then take it out again.
#Who reads what, at a glance
| Setting | CMS | Worker | Cron | Migrate | Site build |
|---|---|---|---|---|---|
DATABASE_URL |
Yes | Yes | Yes | Yes | Yes |
S3_REGION |
Yes | Yes | Yes | Yes | Yes |
AWS_REGION (in kims-site-env) |
Yes | ||||
ASSETS_BUCKET |
Yes | Yes | Yes | ||
WEBSITE_BUCKET |
Yes | ||||
KEYCLOAK_* |
Yes | ||||
CMS_URL |
Yes | Yes | |||
SESSION_SECRET |
Yes | ||||
SECRETS_KEY |
Yes | Yes | |||
KIMS_BOOTSTRAP_ADMINS |
Yes | ||||
KIMS_ENVIRONMENT |
Yes | Yes | |||
JENKINS_* |
Yes | Yes | |||
SITE_URL |
Yes | Yes | |||
SITE_NOINDEX, KIMS_ENV, CLOUDFRONT_DISTRIBUTION_ID, GTM_ID, KIMS_REDIRECTS_KVS_ARN |
Yes |
#Settings that are not environment variables
The Google translation API key, the Google OAuth client and the Google sign-in are stored encrypted in PostgreSQL (table secrets) under SECRETS_KEY. They are entered on CMS screens or with a one-off pod: google/translation-api-key, google/reviews-oauth.
#Sources
kims-v2/docs/CONFIG.md(main)kims-v2/deploy/helm/kims/values.yamlkims-v2/deploy/helm/kims/values-production.example.yamlkims-v2/deploy/helm/kims/values-uat.example.yamlkims-v2/deploy/helm/kims/templates/_helpers.tplkims-v2/deploy/jenkins/site-env-production.examplekims-v2/deploy/jenkins/site-env-uat.examplekims-v2/deploy/jenkins/Jenkinsfile.sitekims-v2/deploy/jenkins/README-site.mdkims-v2/deploy/entrypoint.sh