Skip to content

Ansible

This repository uses Ansible for VPS bootstrap, deployment, and post-deploy verification.

Source of Truth

Phase 2 moved Ansible off local shell env files and onto inventory plus Vault.

  • Non-secret deployment defaults live in main.yml.
  • The tracked template is ansible/inventory/group_vars/production/vault.yml.example.
  • The real local secret file is ansible/inventory/group_vars/production/vault.yml.
  • The local Vault password file is ansible/.vault_pass and is gitignored.
  • The real local Vault file is gitignored and must not be committed.

Layout

ansible/
  ansible.cfg
  inventory/
    production.yml
    group_vars/
      production/
        main.yml
        vault.yml.example
  playbooks/
    bootstrap.yml
    deploy.yml
    verify.yml
  roles/
    base/
    docker/
    swap/
    watchdog/
    postgres_backup/
    deployment_silence/
    backend_upgrade/      # main.yml: quiesce; recover.yml: restart after an early failure
    app/                  # prepare.yml: no service touched; converge.yml: containers
    verify/
    cleanup/
  tests/
    asset-mirror.yml      # driven by scripts/verify-asset-mirror.py
  requirements.yml
Makefile

Commands

Install required collections:

make ansible-galaxy

Check host connectivity:

make ansible-ping

Open an SSH session using the same resolved values Ansible uses:

make ansible-ssh

Bootstrap the VPS:

make ansible-bootstrap

Deploy the stack:

make ansible-deploy
make ansible-deploy-backend-upgrade   # backend version changed: quiesce, quiesced backup, migrate

Both targets (and make ansible-reset-demo-state) first run make deploy-preflight on the laptop: docker compose -f docker-compose.server.yml config --quiet and the docs image build with its mkdocs build --strict (python3 scripts/release-train.py preflight). A broken docs tree or Compose file stops there, before Ansible connects. scripts/release-train.py deploy runs the same preflight itself and calls the target with SKIP_DEPLOY_PREFLIGHT=1.

Run verification only:

make ansible-verify

Run the guarded retention cleanup independently:

make ansible-cleanup

Reset the public demo data store and redeploy from a clean baseline:

make ansible-reset-demo-state

Start and kill the Mailpit SSH tunnel:

make ansible-tunnel-mailpit
make ansible-tunnel-kill-mailpit

Edit encrypted production vars:

make ansible-edit-vault

Initialize a local Vault file on a new machine:

cp ansible/inventory/group_vars/production/vault.yml.example \
  ansible/inventory/group_vars/production/vault.yml
cd ansible
ansible-vault encrypt inventory/group_vars/production/vault.yml --vault-password-file .vault_pass

How Deploy Works

deploy.yml is the normal operational entrypoint. Nothing that can fail for a reason unrelated to the database migration runs after a service is stopped.

It performs these steps in order:

  1. Runs the guarded swap role. It can converge a 1 GiB emergency swap file and low swappiness on capable hosts; it reports a tracked reason and makes no swap changes on the current MIKR.US LXC host.
  2. Runs the watchdog role: installs the host watchdog script, its configuration, the one-minute awesome-watchdog.timer and the [email protected] template the backup units use as OnFailure= (see the lean monitoring plan).
  3. Runs the postgres_backup role and creates the encrypted pre-deploy backup.
  4. Prepares the release while the previous release still serves traffic (app role, prepare.yml): validates the Vault keys and image gates, copies the Compose file, mirrors the asset directories (copy, then prune files the repository tracked and has since deleted; see Asset directory mirror), renders the runtime .env* files, validates the result with docker compose config --quiet, pulls every missing image and builds the docs image (mkdocs build --strict). Running containers keep their old configuration: env files and single-file mounts are read when a container is created. A failure here stops the deploy with every service running.
  5. Pauses the watchdog's container checks for 15 minutes. Its OOM, disk, memory and backup checks remain active.
  6. With backend_upgrade_quiesce=true (make ansible-deploy-backend-upgrade), runs the backend_upgrade role: pulls the reviewed backend, records the running backend, warehouse-, payment-, notification- and delivery-service containers of both sites, stops them and takes the quiesced encrypted backup (no writes after it).
  7. Converges the containers (app role, converge.yml): reconciles the PostgreSQL role password with Vault, runs docker compose up (no build: the docs image is already built), removes the retired monitoring volumes when they still exist, and recreates gateway and edge. Steps 6 and 7 run in one block whose rescue handles a failure: see Recovering from a failed deploy.
  8. Runs the verify role to make sure the deployed stack is actually reachable.
  9. Resumes the watchdog's container checks immediately after verification succeeds. If a deploy fails first, the pause expires after 15 minutes.
  10. Runs the guarded cleanup role only after verification succeeds.

This is intentional. In this project, a deploy that leaves the gateway returning 502 is a failed deploy, not a successful deploy with a separate follow-up check.

reset-demo-state.yml is the destructive recovery path for the public demo host. It:

  1. Stops the deployed stack.
  2. Deletes the named Postgres volume for the server profile.
  3. Runs the normal app and verify roles to recreate the stack from a clean baseline.

Because mailpit is recreated as part of the stack restart, its in-memory inbox is cleared too.

Recovering from a failed deploy

The play ends with a message naming the failed task and what it did:

Failed in State What to do
Local preflight (make deploy-preflight) Nothing was deployed. Fix the Compose file or the docs (mkdocs build --strict names the page), commit, rerun.
Steps 1 to 5 (backup, prepare, silence) No service was stopped; the previous release serves traffic. The server may hold the new files and env files, which running containers ignore. Fix the cause and rerun the same make target.
Step 6 or 7 before docker compose up (quiesced backup, password reconciliation) The rescue restarts the exact backend, warehouse-service and payment-service containers it stopped and waits until they are healthy; no migration ran. Check the message's container states, fix the cause, rerun make ansible-deploy-backend-upgrade.
Step 7 from docker compose up on, or verify The new release started; migrations may have run. The old backends are not restarted (their binaries may not accept the migrated schema). Fix the cause and rerun the same make target; the play converges idempotently. If the new backend cannot run, roll back: re-pin the previous release and restore the quiesced backup (Production backups).
Step 6, PostgreSQL major upgrade, after the old server stopped The old backends are not restarted. The old volume postgres-data is untouched; the roles and testdb dumps are in /var/backups/awesome-localstack/postgres/major-upgrade. Fix the cause and rerun make ansible-postgres-major-upgrade (the target server starts on its empty volume again only if it holds no tables; otherwise remove awesome-server_postgres19-data first), or roll back as described in PostgreSQL major upgrade.

The watchdog pause expires after 15 minutes on its own; after that a still-broken stack alerts normally. Check the state with make ansible-verify or docker compose -f docker-compose.server.yml ps over make ansible-ssh. Do not delete deployed files by hand in /opt/awesome-localstack: the next run removes files the repository tracked and deleted, and keeps (and lists) files git never tracked there.

PostgreSQL major upgrade

make ansible-postgres-major-upgrade moves the stable database to a new PostgreSQL major (16 to 19 in December 2026). A data directory cannot be opened by another major, so the upgrade is a logical dump and restore. The target server runs on its own volume (postgres19-data, mounted at /var/lib/postgresql as PostgreSQL 18+ images expect).

It is the normal deploy with backend_upgrade_quiesce=true and postgres_major_upgrade=true; the postgres_major_upgrade role runs between the quiesce and docker compose up:

  1. The quiesce stops both backends and every service, and takes the encrypted backend-upgrade-quiesced backup.
  2. The role refuses unexpected databases (only postgres and testdb) and records the exact row count of every table.
  3. It dumps the roles (pg_dumpall --roles-only: the service roles with their password verifiers) and testdb (pg_dump --format=custom, with owners and grants) to /var/backups/awesome-localstack/postgres/major-upgrade (root only).
  4. It stops the old servers, starts the target server on its empty volume, restores the roles and testdb, compares the row counts, and runs vacuumdb --analyze-only.
  5. It renews aitesters-postgres from a fresh volume (the sandbox is reset every night anyway), and clears the broker's duplicate-ID cache.
  6. The deploy continues: docker compose up, verify, cleanup. The aitesters services migrate and seed their new database on start.

A rerun finds the target major and skips the role. The old volume awesome-server_postgres-data is never written to.

Every other deploy runs the role's guard before anything stops: while the running stable server is older than the pinned major, make ansible-deploy and make ansible-deploy-backend-upgrade refuse, because they would start the new major on its empty volume.

Rollback: re-pin the previous postgres image with postgres-data:/var/lib/postgresql/data (git revert of the upgrade PR) and run make ansible-deploy. Anything written after the upgrade is lost. Once the new server has run for a while, remove the old volume and the dumps by hand.

scripts/verify-postgres-major-upgrade.sh runs the real role on a disposable project: - a PostgreSQL 16 database with the service roles, backend-rs's schema and one table per service schema; - the checks: the new major, row counts, passwords, ownership, the warehouse role still denied public.app_user, the old volume kept, a no-op rerun, and backend-rs signing in on the result.

Patterns Used

Asset directory mirror

The app_copy_paths directories (security, artemis, postgres, nginx, images, branding, docs, docs-site) mirror the checkout (roles/app/tasks/assets.yml): ansible.builtin.copy uploads them (root-owned, modes preserved), then the prune deletes only what Ansible could have put there. A deployed path is deleted when it is

  1. absent from the checkout, and
  2. tracked in this repository's git history under the same path (git log --all --no-renames --name-only -- <dirs> on the laptop), and
  3. not under app_copy_prune_excludes (role default: empty; for files a role renders inside a mirrored directory).

A directory is deleted only when it held tracked files and nothing untracked remains below it. Everything else the checkout lacks, such as manual backups like nginx/conf.d/edge-gateway.conf.before-*, is kept and listed in the play output as untracked files on the server (kept): …; delete those by hand if they are no longer wanted. A shallow or incomplete local history only makes the prune keep more.

Pruning never leaves those directories: the Compose file, the rendered .env* files, backups and Docker volumes are outside them and are never listed. The prune refuses to run when the checkout listing misses one of the directories (a wipe instead of a mirror). The decision is roles/app/filter_plugins/asset_mirror.py; built-in modules do the rest, with no rsync on the server. scripts/verify-asset-mirror.py (CI job verifyContracts) runs the real tasks against a fixture git repository: a tracked and deleted file is removed, an unknown manual file and the secrets are kept.

Convergent deploys

The Compose task uses convergent settings rather than forced recreation:

  • pull: missing
  • recreate: auto
  • remove_orphans: true

That keeps repeated deploys idempotent when the server state already matches the repo.

Artemis 2.55 volume migration

The official apache/artemis image uses the explicit activemq-data volume. The retired apache/activemq-artemis image created an anonymous instance volume whose launch scripts refer to the old distribution layout and cannot be reused by Artemis 2.55. Before the first deployment of Artemis 2.55, drain or export pending messages and retain a backup of the anonymous volume. The first convergent deployment creates the new named volume; do not delete the old anonymous volume until the Artemis-to-consumer delivery check has passed.

Artemis carries only emails

Commerce events travel through the backend's event feed on both sites (EVENT_FEED.md, ADR 12); the shared Artemis carries only the email queue to the consumer. Only the backend (SPRING_ARTEMIS_*), the awesome notification-service and the consumer get broker credentials.

converge.yml deletes the queues and addresses of the retired broker transport (<site>.commerce.events.*, their DLQ. queues and commerce.events.DLA) from the running broker with the artemis CLI; a queue that no longer exists is skipped, so the task is safe to repeat. It also removes the old aitesters-broker-dedupe-reset helper.

Verification as part of deploy

The verify role remains separate so it can still be run on demand, but it is also included in deploy.yml.

The role checks:

  • docker compose ps
  • every expected service is running the exact image ID resolved from the reviewed immutable Compose reference
  • an Artemis message is consumed and delivered to Mailpit as a uniquely named email
  • every commerce event queue of both sites exists with at least one consumer and has its dead-letter queue (verify_commerce_event_consumer_queues); names are matched up to the column bar of artemis queue stat, because the longest one fills its column without padding
  • http://127.0.0.1/login
  • http://127.0.0.1/v3/api-docs
  • http://127.0.0.1/images/iphone.png
  • http://127.0.0.1/mailpit/api/v1/messages returns 404
  • http://127.0.0.1/mailpit/ returns 404
  • the nine public routes answer 200 over HTTPS: login, the backend, warehouse, payment, notification and delivery OpenAPI documents and the delivery micro-frontend (/mfe/delivery/remote.js) on awesome.byst.re, login and OpenAPI on aitesters.byst.re
  • the emergency swap file and swappiness when swap_enabled is true
  • every application service is a Rust binary, so there is no JVM heap to check
  • the warehouse, payment, notification and delivery database roles of both databases own their schema, cannot read public.orders or public.app_user, cannot create in public and cannot use each other's schemas
  • the direct warehouse-, payment-, notification- and delivery-service health and OpenAPI routes, the direct llm-service health route (llm-service:4007 and aitesters-llm-service:4007; it serves no OpenAPI document), /warehouse/v3/api-docs, /payment/v3/api-docs, /notification/v3/api-docs and /delivery/v3/api-docs through the gateway (both hosts), /api/v1/tracking/<unknown> answering 404 from warehouse-service and /api/v1/deliveries/track/<unknown> from delivery-service
  • awesome-watchdog.timer is active and awesome-watchdog run --dry-run exits 0; the dry run and awesome-watchdog diagnose (readable OOM sources) are printed
  • bootstrap admin sign-in succeeds
  • authenticated GET /api/v1/products returns a non-empty catalog

Readiness retries

The backends start in well under a second, but they wait for PostgreSQL and Flyway, and the gateway may briefly answer 502 while containers are recreated.

For that reason, HTTP verification uses retries and delay rather than failing immediately on a temporary 502.

Split responsibilities by role

  • base: baseline packages, app directory, SSH daemon hardening for key-only root login
  • docker: Docker apt repository, engine, Compose plugin, daemon state
  • swap: guarded emergency-swap convergence; disabled on the current LXC host because the provider rejects swapon
  • watchdog: host watchdog (containers, OOM, disk, memory, backups) with Telegram delivery and an optional dead-man ping
  • postgres_backup: encrypted backups, restore checks, and the pre-deploy backup; both units notify Telegram through the watchdog on failure
  • deployment_silence: the bounded pause of the host watchdog's container checks during a deploy (disk, memory, OOM and backup checks keep running; until December 2026 it also silenced Alertmanager warnings)
  • backend_upgrade: opt-in quiesce (stop both backends and their services, quiesced backup) and the rescue restart of the stopped containers
  • app: prepare.yml (gates, asset mirror, env rendering, Compose validation, pulls, docs build: no service touched) and converge.yml (Compose convergence); main.yml runs both for reset-demo-state.yml
  • verify: operational checks after deploy
  • cleanup: checksum- and age-guarded retirement of the legacy Artemis volume plus pruning of unused images older than the retention window

PostgreSQL restore verification

The weekly checker restores the latest encrypted backup into a disposable PostgreSQL container and requires at least one public table. Readiness and SQL connections use TCP on 127.0.0.1: the image's temporary initialization server accepts Unix-socket connections before the permanent server starts. A socket probe can therefore report readiness just before initialization shuts it down, which caused the 2026-10-04 verification failure.

Run python3 scripts/verify-postgres-restore.py to verify this contract locally with Docker. The check deliberately delays initialization, restores an encrypted fixture, verifies its data, and removes the disposable container. CI runs it too.

Retention-based container cleanup

The cleanup role installs a daily systemd timer and also runs once after a successful deployment verification. The production retention window is 30 days. It removes only unused images older than that window.

The retired Artemis anonymous volume has an additional guard: the exact encrypted backup and its checksum sidecar must exist and verify successfully, the backup must be at least 30 days old, and no container may still reference the volume. Until every condition passes, the volume is retained. The encrypted backup is not deleted by this role.

Vault Workflow

The local production Vault file stores values such as:

  • production_ssh_host
  • production_ssh_port
  • production_ssh_user
  • production_ssh_key_path
  • alertmanager_telegram_bot_token (the host watchdog's Telegram bot; the name dates from Alertmanager)
  • alertmanager_telegram_chat_id (the host watchdog's Telegram chat)
  • watchdog_waitcher_heartbeat_token (wh_ token of the Waitcher watchdog heartbeat monitor; empty disables the dead-man check)
  • artemis_username
  • artemis_password
  • postgres_password
  • app_bootstrap_admin_enabled
  • app_bootstrap_admin_username
  • app_bootstrap_admin_password
  • app_bootstrap_admin_email
  • jwt_signing_key, aitesters_jwt_signing_key
  • warehouse_service_token, aitesters_warehouse_service_token
  • warehouse_postgres_password, aitesters_warehouse_postgres_password, aitesters_postgres_password
  • payment_service_token, aitesters_payment_service_token
  • payment_webhook_secret, aitesters_payment_webhook_secret
  • payment_postgres_password, aitesters_payment_postgres_password
  • notification_service_token, aitesters_notification_service_token
  • backend_service_token, aitesters_backend_service_token
  • notification_postgres_password, aitesters_notification_postgres_password
  • notification_webhook_secret_encryption_password, notification_webhook_secret_encryption_salt, aitesters_notification_webhook_secret_encryption_password, aitesters_notification_webhook_secret_encryption_salt

APP_BOOTSTRAP_PRODUCTS_ENABLED is tracked in production/main.yml rather than Vault so a clean reset recreates the public-safe catalog automatically.

To rotate or update them:

make ansible-edit-vault

Manual Usage

Run a playbook directly:

cd ansible
ansible-playbook playbooks/deploy.yml --vault-password-file .vault_pass

Run an ad hoc command:

cd ansible
ansible production -a 'docker compose -f /opt/awesome-localstack/docker-compose.server.yml ps' --vault-password-file .vault_pass

Resolve the SSH connection values Ansible uses:

cd ansible
./resolve-ssh-vars.sh

Notes

  • verify.yml is still useful when you want smoke checks without changing deployment state.
  • bootstrap.yml is intended to be idempotent on an already-configured host.
  • The old shell deployment path has been removed; use make ansible-deploy.

Stable and sandbox authentication isolation

Configure distinct jwt_signing_key and aitesters_jwt_signing_key values in Ansible Vault: single-line base64 PKCS#8 RSA private keys of at least 2048 bits (openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 | openssl pkcs8 -topk8 -nocrypt -outform DER | base64 | tr -d '\n'; OpenSSL 3 writes PKCS#1 for genpkey -outform DER, which the backend rejects). The backends sign access tokens with RS256 and publish the public keys at /internal/v1/jwks.json for their warehouse-services. Deployment renders .env.runtime for the stable backend and .env.aitesters for the disposable backend. The latter receives the same required service settings with its own signing key, and never inherits the stable runtime file. Both files are root-owned mode 0600 and ignored by Git. Ansible rejects missing, malformed or equal signing keys and verifies that tokens issued by one site return HTTP 401 at the other.

warehouse-service secrets and image gate

Configure warehouse_service_token in Ansible Vault (at least 32 random characters, for example openssl rand -hex 32). It reaches the stable backend through .env.runtime and warehouse-service through .env.warehouse, which contains only WAREHOUSE_SERVICE_TOKEN and SPRING_DATASOURCE_PASSWORD (root-owned, mode 0600). warehouse-service verifies access tokens with the backend's JWKS and connects as the warehouse database role, whose password is warehouse_postgres_password (aitesters_warehouse_postgres_password in the sandbox, each at least 16 characters and distinct from the superuser passwords). The one-shot postgres-roles and aitesters-postgres-roles services run postgres/service-roles.sh (which runs postgres/service-role.sh for the warehouse and payment roles) with .env.postgres-roles / .env.aitesters-postgres-roles (superuser and role passwords) before every warehouse-service start: they create or update the role, hand it the warehouse schema and its tables, and fail if it could read the backend's public tables. Verification expects both one-shots to have exited 0 and checks that the role owns warehouse and cannot read public.orders or public.app_user. The aitesters sandbox pairs aitesters-backend with its own aitesters-warehouse-service, both on aitesters-postgres (database aitesters, warehouse schema warehouse): .env.aitesters carries aitesters_warehouse_service_token and replaces the stable database password with aitesters_postgres_password; .env.aitesters-warehouse / .env.aitesters-postgres carry that token, the sandbox warehouse role password and the sandbox superuser password. The nightly reset recreates the database, aitesters-postgres-roles, the backend and warehouse-service with --renew-anon-volumes, so the sandbox database starts empty and reseeds. Deployment fails unless both warehouse services use a published tag@sha256 (the VPS builds no service images); set warehouse_service_allow_unpinned_image=true only for a deliberately pre-loaded image. Verification checks the direct warehouse-service:4003 and aitesters-warehouse-service:4003 health and OpenAPI routes, the aitesters host's /warehouse/v3/api-docs and /internal/ routes, the proxied /warehouse/v3/api-docs route and the /internal/ 404 guard.

payment-service secrets and image gate

Add six values to Ansible Vault (see vault.yml.example):

Key Rule Reaches
payment_service_token at least 32 characters (openssl rand -hex 32) .env.runtime (backend) and .env.payment
aitesters_payment_service_token at least 32 characters .env.aitesters and .env.aitesters-payment
payment_webhook_secret at least 32 characters .env.runtime and .env.payment
aitesters_payment_webhook_secret at least 32 characters .env.aitesters and .env.aitesters-payment
payment_postgres_password at least 16 characters .env.payment, .env.postgres-roles
aitesters_payment_postgres_password at least 16 characters .env.aitesters-payment, .env.aitesters-postgres-roles

The app role refuses to deploy unless the four tokens and webhook secrets differ from each other and from both warehouse service tokens, and the six database passwords (superusers, warehouse and payment roles of both databases) are all distinct. .env.payment and .env.aitesters-payment (root-owned, mode 0600) contain only PAYMENT_SERVICE_TOKEN, PAYMENT_WEBHOOK_SECRET and SPRING_DATASOURCE_PASSWORD; payment-service verifies access tokens with its backend's JWKS and holds no signing key. The backends never call payment-service (backend 3.16.0 removed PAYMENT_BASE_URL); each payment-service polls its own backend's event feed for card refunds through BACKEND_BASE_URL, set in Compose.

The one-shot postgres-roles services prepare the payment role and schema next to warehouse, so the payment role password is required for both one-shots. The nightly aitesters reset and make ansible-reset-aitesters-state also recreate aitesters-payment-service, and the coordinated backend upgrade stops both payment-services with the backends.

Deployment fails unless payment-service and aitesters-payment-service use a published tag@sha256; set payment_service_allow_unpinned_image=true only for a deliberately pre-loaded image. Verification adds the public route https://awesome.byst.re/payment/v3/api-docs.

notification-service secrets and image gate

notification-service 1.0.0 (backend 3.21.0) needs eight Vault values (see vault.yml.example):

Key Rule Reaches
notification_service_token at least 32 characters (openssl rand -hex 32) .env.runtime (backend) and .env.notification
aitesters_notification_service_token at least 32 characters .env.aitesters and .env.aitesters-notification
notification_postgres_password at least 16 characters .env.notification, .env.postgres-roles
aitesters_notification_postgres_password at least 16 characters .env.aitesters-notification, .env.aitesters-postgres-roles
notification_webhook_secret_encryption_password at least 32 characters .env.notification (WEBHOOKS_SECRET_ENCRYPTION_PASSWORD)
notification_webhook_secret_encryption_salt at least 16 bytes in hex (openssl rand -hex 16) .env.notification (WEBHOOKS_SECRET_ENCRYPTION_SALT)
aitesters_notification_webhook_secret_encryption_password at least 32 characters, different from the stable one .env.aitesters-notification
aitesters_notification_webhook_secret_encryption_salt at least 16 bytes in hex .env.aitesters-notification

The app role refuses to deploy unless the two notification tokens differ from each other and from every payment and warehouse token or webhook secret, and the eight database passwords (superusers, warehouse, payment and notification roles of both databases) are all distinct. The encryption key protects the webhook signing secrets notification-service stores; changing it later makes the stored secrets unreadable, so set it once.

.env.notification (root-owned, mode 0600) contains only NOTIFICATION_SERVICE_TOKEN, SPRING_DATASOURCE_PASSWORD, the broker credentials (SPRING_ARTEMIS_USER/_PASSWORD from artemis_username and artemis_password: the stable site sends commerce emails to the email queue) and the encryption key. .env.aitesters-notification holds the sandbox token, role password and encryption key plus LOCAL_EMAIL_OUTBOX_ACCESS_KEY (local_email_outbox_access_key): the sandbox keeps commerce emails in the local outbox, like aitesters-backend. Both backends get their site's NOTIFICATION_SERVICE_TOKEN; Compose sets NOTIFICATIONS_DELIVERY=feed and WEBHOOKS_ENABLED=false on both.

The postgres-roles one-shots prepare the notification role and schema next to warehouse and payment. The nightly aitesters reset and make ansible-reset-aitesters-state also recreate aitesters-notification-service, and the coordinated backend upgrade stops both notification-services with the backends. Verification checks the role isolation of notification (and that warehouse and payment cannot use its schema), the direct routes http://notification-service:4005 and http://aitesters-notification-service:4005, /notification/v3/api-docs through both gateway hosts and the public route https://awesome.byst.re/notification/v3/api-docs. The host watchdog covers a missing notification-service.

Deployment fails unless notification-service and aitesters-notification-service use a published tag@sha256 (today notification-service-rs:1.1.0). Before its first release the server Compose file carried a PENDING_NOTIFICATION_SERVICE_DIGEST placeholder, so the gate failed on purpose; set notification_service_allow_unpinned_image=true only for a deliberately pre-loaded image.

delivery-service secrets and image gate

delivery-service (DELIVERY_SERVICE_CONTRACT.md) needs four Vault values (see vault.yml.example):

Key Rule Reaches
delivery_service_token at least 32 characters, different from every other service token .env.runtime (backend) and .env.delivery
aitesters_delivery_service_token at least 32 characters, different from the stable one .env.aitesters and .env.aitesters-delivery
delivery_postgres_password at least 16 characters .env.delivery, .env.postgres-roles
aitesters_delivery_postgres_password at least 16 characters, different from the stable one .env.aitesters-delivery, .env.aitesters-postgres-roles

.env.delivery (root-owned, mode 0600) contains only DELIVERY_SERVICE_TOKEN, DATABASE_PASSWORD and the broker credentials (BROKER_USER / BROKER_PASSWORD). The postgres-roles one-shots prepare the delivery role and schema. The nightly aitesters reset and make ansible-reset-aitesters-state recreate aitesters-delivery-service, and the coordinated backend upgrade stops both delivery-services with the backends (they write to the database the backup copies). Verification checks the delivery role isolation, the direct routes on port 4006, the OpenAPI document and the micro-frontend through both hosts, and an unknown tracking code answering 404. Deployment fails unless both delivery-services use a published tag@sha256 (delivery_service_allow_unpinned_image=true only for a deliberately pre-loaded image).

llm-service token and image gate

llm-service (LLM_SERVICE_CONTRACT.md) has no database and needs two Vault values:

Key Rule Reaches
llm_service_token at least 32 characters .env.runtime (backend) and .env.llm
aitesters_llm_service_token at least 32 characters .env.aitesters and .env.aitesters-llm

The app role refuses to deploy unless the two llm tokens differ from each other and from every notification, payment and warehouse token and payment webhook secret. .env.llm contains only LLM_SERVICE_TOKEN. Deployment fails unless llm-service and aitesters-llm-service use a published tag@sha256 (llm_service_allow_unpinned_image=true only for a deliberately pre-loaded image). llm-service is stateless, so neither the aitesters reset nor the backend upgrade stops it. Verification checks the direct health route of both llm-services (http://llm-service:4007/actuator/health and http://aitesters-llm-service:4007/actuator/health) from inside the gateway.

Backend service token (stock commands)

warehouse-service owns the stock ledger and the backend calls it synchronously for every stock command (ADR 6). The backend authenticates with its own service token; add two values to Ansible Vault (see vault.yml.example):

Key Rule Reaches
backend_service_token at least 32 characters (openssl rand -hex 32) .env.runtime (backend) and .env.warehouse (BACKEND_SERVICE_TOKEN)
aitesters_backend_service_token at least 32 characters .env.aitesters and .env.aitesters-warehouse

The app role refuses to deploy unless both are set and the ten service tokens and webhook secrets (backend, warehouse, payment and notification tokens and the payment webhook secrets of both sites) are all distinct; the llm and delivery tokens have their own distinctness checks (above). Compose sets WAREHOUSE_URL on each backend to its own site's warehouse-service (http://warehouse-service:4003, http://aitesters-warehouse-service:4003); scripts/verify-release-images.py checks that pairing, that the token comes only from the env files, and that no backend depends_on its warehouse-service (warehouse-service waits for the backend's JWKS, so the dependency must point one way only). Until warehouse-service is healthy after a deploy, checkout and admin stock adjust answer 503 Inventory service unavailable.

Memory budget

The VPS has about 4.25 GiB of RAM and no swap. Container limits are safety ceilings and are deliberately overcommitted: the long-running services' limits added up to about 5.8 GiB, while the last measured host had 2.8 GiB available (9 November 2026, after the native-image migration). Lean monitoring phase A removed Grafana (640 MiB limit, about 450 MiB working set), cAdvisor followed on 30 November 2026, and phase C (December 2026) removed Prometheus (512 MiB), Alertmanager (128 MiB), Node Exporter and Blackbox Exporter (64 MiB each), about 150 MiB of working set together; the host watchdog is a one-minute systemd timer with no resident memory. Since 1 December 2026 both backends run backend-rs (256 MiB limits, under 10 MiB used); 3.0 GiB was available after that deploy.

Since 29 November 2026 the warehouse-, payment- and notification-services and the Ollama mock run their Rust ports: together they use about 20–40 MiB under load instead of about 430 MiB, and the mock's limit dropped from 512 MiB to 64 MiB. On 1 December 2026 the consumer (64 MiB limit) followed, and llm-service, aitesters-llm-service, delivery-service and aitesters-delivery-service joined with 64 MiB limits each (a few MiB to about 10 MiB used). The history below describes the Java images they replaced.

This release adds two more 160 MiB containers, payment-service and aitesters-payment-service (GraalVM native images with -Xmx64m, like the warehouse-services, which measure 58 to 66 MiB each). Their limits add 320 MiB to the overcommitted total; the expected working set is about 120 to 140 MiB, which leaves roughly 2.6 GiB available. Measure MemAvailable and the payment-services' working sets after the first deploy and record them in docs-site/docs/reference/CONTAINER_RELEASES.md; if available memory drops below 1.5 GiB, lower a limit (docker stats --no-stream shows which) before adding further services.

The distributed-lab release adds two more 160 MiB containers, notification-service and aitesters-notification-service (GraalVM native, -Xmx64m; 57 MiB measured on the lightweight profile, 14 November 2026). The long-running limits now add up to 5,664 MiB (about 5.5 GiB): +320 MiB over the 5,344 MiB before it. The expected extra working set is about 120 MiB, which leaves roughly 2.4 GiB available. Measure MemAvailable and both notification-services' working sets after the first deploy and record them in docs-site/docs/reference/CONTAINER_RELEASES.md.

Documentation wiki image

The docs service (the MkDocs wiki at /docs/, mem_limit: 32m) is the only image built on the server. The app role mirrors docs/ and docs-site/ and runs docker compose build docs in prepare.yml, before any service is stopped (docker compose up then runs with build: never); the image is static files on the digest-pinned nginx:1.31.3-trixie base (shared with the gateway), so no registry release or digest pin is needed for documentation edits (awesome-localstack/docs:local, pull_policy: build, exempt from verify-image-pins.py like other :local builds). The build needs outbound access to PyPI and jsDelivr. verify checks http://docs/docs/ from the gateway container and /docs/ on both hosts.