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

First site build and the live website

Make sure the site build job and CloudFront are ready, run the first site build of published version 1, check the website on its CloudFront address, fix the missing Emergency hero image that blocks every publish, and prove a publish starts a build by itself.

The public website is a static site. The kims-site-build Jenkins job builds it from one published content version and syncs it into the website bucket behind CloudFront. The CMS worker starts that job after every publish; this page runs the very first one by hand, checks the result, and then clears the one thing that blocks publishing.

#Before you start

  • Content loaded (deploy/content-load) and an Admin can sign in (deploy/people).
  • The folder's kims-site-build job exists with its three String parameters defined (PUBLISH_VERSION, CAUSE default manual, TRIGGER_ACTOR) (jenkins/site-job). Without them, Jenkins answers the CMS with HTTP 400.
  • The folder has its own kims-database-url (secret text) and kims-site-env (secret file) credentials (jenkins/credentials), and kims-site-env has the right KIMS_ENV for the branch and an AWS_REGION=<AWS_REGION> line (the CloudFront clients need it; deploy/configuration).
  • Manage Jenkins > System > Jenkins URL is set (the Builds screen links to each run from it).
  • The agent has Node.js 24, Chrome or Chromium, 8 GB memory, 15 GB free disk (30 GB if it builds both environments), reaches RDS and npm, and its IAM role can read the assets bucket, write the website bucket and invalidate the distribution (jenkins/agent, aws/iam).
  • The CloudFront distribution exists with the viewer-request function attached and the 403/404 error responses (aws/cloudfront). Without the function only the home page works.
Warning

Jenkinsfile.site runs on agent any, not only on the kims-build agent. If KIMS's Jenkins has other agents, ask them to restrict the job to the agent with Node 24, Chrome and RDS access (for example with the Throttle or label restrictions their Jenkins uses), or the build can land on an agent that cannot run it.

#Run the first build

#Step 1: Build with Parameters

  1. Jenkins > kims-production (UAT: kims-uat) > kims-site-build > Build with Parameters.
  2. PUBLISH_VERSION: 1 (the data bundle arrives as published version 1).
  3. CAUSE: manual. TRIGGER_ACTOR: your name and email, for example Engineer Name <engineer@example.com>, or empty.
  4. Build.

It takes about 15 minutes for three languages. The CMS's Builds screen follows it stage by stage.

Stage (Jenkins and the Builds screen) What it does
Check environment Reads kims-site-env and refuses a KIMS_ENV that does not match the branch
Install npm ci
Export content Writes published version PUBLISH_VERSION from the database
Media manifest Lists the media the pages may use
Reviews feed Writes the Google reviews feeds (empty until Google is connected)
Build locales Builds English, Kannada and Hindi
Quality gates Page floor, sitemap and robots, Lighthouse (needs Chrome), and others. Any failure stops the build before anything is deployed
Bundle media Copies every referenced media file from the assets bucket into the build
Sync website bucket Uploads the build, then deletes what it no longer has
Invalidate CloudFront Only if CLOUDFRONT_DISTRIBUTION_ID is set
Redirects Only if KIMS_REDIRECTS_KVS_ARN is set

Expected: Jenkins SUCCESS; on the Builds screen the build shows as live.

Warning

A known site build problem is fixed only on the windows-fixes branch (commit 05ef85a), not yet merged into main. With KIMS's real content, a media address split across two chunks of a page can be reported as missing, and the build then fails at Bundle media with N /media/ path(s) in the built pages are not in the bundle. If you see it, tell ClinicSpots: the fix has to be merged into main and redeployed. The same branch adds --from-stage (resume a failed build) and KIMS_BUILD_WORKERS (cap build workers on a small agent); neither exists on main.

#Check the website

Until DNS points at it, check the site on the distribution's own address, https://<DISTRIBUTION_DOMAIN> (for example d1234abcd.cloudfront.net). Use <SITE_HOST> once DNS is in place.

#Step 2: pages, 404 and robots

bash
B=https://<DISTRIBUTION_DOMAIN>
for p in / /bengaluru/doctors/ /bengaluru/doctors /kn/ /hi/ /sitemap.xml /robots.txt /no-such-page/; do
  printf '%-22s ' "$p"; curl -s -o /dev/null -w "%{http_code}\n" "$B$p"
done
curl -s "$B/robots.txt"
bash
B=https://<DISTRIBUTION_DOMAIN>
for p in / /bengaluru/doctors/ /bengaluru/doctors /kn/ /hi/ /sitemap.xml /robots.txt /no-such-page/; do
  printf '%-22s ' "$p"; curl -s -o /dev/null -w "%{http_code}\n" "$B$p"
done
curl -s "$B/robots.txt"
powershell
$B = "https://<DISTRIBUTION_DOMAIN>"
foreach ($p in "/","/bengaluru/doctors/","/bengaluru/doctors","/kn/","/hi/","/sitemap.xml","/robots.txt","/no-such-page/") {
  $code = curl.exe -s -o NUL -w "%{http_code}" "$B$p"
  "{0,-22} {1}" -f $p, $code
}
curl.exe -s "$B/robots.txt"

Expected:

text
/                      200
/bengaluru/doctors/    200
/bengaluru/doctors     200
/kn/                   200
/hi/                   200
/sitemap.xml           200
/robots.txt            200
/no-such-page/         404

403 or 404 for /bengaluru/doctors/ while / works means the viewer-request function is not published or not attached (aws/cloudfront).

robots.txt on UAT (and production held back with SITE_NOINDEX=true):

text
User-Agent: *
Disallow: /

Host: https://<SITE_HOST>

On production (no SITE_NOINDEX), it allows crawling, disallows /search/ and /data/, and names Sitemap: https://<SITE_HOST>/sitemap.xml.

#Step 3: look at it in a browser

Open a few pages and check their images load: a hospital page, a doctor, a centre of excellence, a blog post, /kn/ and /hi/ (one published page each at the handover). The site's own 404 page should show for /no-such-page/.

#Fix the Emergency hero image before the first publish

#Why

One image never reached the old platform's storage: emergency_CoE.png, the hero of the page en/centres-of-excellence/emergency-critical-care. The publish check looks at the whole site, so until that page has an image that exists, every publish is refused, whatever is being published. The first site build above is not affected, because it builds version 1 directly.

#Step 4: replace it in the CMS

An Admin (or an editor, with a reviewer and an Admin to follow):

  1. Gets the image from KIMS (emergency_CoE.png, or any suitable Emergency hero image).
  2. In the CMS, Media library > upload it. Wait until its sizes appear (the worker makes them within a minute).
  3. Opens the entry Centres of Excellence > Emergency & Critical Care (English).
  4. In its hero, chooses the uploaded image (or any other existing image KIMS agrees).
  5. Saves, submits for review; a different person approves it.

If KIMS has no image yet, choose any existing image from the Media library as the hero for now.

#Step 5: the first publish proves the whole chain

An Admin publishes that change on Publishing. Expected on the Builds screen: the publish, then a Jenkins build starting by itself (cause publish), then live about 15 minutes later. This proves the worker can start builds with JENKINS_JOB_URL, JENKINS_USER and the kims-jenkins token.

Then open the Emergency page on the website; the new hero shows.

#UAT and production

UAT Production
Job kims-uat/kims-site-build (branch uat) kims-production/kims-site-build (branch main)
kims-site-env KIMS_ENV=uat, SITE_NOINDEX=true KIMS_ENV=production; SITE_NOINDEX=true only until launch
robots.txt Disallow all Allow, with sitemap (after launch)
Check on Its CloudFront domain, then the UAT host Its CloudFront domain only, until deploy/production-cutover
Emergency image Fix in UAT's CMS Fix again in production's CMS (separate database)
DNS Can point at the distribution as soon as the build works Only at go-live, when KIMS decides

#If it goes wrong

What you see Cause Fix
Fails at Check environment kims-site-env missing in this folder, or its KIMS_ENV does not match the branch jenkins/credentials
Fails at Install Agent cannot reach npm google/outbound-access
Fails at Export content Agent cannot reach RDS, or kims-database-url wrong Check the credential and 5432 from the agent
Fails at Quality gates, Lighthouse No Chrome on the agent jenkins/agent
Fails at Quality gates, sitemap/robots KIMS_ENV, SITE_NOINDEX or SITE_URL wrong for the environment deploy/environments
Fails at Bundle media with /media/ path(s) ... not in the bundle The media-path issue above Tell ClinicSpots (windows-fixes 05ef85a)
Fails at Bundle media with AccessDenied Agent role cannot read the assets bucket aws/iam
Fails at Sync website bucket or Invalidate CloudFront Agent role: website bucket write, cloudfront:CreateInvalidation aws/iam
A publish is refused The Emergency image (or another missing image the message names) Fix the Emergency hero image
A publish succeeds, no build appears Worker cannot start the job kubectl -n <NAMESPACE> logs deploy/kims-worker: JENKINS_JOB_URL (with the folder), user, token, job parameters, pods to Jenkins network path (jenkins/troubleshooting)
Only the home page loads Viewer-request function missing aws/cloudfront
Old pages after a build CLOUDFRONT_DISTRIBUTION_ID missing in kims-site-env, or the invalidation failed (a warning in the log) Add it; rebuild
Log warns CloudFront invalidation failed three times (Region is missing), or Redirects fails with Region is missing No AWS_REGION in kims-site-env Add AWS_REGION=<AWS_REGION>; rebuild
Export content fails with self-signed certificate in certificate chain The Node driver verifies RDS's certificate Fix kims-database-url: aws/rds-postgresql

#Sources

  • kims-v2/docs/ON-SITE-DEPLOYMENT.md (main, steps 8 to 10)
  • kims-v2/deploy/jenkins/Jenkinsfile.site (main)
  • kims-v2/deploy/jenkins/README-site.md
  • kims-v2/deploy/jenkins/check-environment.sh
  • kims-v2/deploy/jenkins/site-env-production.example
  • kims-v2/scripts/site-build/run.mjs
  • kims-v2/apps/website/src/app/robots.ts
  • kims-v2/scripts/gates/sitemap-robots.mjs
  • kims-v2/deploy/cloudfront/viewer-request.js (main)
  • windows-fixes commit 05ef85a (media paths split across chunks)
Built 2026-11-29. Commands are shown for the system picked at the top; every block has all three.