KKIMS on-site docs
Deploy KIMS (UAT and production)

Load the content and media (data bundle)

Load the handover data bundle (13,247 rows, 11,307 media files, about 530 MB) into the environment's RDS database and assets bucket from a one-off pod in the namespace, check the counts, and know how to reload.

The database and the assets bucket are only reachable from inside KIMS's network, so the bundle is copied into a one-off pod in the namespace and loaded from there. The pod runs as the chart's kims service account (so it has the IAM role that writes the assets bucket) and reads the same kims-database Secret as the CMS.

#What the bundle holds

#Contents

Part Count
publish_versions 1 (the content arrives as published version 1)
published_files 2,750 (entities, the 489 blogs among them)
state_objects 8,274 (drafts, workflow, indexes)
media_assets 1,102
media_usage 1,120
Total rows 13,247
Files for the assets bucket 11,307, about 530 MB

#What it does not bring

People (they come from Keycloak and the People screen), sessions, jobs, site build history, the old platform's audit trail, and stored Google secrets (they were encrypted with the old SECRETS_KEY).

#How the load behaves

  1. Checks every file against the bundle's SHA-256 checksums.
  2. Refuses a database that lacks a migration the bundle was made with.
  3. Refuses a database whose content tables already have rows.
  4. Uploads the files to the assets bucket, skipping any already there at the same size.
  5. Writes all the rows in one transaction.

If it stops part way, nothing is half-written in the database: run it again. Files already uploaded are skipped.

#Before you start

  • deploy/first-deploy is done: the kims-migrate Job completed and the deploy check passes.
  • Nobody has used the CMS yet: the load only goes into an empty database.
  • The bundle on your machine passes its check (below).
  • You know the image the deploy runs, the assets bucket and the region.
  • The namespace does not enforce Pod Security restricted (the load pod does not meet it; baseline is fine).

#Check the bundle copy

From the kims-v2 folder, with npm install done:

bash
node scripts/handover/data-bundle.mjs check --from <PATH_TO_DATA_BUNDLE>
bash
node scripts/handover/data-bundle.mjs check --from <PATH_TO_DATA_BUNDLE>
powershell
node scripts/handover/data-bundle.mjs check --from <PATH_TO_DATA_BUNDLE>

Expected: bundle ok: 13247 rows, 11307 objects, made 2026-11-24T14:03:17.744Z. Anything else (missing, checksum differs) means the copy is damaged: copy it again.

#Quick way: the deploy helper

It checks the bundle, checks the first deploy is done, fills in the pod file, starts the pod, copies the bundle, loads it and always deletes the pod. Pass --region: the helper defaults to ap-south-1, which is wrong if the buckets are in Hyderabad.

bash
node deployment-steps/scripts/deploy.mjs kims content load --context <KUBE_CONTEXT> --namespace <NAMESPACE> --image <IMAGE> --bucket <ASSETS_BUCKET> --region <AWS_REGION> --bundle <PATH_TO_DATA_BUNDLE>
node deployment-steps/scripts/deploy.mjs kims check --context <KUBE_CONTEXT> --namespace <NAMESPACE> --content
bash
node deployment-steps/scripts/deploy.mjs kims content load --context <KUBE_CONTEXT> --namespace <NAMESPACE> --image <IMAGE> --bucket <ASSETS_BUCKET> --region <AWS_REGION> --bundle <PATH_TO_DATA_BUNDLE>
node deployment-steps/scripts/deploy.mjs kims check --context <KUBE_CONTEXT> --namespace <NAMESPACE> --content
powershell
node deployment-steps/scripts/deploy.mjs kims content load --context <KUBE_CONTEXT> --namespace <NAMESPACE> --image <IMAGE> --bucket <ASSETS_BUCKET> --region <AWS_REGION> --bundle <PATH_TO_DATA_BUNDLE>
node deployment-steps/scripts/deploy.mjs kims check --context <KUBE_CONTEXT> --namespace <NAMESPACE> --content

Expected: the first ends OK: the content and media are loaded.; the second compares the row counts with the bundle and ends OK: the deploy in <NAMESPACE> is healthy.

#By hand

#Step 1: find the image the deploy runs

bash
IMAGE=$(kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get deployment kims-cms -o jsonpath='{.spec.template.spec.containers[0].image}')
echo "$IMAGE"
bash
IMAGE=$(kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get deployment kims-cms -o jsonpath='{.spec.template.spec.containers[0].image}')
echo "$IMAGE"
powershell
$Image = kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get deployment kims-cms -o jsonpath="{.spec.template.spec.containers[0].image}"
$Image

Expected: <REGISTRY>/kims/kims-v2:<40-character SHA>. Use exactly this, never latest.

#Step 2: fill in the pod file

deploy/handover/load-bundle-pod.yaml has three values to replace: the image, the assets bucket, and the region (ap-south-2 in the file; change it if the bucket is in ap-south-1). The pod sleeps for two hours waiting to be used.

bash
sed -e "s#<registry>/kims/kims-v2:<tag>#${IMAGE}#" \
    -e "s#<assets-bucket>#<ASSETS_BUCKET>#" \
    -e "s#value: ap-south-2#value: <AWS_REGION>#" \
    deploy/handover/load-bundle-pod.yaml > ~/kims-config/load-bundle-pod.yaml
grep -n "image:\|value:" ~/kims-config/load-bundle-pod.yaml
bash
sed -e "s#<registry>/kims/kims-v2:<tag>#${IMAGE}#" \
    -e "s#<assets-bucket>#<ASSETS_BUCKET>#" \
    -e "s#value: ap-south-2#value: <AWS_REGION>#" \
    deploy/handover/load-bundle-pod.yaml > ~/kims-config/load-bundle-pod.yaml
grep -n "image:\|value:" ~/kims-config/load-bundle-pod.yaml
powershell
(Get-Content deploy\handover\load-bundle-pod.yaml -Raw) `
  -replace '<registry>/kims/kims-v2:<tag>', $Image `
  -replace '<assets-bucket>', '<ASSETS_BUCKET>' `
  -replace 'value: ap-south-2', 'value: <AWS_REGION>' |
  Set-Content -Encoding ascii "$HOME\kims-config\load-bundle-pod.yaml"
Select-String -Path "$HOME\kims-config\load-bundle-pod.yaml" -Pattern 'image:|value:'

Expected: the image: line shows the full image, and the two value: lines show the bucket and region. No < left.

#Step 3: start the pod

bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> apply -f ~/kims-config/load-bundle-pod.yaml
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> wait --for=condition=Ready pod/kims-load-bundle --timeout=300s
bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> apply -f ~/kims-config/load-bundle-pod.yaml
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> wait --for=condition=Ready pod/kims-load-bundle --timeout=300s
powershell
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> apply -f "$HOME\kims-config\load-bundle-pod.yaml"
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> wait --for=condition=Ready pod/kims-load-bundle --timeout=300s

Expected: pod/kims-load-bundle created, then pod/kims-load-bundle condition met. If apply says violates PodSecurity "restricted:latest", the namespace enforces restricted: ask KIMS to set it to baseline with restricted as a warning.

#Step 4: copy the bundle in

About 530 MB: a few minutes over a VPN (105 seconds on a local cluster). kubectl cp needs tar in the pod; the image has it.

bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> cp <PATH_TO_DATA_BUNDLE> kims-load-bundle:/bundle/data-bundle
bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> cp <PATH_TO_DATA_BUNDLE> kims-load-bundle:/bundle/data-bundle
powershell
# From the folder that CONTAINS data-bundle, using the bare name:
Set-Location <FOLDER_HOLDING_DATA_BUNDLE>
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> cp data-bundle kims-load-bundle:/bundle/data-bundle

Expected: no output when it works. On Windows, a full path such as C:\... fails with error: one of src or dest must be a local file specification, because kubectl cp reads C: as a pod name: always cd first and use the bare name.

#Step 5: load it

bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> exec kims-load-bundle -- kims-entrypoint data-bundle load --from /bundle/data-bundle
bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> exec kims-load-bundle -- kims-entrypoint data-bundle load --from /bundle/data-bundle
powershell
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> exec kims-load-bundle -- kims-entrypoint data-bundle load --from /bundle/data-bundle

Expected, in under ten minutes with an empty bucket:

text
bundle ok: 13247 rows, 11307 objects, made 2026-11-24T14:03:17.744Z
uploading 11307 objects to <ASSETS_BUCKET>
  500 of 11307
  ...
objects: 11307 uploaded, 0 already there
publish_versions: 1 rows
published_files: 2750 rows
state_objects: 8274 rows
media_assets: 1102 rows
media_usage: 1120 rows
load finished

#Step 6: delete the pod, always

Even if the load failed:

bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> delete pod kims-load-bundle
bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> delete pod kims-load-bundle
powershell
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> delete pod kims-load-bundle

Expected: pod "kims-load-bundle" deleted.

#Check

Check How Expected
Rows match the bundle node deployment-steps/scripts/deploy.mjs kims check --context <KUBE_CONTEXT> --namespace <NAMESPACE> --content publish_versions 1, published_files 2,750, state_objects 8,274, media_assets 1,102, media_usage 1,120
Files are in the bucket aws s3 ls s3://<ASSETS_BUCKET>/ --recursive --summarize --region <AWS_REGION> (last two lines) Total Objects: 11307, Total Size: about 530 MB
The pod is gone kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get pod kims-load-bundle Error from server (NotFound)
Content in the CMS After deploy/people: the dashboard and Media library 183 doctors, 72 specialties, 320 conditions, 1,331 treatments; images show

On Windows, the aws s3 ls line is the same in PowerShell; add | Select-Object -Last 2.

#Next: the Emergency image

One image never reached the old platform's storage: emergency_CoE.png, the hero of en/centres-of-excellence/emergency-critical-care. Until it is replaced, every publish is refused. It is fixed in the CMS once an Admin can sign in: deploy/website.

#Reloading

#When a load was wrong

The load never merges into existing content. To load again:

  1. Make sure nobody has made changes worth keeping.
  2. Either have KIMS recreate the database (drop and create kims, owned by the same user) and rerun kims-platform so kims-migrate creates the tables again, or empty the five content tables (publish_versions, published_files, state_objects, media_assets, media_usage) as the database owner.
  3. Run Step 3 onward again. Files already in the bucket are skipped.

Recreating the database also removes people, jobs and build history, which is usually what you want before go-live. It also removes the Google secrets: enter them again (google/translation-api-key, google/reviews-oauth).

#UAT and production

UAT Production
Namespace kims-uat kims
Image UAT's kims-cms image Production's kims-cms image
Bucket UAT assets bucket Production assets bucket
Bundle The handover bundle The handover bundle again, or an export of UAT's reviewed content (agree with KIMS)

To export UAT's content (not yet rehearsed on KIMS): run node scripts/handover/data-bundle.mjs export --out <DIR> (or kims-entrypoint data-bundle export --out <DIR> in a pod built like the load pod) with UAT's DATABASE_URL, ASSETS_BUCKET and S3_REGION, from somewhere that reaches UAT's database and bucket, then check and load it into production. Either way the production database must be empty, and the Emergency image fixed before production's first publish.

#If it goes wrong

What you see Cause Fix
<table> already has N rows; load only goes into an empty database Loaded before, or someone used the CMS If the earlier load was right, nothing to do. Otherwise Reloading
The database is missing migrations the bundle was made with: ... Run the migrate job first. kims-migrate did not run or failed deploy/first-deploy
The bundle does not match its manifest (N problems) Damaged copy Copy the bundle again, check, retry
AccessDenied uploading The pods' role cannot write the assets bucket, or its trust does not name this namespace's kims service account aws/iam
Upload errors naming a redirect or PermanentRedirect Wrong region in the pod Fix S3_REGION in the pod file (or --region), start again
Pod Pending or ImagePullBackOff Wrong image tag, or quota Use the exact image from step 1; kubectl describe pod kims-load-bundle
error: one of src or dest must be a local file specification A Windows path with a drive letter Step 4

#Sources

Built 2026-11-29. Commands are shown for the system picked at the top; every block has all three.