Add container, Compose and Kubernetes deployment with Litestream backup #26

Merged
piers merged 2 commits from feat/svd-dev-peoplemind-mcp-9-containerfile-compose-and-kusto-145ae343 into main 2026-11-01 20:48:03 +00:00
Collaborator

Build a non-root image with pinned Python bases and the verified embedding model. Add Compose services, a namespace-agnostic Kubernetes base, example configuration and Secrets, Litestream backup configuration, deployment tests and Make targets. Replace the provisional README quick start.

Validation: make check passed with 252 passed, 5 skipped and 4 integration tests deselected. Six filtered deployment checks passed. Python wheel/sdist builds, YAML syntax checks and diff hygiene passed.

Closes #9
Co-Authored-By: gpt-6.1-sol noreply@openai.com

Build a non-root image with pinned Python bases and the verified embedding model. Add Compose services, a namespace-agnostic Kubernetes base, example configuration and Secrets, Litestream backup configuration, deployment tests and Make targets. Replace the provisional README quick start. Validation: make check passed with 252 passed, 5 skipped and 4 integration tests deselected. Six filtered deployment checks passed. Python wheel/sdist builds, YAML syntax checks and diff hygiene passed. Closes #9 Co-Authored-By: gpt-6.1-sol <noreply@openai.com>
Build a non-root image with pinned Python bases and the verified embedding model. Add Compose services, a namespace-agnostic Kubernetes base, example configuration and Secrets, Litestream backup configuration, deployment tests and Make targets. Replace the provisional README quick start.

Validation: make check passed with 252 passed, 5 skipped and 4 integration tests deselected. Six filtered deployment checks passed. Python wheel/sdist builds, YAML syntax checks and diff hygiene passed.

Closes #9
Co-Authored-By: gpt-6.1-sol <noreply@openai.com>
Podman mounts a tmpfs over /run, so the image's /run/secrets/peoplemind
is absent at runtime and `ls -A` on it failed the scan. Only list a
directory that exists; any that does must still be empty.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Owner

Architect verification (host, scratch worktree at 9751559, 2026-11-02)

Verified on a scratch worktree with podman 5.8.7 (podman machine, applehv, rootless). The repo has no CI, so these are the host checks ruled at the #9 gate (Agent Adjustment 10).

Check Result
uv run python3 -m pytest -m "not integration" 252 passed, 5 skipped (Radicale, model), 4 deselected
uv run mypy clean, 32 source files
uv run ruff check . / ruff format --check . clean, 41 files
uv lock --check unchanged, 107 packages
kustomize build deploy/k8s/overlays/example 5 objects (ConfigMap, Service, 2 PVC, Deployment); no Secret; no secret values in the ConfigMap
make image RUNTIME=podman localhost/peoplemind-mcp:dev c2cc45d8; runs as uid 1000; model files in the image match the pinned hashes (6c9c6101…dfb5e7, d241a60d…9e5c66), 34014426 and 711396 bytes, read-only
make test-integration RUNTIME=podman 4 integration tests passed after one test fix (below); compose stack came up as uid 501, /healthz and /healthz/sync green, Litestream file-replica restore passed peoplemind check with persons=4; podman events confirm sync, api, backup, the restore and check one-shots, and a clean down -v

One fix pushed to this branch (ce6dfe2): test_image_runs_non_root_without_credentials ran ls -A /run/secrets/peoplemind in the bare image. Podman mounts a tmpfs over /run, so the directory the Containerfile creates is absent at runtime and the scan failed with exit 2. The test now lists only directories that exist; any that does must still be empty. Same intent, no change to the image. All 10 deployment tests pass with it.

Host note: podman compose needs a compose provider on PATH (docker-compose or podman-compose); this host had neither, so the run used the Nix store docker-compose 5.5.1. The compose fixture errored at up -d until then. Not a PR defect.

Review against the 13 gate rulings: all met. Python digests match the pasted amd64 and arm64 values; uid/gid 1000; compose runs as PEOPLEMIND_UID/GID with no chown; upstream litestream/litestream:0.3.13 with depends_on: [sync] and S3 creds as env; deploy/litestream.example.yml in the explicit form, file replica default, mounted at /etc/litestream.yml; prepare init container per role (api: read-token only; sync: everything else; backup: LITESTREAM_* env); no compose.mailmind.yaml; README documents -p mailmind, port 8420 and the alias; test-only --once; no secret values anywhere. Accepted deviations: .dockerignore keeps !src/** and !scripts/; restore validated through the backup container then api check.

Nits, none blocking (follow-up candidates):

  1. Compose backup mounts the config and secrets directories it does not need (read-only); the k8s side is per role already.
  2. The example overlay defaults to an S3 replica while the base still claims the 1Gi peoplemind-replica PVC.
  3. Containerfile mkdir -p /run/secrets/peoplemind is inert under podman (tmpfs /run); harmless.
  4. README says "Verification of this connection is at the #10 gate", an internal reference.
  5. README could say that podman compose needs a compose provider installed.

Rootless uid mapping on Linux podman and the mailmind leg are #10 gate evidence, not covered here. Ready for the operator merge.

## Architect verification (host, scratch worktree at 9751559, 2026-11-02) Verified on a scratch worktree with podman 5.8.7 (podman machine, applehv, rootless). The repo has no CI, so these are the host checks ruled at the #9 gate (Agent Adjustment 10). | Check | Result | |---|---| | `uv run python3 -m pytest -m "not integration"` | 252 passed, 5 skipped (Radicale, model), 4 deselected | | `uv run mypy` | clean, 32 source files | | `uv run ruff check .` / `ruff format --check .` | clean, 41 files | | `uv lock --check` | unchanged, 107 packages | | `kustomize build deploy/k8s/overlays/example` | 5 objects (ConfigMap, Service, 2 PVC, Deployment); no Secret; no secret values in the ConfigMap | | `make image RUNTIME=podman` | `localhost/peoplemind-mcp:dev` c2cc45d8; runs as uid 1000; model files in the image match the pinned hashes (`6c9c6101…dfb5e7`, `d241a60d…9e5c66`), 34014426 and 711396 bytes, read-only | | `make test-integration RUNTIME=podman` | 4 integration tests passed after one test fix (below); compose stack came up as uid 501, `/healthz` and `/healthz/sync` green, Litestream file-replica restore passed `peoplemind check` with `persons=4`; podman events confirm sync, api, backup, the restore and check one-shots, and a clean `down -v` | **One fix pushed to this branch (ce6dfe2):** `test_image_runs_non_root_without_credentials` ran `ls -A /run/secrets/peoplemind` in the bare image. Podman mounts a tmpfs over `/run`, so the directory the Containerfile creates is absent at runtime and the scan failed with exit 2. The test now lists only directories that exist; any that does must still be empty. Same intent, no change to the image. All 10 deployment tests pass with it. **Host note:** `podman compose` needs a compose provider on PATH (`docker-compose` or `podman-compose`); this host had neither, so the run used the Nix store docker-compose 5.5.1. The compose fixture errored at `up -d` until then. Not a PR defect. **Review against the 13 gate rulings:** all met. Python digests match the pasted amd64 and arm64 values; uid/gid 1000; compose runs as `PEOPLEMIND_UID`/`GID` with no chown; upstream `litestream/litestream:0.3.13` with `depends_on: [sync]` and S3 creds as env; `deploy/litestream.example.yml` in the explicit form, file replica default, mounted at `/etc/litestream.yml`; prepare init container per role (api: read-token only; sync: everything else; backup: `LITESTREAM_*` env); no `compose.mailmind.yaml`; README documents `-p mailmind`, port 8420 and the alias; test-only `--once`; no secret values anywhere. Accepted deviations: `.dockerignore` keeps `!src/**` and `!scripts/`; restore validated through the backup container then `api check`. **Nits, none blocking (follow-up candidates):** 1. Compose `backup` mounts the config and secrets directories it does not need (read-only); the k8s side is per role already. 2. The example overlay defaults to an S3 replica while the base still claims the 1Gi `peoplemind-replica` PVC. 3. Containerfile `mkdir -p /run/secrets/peoplemind` is inert under podman (tmpfs `/run`); harmless. 4. README says "Verification of this connection is at the #10 gate", an internal reference. 5. README could say that `podman compose` needs a compose provider installed. Rootless uid mapping on Linux podman and the mailmind leg are #10 gate evidence, not covered here. Ready for the operator merge.
piers merged commit 1ffffcbe48 into main 2026-11-01 20:48:03 +00:00
Sign in to join this conversation.
No description provided.