KKIMS on-site docs
Local rehearsal

The local rehearsal, at a glance

What the local KIMS v2 stack is, why you rehearse on a laptop before touching KIMS, the folder layout, every port, and the order of the local pages.

The local stack is the whole of KIMS v2 on one laptop: the services KIMS already runs (PostgreSQL, S3, Keycloak, Jenkins) as Docker stand-ins, the three apps (CMS, worker, website) running on the laptop itself, and the same image and Helm chart on a local kind cluster, as a stand-in for KIMS's EKS.

Nothing on these pages touches KIMS's AWS account, Keycloak or Jenkins. Every value they use is a local test value that works only on your machine.

#Which code these pages follow

The pages follow the main branch of kims-v2: the commit handed over and pushed to KIMS's Git. A second branch, windows-fixes, holds local and Windows extras that are not merged into main yet. Where a step only works with those commits, the page says so in a warning, and says what happens on main without them. In short:

Extra on windows-fixes only Without it, on main
The site build runs on a Windows host npm run site:build fails on Windows at Build locales (spawnSync npx cannot start npx.cmd). Linux and macOS are fine
--from-stage to resume a site build Not available: a failed build starts again from the first stage
KIMS_BUILD_WORKERS to cap the build's static-generation workers Not read: Next starts one worker per CPU less one
Signing in to the CMS on kind (port 3102): a Keycloak proxy in the CMS pod, and 3102 in the realm's redirect URIs The kind CMS starts and its health check passes, but signing in fails
S3_PUBLIC_ENDPOINT, so uploads work from the CMS on kind Uploads from the kind CMS fail as a dropped connection
The local Jenkins workspace on a Docker volume The workspace is a folder in the repo (.local-jenkins-workspace); on Windows a full build there timed out at 90 minutes
deploy/handover/node-tools-pod.yaml (used by deploy.mjs kims google-client save) The file is missing, so that command fails

To use the extras, check out windows-fixes in a separate clone or worktree. Never push it to KIMS's Git.

#Why rehearse locally first

#What the rehearsal proves

  • The code you are about to push builds and runs, on the same commit.
  • The data bundle you carry is whole, and loads into an empty, migrated database the same way it will on RDS.
  • The Helm chart installs: the migrate Job runs first, then the CMS, the worker and the CronJobs.
  • The one-off content-load pod (deploy/handover/load-bundle-pod.yaml) works, with the exact bundle you will load on site.
  • The site build runs every stage, quality gates included, and fills a website bucket.
  • The Jenkins site build job is set up the way KIMS's will be, including the three parameters that must exist before the first publish.

#What it cannot prove

  • Anything about KIMS's network: security groups, NAT, VPC endpoints, the RDS TLS setting.
  • IAM roles (IRSA) and the Jenkins agent's role: locally the pods use access keys for the S3 stand-in instead.
  • KIMS's Keycloak realm and its users.
  • CloudFront and its redirects: the local build always skips those two stages.

#The pieces

#Services in Docker Compose

Defined in kims-v2/local/docker-compose.yml, project name kims-v2:

Service Stands in for Image Address on your machine Data kept in
postgres Amazon RDS for PostgreSQL 18 postgres:18 127.0.0.1:5418 Docker volume kims-v2_postgres-data
keycloak KIMS's Keycloak quay.io/keycloak/keycloak:26.4 http://localhost:8180 The keycloak database on the same Postgres
s3 The assets and website S3 buckets chrislusf/seaweedfs:4.54 (SeaweedFS S3 gateway; MinIO no longer publishes images) http://127.0.0.1:9100 Docker volume kims-v2_s3-data
jenkins (only with --profile jenkins) KIMS's Jenkins with a build agent built from local/jenkins/Dockerfile http://localhost:8190 Docker volume kims-v2_jenkins-home; build workspaces in .local-jenkins-workspace in the repo (on main)

Every port is published on 127.0.0.1 only, so nothing is reachable from your network.

#The apps on your machine

App What it does Address
CMS The editors' app: content, media, review, publishing, people, builds http://localhost:3101
Website dev server The public site, rendered on request from a content snapshot http://localhost:3100 (pages live under /bengaluru/...)
Worker Runs the background jobs: publishing, media resizing, translation, starting site builds No port: it polls the database

#The kind cluster

A one-node Kubernetes cluster called kims-v2 (kubectl context kind-kims-v2), namespace kims, release kims. The CMS pod answers on http://localhost:3102 (signing in there needs the windows-fixes commits). The pods reach the Compose services on your machine through host.docker.internal.

#Every port

Port What Started by
3100 Website dev server Run the apps
3101 CMS on your machine Run the apps
3102 CMS on the kind cluster kind and Helm
5418 PostgreSQL 18 (container port 5432) Services
8080 A plain file server for looking at a built site (optional) Site build
8180 Keycloak (and its admin console at /admin) Services
8190 Jenkins (container port 8080) Jenkins
9100 S3 stand-in (container port 8333) Services

The ports were chosen not to clash with the older ClinicSpots platform's dev servers. If one of them is taken on your machine, see Troubleshooting.

#The folder layout the pages assume

The engineer's helper script (deploy.mjs) finds everything from where it sits, so the three folders must be side by side:

text
<KIMS_FOLDER>/
  deployment-steps/               the helper scripts (scripts/deploy.mjs)
  repos/kims-v2/                  the code
  KIMS-v2-handover-2026-11-24/    the extracted handover zip: runbook, kims-v2.bundle, data-bundle/

<KIMS_FOLDER> is any folder you choose, for example ~/kims on Linux or macOS, or C:\Users\<YOU>\Dev\Projects\kims on Windows. The pages say "from <KIMS_FOLDER>" or "from the repo" (<KIMS_FOLDER>/repos/kims-v2) for every command.

The helper folder's own name does not matter: deploy.mjs treats its parent folder as <KIMS_FOLDER>. If you cloned it under another name, replace deployment-steps in every command. If the repo is elsewhere, every deploy.mjs command takes --repo <path>, and the bundle commands take --bundle <path>.

How to get the code and the handover onto your machine is on Get the code.

#Two ways to do each step

Every local page gives both:

  • The quick way: one deploy.mjs command that checks what it needs first, shows its progress, is safe to run again, and ends with OK: .... It is plain Node.js with no packages of its own, so it runs the same in PowerShell, Git Bash, bash and zsh. Its commands are documented on The deploy.mjs helper.
  • By hand: the same work as individual commands, for when the quick way fails or you want to see what it does.
Note

deploy.mjs was written and tested on Windows (2026-11-28). It is written to run on Linux and macOS too, and the pages say where it behaves differently there. The deploy.mjs helper has the full list.

#The order

Page What it gets done Quick way
The env file .env.local, the settings every later step reads (copy one file)
Services S3 stand-in and buckets, PostgreSQL 18, Keycloak with the kims realm deploy.mjs local up
Database and content Migrations, the data bundle loaded, reloading, counts deploy.mjs local db up, local db seed
Run the apps CMS, website and worker on your machine; signing in deploy.mjs local apps prepare, local apps start
Site build The real static website, through its quality gates, into the website bucket deploy.mjs local website build
Jenkins A local Jenkins with the kims-site-build job deploy.mjs local jenkins up, then the job by hand
kind and Helm The image and chart on kind; the KIMS content load rehearsed deploy.mjs local kube up, local kube rehearse-load
Stop and reset Stop and keep the data, or delete everything deploy.mjs local down, local reset

#Which pages you need

  • To work on the CMS or the website: env file, services, database and content, apps.
  • To see the real built website: add site build.
  • To rehearse KIMS's Jenkins setup: add Jenkins.
  • To rehearse the KIMS deploy and content load: add kind and Helm.

#Before you start

#Tools

Install and check these first (each has its own page):

  • Node.js 24 and npm 10: Node.js
  • git: git
  • Docker Desktop (Windows, macOS) or Docker Engine (Linux), with Compose and buildx: Docker
  • kubectl, Helm 3 (not 4) and kind, for the kind page only: kubectl, Helm and kind
  • Google Chrome or Chromium, for the Lighthouse gate in the site build: Other tools
  • Python 3, only for looking at a built site with a small file server (any static file server works)

On Windows, read Windows notes as well: Application Control, line endings and Git Bash all matter.

#Check the machine is ready

Run from <KIMS_FOLDER>:

bash
node deployment-steps/scripts/deploy.mjs local check
bash
node deployment-steps/scripts/deploy.mjs local check
powershell
node deployment-steps/scripts/deploy.mjs local check

You should see a table of checks (Node.js, npm, git, Docker, Compose, buildx, Docker running, kubectl, kind, Helm, Chrome, openssl, the repo, its packages, .env.local, the data bundle), then a line such as:

text
Ready for steps: 00, 01, 02, 03, 04, 05, 06
Not ready for step 07: kind, Helm

The step numbers are the engineer's original note numbers: 00 prerequisites, 01 object storage, 02 database, 03 Keycloak, 04 apps, 05 site build, 06 Jenkins, 07 kind, 08 stop and reset. --for 07 checks only what one step needs. It changes nothing.

Note

On Linux and macOS the three Windows native-module checks and the Git Bash check are not run. On macOS, Chrome shows as MISSING* (optional) unless CHROME_PATH is set, because the check only looks for Chrome in Windows folders or as google-chrome/chromium on PATH. See Site build.

#Disk and memory

  • About 15 GB free on the disk Docker uses: the image build, the S3 data (about 530 MB of media), a site build (about 5 GB on the host) and a Jenkins build (about 10 GB in its volume).
  • Docker Desktop with at least 6 GB of memory for the VM. A site build inside Docker (the local Jenkins) with one static-generation worker per CPU ran a 6.6 GB VM out of memory with 11 workers; the windows-fixes branch caps it at 3 with KIMS_BUILD_WORKERS.

#If it goes wrong

What you see Likely cause What to do
Can't start: the kims-v2 repo isn't at ... The folders are not side by side Move them into the layout above, or pass --repo
Can't start: ... .env.local doesn't exist Not created yet The env file
Docker running: FAIL, or errors mentioning dockerDesktopLinuxEngine Docker isn't running Start Docker Desktop (or sudo systemctl start docker on Linux) and wait
kind or helm BLOCKED (Windows) Application Control Windows notes

Every known failure is also in Troubleshooting.

#Sources

  • kims-v2/local/docker-compose.yml, kims-v2/local/.env.example, kims-v2/deploy/kind/kind-config.yaml, kims-v2/deploy/helm/kims/values-local.yaml (branch main)
  • kims-v2/apps/website/next.config.ts, kims-v2/apps/website/scripts/build-locales.mjs, kims-v2/scripts/site-build/run.mjs, kims-v2/deploy/helm/kims/templates/cms-deployment.yaml (compared between main and windows-fixes)
  • deployment-steps/local/README.md, local/00-prerequisites.md, scripts/README.md, scripts/lib/env.mjs, scripts/commands/local/check.mjs
  • Docker Compose: https://docs.docker.com/compose/
  • kind quick start: https://kind.sigs.k8s.io/docs/user/quick-start/
Built 2026-11-29. Commands are shown for the system picked at the top; every block has all three.