Operations
How Karyo is built, packaged, deployed, run, upgraded and recovered, and what the delivery pipeline checks on every change and every night.
| Document | What it covers |
|---|---|
| Building | The one deployable, the three version authorities, security floors, static analysis, the deterministic-test contract, and the licence notices packaged into every jar |
| Container images | The two images, their labels and base images, the reproducibility guard and the image scan |
| Deploying | The runbook: prerequisites, managed or external identity, environment validation, the first administrator, credential rotation and deploy stages |
| Operating an installation | Scheduled jobs, health, metrics, tracing and logs, the maintenance window, and verifying an installation |
| Upgrade, backup and recovery | Moving to a new release, backing up and restoring Karyo plus managed-provider state, and what no restore can undo |
| Identity principal upgrade | Reviewed manifest preflight/apply, issuer evidence, live ownership, cutover checks and the fix-forward boundary |
| Licence settings (retired) | The 1.x licence settings, accepted and ignored, and what GET /api/v1/license reports |
| Troubleshooting | Failures an installation produces once it is running, and what each means |
The delivery pipeline
Three workflows on one group of self-hosted runners. CI (.github/workflows/ci.yml) checks every
pull request and every push to main for one thing: that Karyo still builds and still starts. The
nightly workflow (.github/workflows/nightly.yml) runs everything else every night on main: the
backend suites, the realm and Pact tests, detekt, lint, the unit tests, the docs checks and the
image scan. The release workflow (.github/workflows/release.yml) builds, proves and scans the two
images, and publishes them only for a pushed v* tag (below). None of
the three publishes anything on a pull request.
Where it runs
.github/workflows/ci.yml runs on GitHub Actions for every push to main, every pull request
against main, and on manual dispatch (.github/workflows/ci.yml, on.push, on.pull_request, on.workflow_dispatch). The
nightly workflow runs on a schedule, which GitHub runs on the default branch, and on manual
dispatch (.github/workflows/nightly.yml, on.schedule, on.workflow_dispatch). Their token is read-only
(permissions.contents), except the nightly job that reports a failure, which may write issues.
A newer CI run on the same ref cancels the older one (concurrency); a nightly run never cancels
another.
Every job runs on a nebula runner in the organisation's nebula-private runner group, which is
open to this repository and to no public one (env, jobs.*.runs-on). Each is a Rocky Linux runner
that takes one job at a time; the group has three, so up to three jobs of the workflows run side by
side and the rest queue. Jobs run as an unprivileged account in no supplementary group, with no
access to a Docker daemon: its only container runtime is its own rootless Podman, and every
container a job starts - the started Karyo, the Dev Services databases and identity providers, the
Pact broker, the image builds and the scanner - runs there. The runner also puts a JDK 21 on
JAVA_HOME, which the Java jobs assert before they build (ci.yml, jobs.compile.steps: JDK 21 on the runner). Its own
Node.js is older than the line .nvmrc declares, so the jobs that need Node.js install that line
with setup-node and then check it with the same preflight the operator scripts use
(ci.yml, jobs.frontend.steps: Set up Node.js from .nvmrc, Node.js is the declared line).
A GitHub-hosted job began on an empty virtual machine. These hosts keep their home directory, caches and image store between jobs, and the workflows restore the freshness a result depends on rather than inheriting whatever an earlier run left:
No Gradle build cache. Every Gradle call passes
--no-build-cache(ci.yml,jobs.compile.steps: Compile Kotlin and its tests); the cache lives in the runner's home and outlives the workspace, so without it a task could be restored from an earlier run, and a test task could pass without starting a container. The checkout itself is cleaned of every untracked and ignored file before each job.Fresh images. Both images are built with
--pull=always --no-cache(ci.yml,jobs.package.steps: Build the application image, Build the web image), so each build takes the current base tags and a freshapk upgradelayer; so is the image the nightly scan builds (nightly.yml,jobs.scan.steps: Build the application image). The scanner is the exception: it is pinned by digest and pulled only when the host lacks it, so a Docker Hub outage cannot fail a scan the host could run (nightly.yml,jobs.scan.steps: Run Trivy vulnerability scanner).Nothing left running.
karyo-startsremoves its Compose project - containers, pod, volumes and network - however it ends, and again in a step of its own that runs even when the job was cancelled (ci.yml,jobs.karyo-starts.steps: Start Karyo and check it answers, Remove the stack;scripts/ci-karyo-starts.sh). The nightly test jobs remove every container Testcontainers started, with its anonymous volumes, whether the job passed, failed or was cancelled (nightly.yml,jobs.test.steps: Remove the containers the suite started); the Pact broker is published on loopback only, on a port the host picks so that jobs sharing the host never contend for one, and removed before and after use (nightly.yml,jobs.test.steps: Start an ephemeral Pact Broker, Stop the Pact Broker). Every job that builds or loads an image removes it (ci.yml,jobs.package.steps: Remove this run's images).A container API of the job's own. The nightly
testjob starts a Podman API service for itself,podman system service --time=0on a socket in the runner's temporary directory, and gives it to the Gradle step alone throughDOCKER_HOST(nightly.yml,jobs.test.steps: Container runtime, Run every module test task;scripts/ci-podman-api.sh), andrealm-testdoes the same. The runner's own service closes a keep-alive connection that has been idle for 10 seconds and exits soon after, while Testcontainers reuses pooled connections without checking them and does not retry a container create, so a create sent on a connection Podman had closed failed withBroken pipe(testcontainers-java #7310). The job's service has no idle timeout and serves the same rootless store, so the cleanup steps above see every container it created; it is stopped when the job ends, whether the job passed, failed or was cancelled (nightly.yml,jobs.test.steps: Stop the Podman API service).A
Broken pipeon a container create from a run without this service has a recognisable signature: an ApacheHttpRequestRetryExecline reporting a "recoverable I/O exception" in the class output of the uploaded test reports, shortly before "Could not start container". A retriedGETlogs that line and succeeds, about fifty times in an ordinary run; only aPOSTfails outright. Look for the line before debugging the test. While the service runs, theconmonprocess of eachpodman execsession outlives its session, so the runner prints "Terminate orphan process" lines for it at the end of the job. They are harmless.A declared clock and locale.
TZ=UTCandLANG=C.UTF-8are set for every job, matching theubuntu-latestimage the workflow ran on before, instead of the host's own (env.TZ, env.LANG).
The dependency caches - Gradle's downloaded modules, npm's and pip's package caches and Playwright's browser - stay in the runner's home between runs. They hold downloads, not results: what a job builds, tests and scans comes from its own checkout.
The runner group does not serve public repositories, and a host that keeps state between jobs must not run pull requests from strangers: if this repository is made public, its jobs wait until CI is given another home. A fork inherits the workflow but not the runner, so its jobs wait the same way rather than running on GitHub-hosted machines.
The CI jobs, and what each one gates
A pull request runs only checks whose failure means Karyo would not come up. The four required checks are Compile, Front-end build, Image build and Karyo starts.
| Job | Check name | Needs | What it runs |
|---|---|---|---|
changes |
Changes | - | scripts/ci-changes.sh: which of the jobs below the pull request's diff can affect (ci.yml, jobs.changes; below) |
compile |
Compile | changes |
./gradlew compileKotlin compileTestKotlin :libs:karyo-license:compileOperationalTestKotlin: the main and the test sources of every module, and the licence library's operationalTest sources. The tests run in the nightly suite (ci.yml, jobs.compile) |
frontend |
Front-end build | changes |
npm ci and npm run build for the console and for the floor app, each when it changed (ci.yml, jobs.frontend) |
package |
Image build | changes |
the production quarkusBuild and both images built with Podman's --timestamp 0, saved as one workflow artefact for karyo-starts (ci.yml, jobs.package) |
karyo-starts |
Karyo starts | changes, package |
the two images package built, started as a first deployment starts them, and five checks they must pass (below) (ci.yml, jobs.karyo-starts) |
compile, frontend and package start together once changes has answered, so a pull request
waits for the longest of them and then for karyo-starts. The image artefact is kept one day and
exists so that karyo-starts starts exactly the images package built, whichever runner takes it,
rather than whatever a runner's image store holds. A job that a failed job needed is skipped, and
the failed one already fails the run.
Karyo starts
scripts/ci-karyo-starts.sh is the job, and its header is the reference. It loads the two images
under names of this run's own, and brings them up with the production Compose file
(infrastructure/docker/docker-compose.prod.yml) and the managed Keycloak with the shipped
production realm, on an empty database, one service at a time in the deploy script's order, each
waited on through its own health check. The environment is scripts/.env.prod.example with every
placeholder replaced by a random secret or a CI literal, checked with deploy-server.sh --validate-env and rendered as a deployment renders it; no secret is printed. The public origin is
https://karyo-starts.test, which never resolves: every request goes to the web server's loopback
port with that origin's Host and X-Forwarded-Proto: https, as a deployment's TLS terminator
forwards it. The job passes only if all five hold:
- Every migration applied to the empty database. Flyway's history holds a successful row for
each migration file in the tree and no failed one, so a migration directory missing from
quarkus.flyway.locationsfails too. - The application reports liveness:
/q/health/livethrough the web server isUP, with no dependency detail. Other management paths return 404 and the readiness API requires sign-in. The container healthcheck has already proved readiness on the internal port. - Keycloak loaded the shipped realm: its discovery document, through the web server, names the issuer the environment configures.
- The console loads through the web server, and its API calls reach the application: the
console's page and its script are served, and an unauthenticated
/api/v1/meis the application's own 401 problem, not a proxy error. - One user signs in. The production realm defines no application users and demo mode creates
none, so the user is System, the setup account a fresh installation creates
(ADR 0053), with the one-time
password the job hands the application as the deploy script does.
scripts/ci_karyo_sign_in.pyruns the console's own client,karyo-web, through Keycloak's authorization-code flow with PKCE, replaces the one-time password when Keycloak requires it, exchanges the code for a token, and calls/api/v1/methrough the web server, which must answer 200.
The Compose project is named for the run and the web server takes a loopback port the host picks,
so two runs on one host never share a container, a volume or a port. A failure prints each
service's state and the end of its log before the stack is removed. podman-compose, the Compose
implementation the deploy script uses with Podman, is installed at a pinned version into the job's
temporary directory (ci.yml, jobs.karyo-starts.steps: Install podman-compose).
Which jobs a change runs
Every job reports on every pull request, so the required checks keep their names. A job the
change cannot affect is skipped at job level, and a skipped job counts as passed. The changes
job decides, from the pull request's merge commit against the base it was merged onto, and
scripts/ci-changes.sh holds the rules. A push to main and a manual dispatch always run every
job in full.
| What changed | Runs | Skipped |
|---|---|---|
Documents (docs/, the root documents the script names such as README.md and CONTRIBUTING.md, the issue and pull request templates), tests/, and the files only the nightly and release workflows read (nightly.yml, release.yml, scripts/ci-test-metrics.sh, scripts/ci-podman-api.sh, scripts/check-image-reproducibility.sh, scripts/scan-image.sh, scripts/check-third-party-notices.py, infrastructure/logging/) |
nothing but changes |
everything else |
The test sources (src/test/ under services/ or libs/) |
compile |
frontend, package, karyo-starts |
The console (frontend/web/) |
frontend (the console), package, karyo-starts |
compile |
The floor app (frontend/mobile/) |
frontend (the floor app), package, karyo-starts |
compile |
Backend source, resources or migrations under services/ or libs/, outside src/test/ |
compile, package, karyo-starts |
frontend |
Image inputs (NOTICE, LICENSE, THIRD-PARTY-NOTICES.md, the Dockerfiles, infrastructure/docker/nginx/) and scripts/deploy-server.sh, whose environment check karyo-starts runs |
package, karyo-starts |
compile, frontend |
ci.yml and its scripts, the Gradle build, buildSrc/, config/, the realms, the Compose files and the rest of infrastructure/ (all but infrastructure/logging/), the other scripts, .nvmrc, or a path no rule names |
everything | nothing |
A mixed change runs the union of its files' rows. The rule is deliberately closed: only a path a
rule names narrows a run, and a path nobody named runs everything.
tests/e2e/fixtures/ci-changes.test.ts runs the script against each row.
The nightly workflow
.github/workflows/nightly.yml runs on main every night at 02:17 UTC, and on manual dispatch.
Its jobs run whatever the diff:
| Job | Check name | What it runs |
|---|---|---|
test |
Tests | ./gradlew test: every module's test task, with the @QuarkusTest suites starting their own PostgreSQL through Dev Services on the runner's rootless Podman, reached through an API service the job starts and stops itself, with three test JVMs side by side (-PkaryoTestForks=3) and the Kotlin compiler inside the Gradle process. The job also starts an ephemeral Pact Broker, publishes the console's four consumer pacts to it and names it, so the four Pact provider tests run in the same Gradle invocation instead of being skipped. It measures what the suite cost - the peak memory of its processes and containers, the test counts and every application boot - and prints that in the log (nightly.yml, jobs.test.steps: Measure the suite, What the suite cost; scripts/ci-test-metrics.sh) |
realm-test |
Realm tests | ./gradlew :services:karyo-app:realmTest: the nine Keycloak realm classes that test skips, each against a Keycloak container of its own, through a Podman API service of the job's own, measured as test is (realm tests) |
pact-verify |
Pact verification | reports the result of the four Pact provider tests that ran in test: it reads their result files and the pacts they were given from that job's artefact and fails unless every published interaction was verified |
quality |
Quality | ./gradlew detekt |
frontend |
Front-end checks | lint and vitest for the console and the floor app; the end-to-end helper tests, which hold the docs, link, citation and consistency checks, and the collection of every Playwright spec, with no live stack; and a re-render of every figure under docs/diagrams/ that must leave the checked-in SVGs unchanged |
scan |
Scan (karyo-app) | the production quarkusBuild, the application image built fresh, and Trivy CRITICAL+HIGH on it with --exit-code 1 (container images) |
report |
Report a failure | runs only when a job above failed or was cancelled on main: opens one issue labelled ci-nightly, or comments on the open one, naming the failed jobs and linking the run (nightly.yml, jobs.report) |
pact-verify runs whether test passed, failed or was cancelled, so an unrelated failing test
cannot hide that the contracts held, and a test that left no Pact result fails it rather than
skipping it. The Pact provider tests share test's Gradle invocation and compile but boot an
application and database of their own; the check passes only when the number of interactions the
tests verified equals the number the console's consumer pacts published, and neither count is read
from anything but the files the two sides wrote. The test and quality reports and the Pact
verification results are uploaded as workflow artefacts and kept for seven days.
A nightly failure is never silent: the ci-nightly issue stays open, collecting a comment for each
failed night, until someone fixes the cause and closes it. A dispatch on another branch fails in the
Actions tab alone and files nothing.
What a green pull request does not prove
- No test ran. A green pull request says the backend compiles, both front ends build, both
images build and the images start and answer. The backend suites, the realm and Pact tests, the
front-end unit tests, lint, detekt, the docs, link and diagram checks and the image scan run the
next night on
main; a change that breaks one is reported in theci-nightlyissue after it merged, not before. Run the checks for what you touched before you open the pull request (contributing). - The test sources are compiled, not run.
compilebuilds the main and the test sources; a test that compiles but fails is reported by the nightlytestjob.compilealso builds theoperationalTestsource set oflibs/karyo-license, whichcompileTestKotlinleaves out. It does not run that source set, because running it needs the vendor secrets. - Karyo starts exercises one fresh installation, not an upgrade. The database is empty, the identity provider is the managed Keycloak and the profile is the example's. An upgrade over an existing database, an external provider and the extended profile are not started.
- The console is served, not run. Karyo starts fetches the console's page and script and calls
the API the console calls; no browser runs the console's code. The end-to-end specs are collected
each night, not run;
scripts/run-e2e.shruns them against a target an operator provides. - Only the desktop console's contract is verified, and nightly. Pact verification checks the four APIs the console's consumer pacts describe; nothing else on the HTTP surface has a contract artefact (see the HTTP API surface).
- Gradle's
checkis never run. Tasks wired only into it run in no job. The jar legal-file verification (build.gradle.kts,verifyJarLegalFiles, check) is the one the release workflow names explicitly; see building. - OWASP dependency-check is not run, although every Kotlin module applies it
(
build.gradle.kts,DependencyCheckExtension). - Only the application image is scanned each night, and only at CRITICAL and HIGH. The nginx
image is scanned by the release workflow alone, which scans both.
scripts/scan-image.shis the local reproduction of the nightly scan; see container images. - Reproducibility, the licence files and the SBOM are release checks. The release workflow
runs the determinism audit, proves each image identical across two builds, verifies the jar
legal files, reads the licence files back from both images and compares the three SBOMs'
components and licences with
THIRD-PARTY-NOTICES.md; no pull request does (see container images and building). - Figures are re-rendered nightly; screenshots are not re-captured. The captures under
docs/media/screens/are guarded only by their manifest (presence, dimensions, size, alt text), because pixels are not byte-stable across machines; a stale capture is caught by a reader, not by CI (style guide). - A skipped check is not a check that ran. On a pull request, a job whose inputs did not change is skipped and shown as passed (which jobs a change runs); it says the change could not affect that job, not that the job ran green on this change.
- Nothing here decides whether a red check blocks a merge. That is a repository setting, not part of the workflow.
Where the images go
Nowhere, from CI or the nightly workflow. package builds both images and hands them to
karyo-starts as a one-day internal artefact; nothing is pushed to a registry. Whoever runs Karyo
builds its images from source with the deploy script until a release publishes them.
The release workflow
.github/workflows/release.yml has four jobs on the same runners, with the same rootless Podman and
the same freshness rules: prepare (the version, the tag and actor checks, the determinism audit),
build (the base images pinned by digest, the jar legal-file verification, the three SBOMs
compared with the third-party notices, each
image built twice and required identical, labels and licence files read back, both images
scanned), and publish and draft-release, which run only for a pushed v* tag. A manual
dispatch is a dry run that publishes nothing. No check of it is required on a pull request.
Releasing owns the jobs, the guard and the
procedure; ADR 0056
records why only a pushed tag publishes.
Related
- Runtime and configuration - the core stack, optional managed Keycloak and configuration resolution
- Testing - what the test suites the pipeline runs actually cover
- ADR 0022 - the Compose deployment and optional managed identity service
- ADR 0023 - reproducible images