Runtime and configuration
What runs, how requests reach it, where its configuration comes from, and what runs on a timer.
Derived from infrastructure/docker/docker-compose.prod.yml,
infrastructure/docker/nginx/nginx.conf, services/karyo-app/src/main/resources/application.yaml
and every @Scheduled site.
Three core containers and optional managed Keycloak
| Container | Image |
|---|---|
postgresql |
docker.io/postgres:16-alpine |
keycloak |
quay.io/keycloak/keycloak:26.8.0 (managed-identity profile only) |
karyo-app |
${KARYO_APP_IMAGE:-karyo/karyo-app:latest} |
nginx |
${KARYO_NGINX_IMAGE:-karyo/nginx:latest} |
One volume (karyo-pgdata), one network (karyo-net)
(infrastructure/docker/docker-compose.prod.yml, volumes.karyo-pgdata, networks.karyo-net). Only nginx publishes ports (services.nginx.ports).
The supported Compose file always runs PostgreSQL, the application and nginx. Its
managed-identity profile adds Keycloak; EXTERNAL identity mode leaves that service stopped and
uses a separately operated OIDC provider (ADR 0022,
ADR 0037). How to install either
profile is Deploying.
nginx routing
| Location | Target |
|---|---|
/api/internal/ |
return 404 |
/api/ |
karyo-app |
exact /q/health/live |
karyo-app, anonymous liveness without detail |
all other /q/ paths |
return 404 |
/auth/, /resources/, /realms/ |
Keycloak in the managed-identity profile |
/m/ |
floor PWA, SPA fallback to the mobile index.html |
/ |
desktop console, SPA fallback to the desktop index.html |
The /api/internal/ block is defence in depth (infrastructure/docker/nginx/nginx.conf, location /api/internal/).
Cross-module calls are in-process SPI bean injection, not REST, and the application exposes no
internal REST resources, but without the block the prefix would be reachable from the internet
through the /api/ rule. A more specific prefix wins in nginx regardless of ordering.
Only exact /q/health/live is public. Readiness detail goes through the signed-in
/api/v1/admin/health route with settings.manage at the Company. Container probes read readiness on the
internal application port. All other /q/ paths, metrics included, return 404 through nginx.
Two operational properties are worth keeping in view because neither is visible from the compose
file: nginx re-resolves its upstream addresses at runtime - the karyo-app and keycloak servers
are marked resolve (nginx.conf, upstream karyo-app, upstream keycloak) - so recreating a selected upstream is picked up within
about ten seconds without a coordinated nginx refresh; and rootless Podman cannot normally bind
port 80.
One configuration file
application.yaml in the aggregator is the only main-source runtime configuration in the
repository. There is no per-module config file. It carries the Flyway locations list,
standards-based OIDC trust and claim normalization, optional Keycloak administration settings, the
union of every module's Caffeine cache names, every scheduler interval, and the configuration keys of the engine modules,
which the engines read once they act
(The engine boundaries).
Runtime properties additionally resolve through a database chain: Business Unit override, then Company configuration key 0, then
config, then catalogue default. A database row can therefore intentionally override an environment
variable, which is the opposite of the usual precedence and worth knowing before debugging a
setting that will not take. SystemPropertyCatalog
(services/auth-service/karyo-auth-core/src/main/kotlin/com/karyo/auth/config/SystemPropertyCatalog.kt)
is the register of knobs; the runtime configuration store
describes the chain in full.
Schedulers
Six @Scheduled methods in this repository. Five take their interval from a configuration property
and all five use ConcurrentExecution.SKIP:
WebhookFanoutScheduler, WebhookDeliveryScheduler, StockPurgeScheduler,
KeycloakEventPoller, ReplenishmentScheduler.
The sixth, LocationFinderService.sweepExpiredReservations, is hardcoded to 60s and has no
SKIP (.../layout/service/LocationFinderService.kt). It renews the reservations of open
transport orders and then deletes expired rows, both idempotent, so overlap is harmless and
omitting SKIP is defensible; it is also the only scheduler with no tenant loop, since it takes
its Facilities from the rows it finds. All three departures are undocumented.
The engine modules bring schedulers of their own. Their interval keys are
already in application.yaml: karyo.monitors.interval and karyo.monitors.delivery-interval,
karyo.crossdock.sweep-interval, karyo.wave.auto-interval and karyo.streaming.interval.
The alert-delivery relay's karyo.monitors.delivery-batch-size and
karyo.monitors.delivery-max-attempts and the six karyo.webhooks.* relay keys sit in the same
file, each written ${KARYO_<AREA>_<KEY>:default} and listed in scripts/.env.prod.example.
Reproducibility
Image builds need --timestamp 0 (Podman/Buildah) or SOURCE_DATE_EPOCH=0 (Docker BuildKit)
(ADR 0023).
scripts/check-image-reproducibility.sh audits a fixed list of build sites (helper_is_deterministic, BUILD_SITES),
and the release workflow runs the audit before it builds either image (.github/workflows/release.yml, jobs.prepare.steps: Audit image-build determinism;
ADR 0057). The list is
fixed, not discovered: a new build site has to be added to it explicitly or it is simply not
checked.
Related
- Deploying - installing the selected identity profile and Compose stack
- Operating an installation - running them
- The runtime configuration store - the database property chain
- Identity and tenancy - how schedulers handle tenants