Wave 1 of the Postgres migration (archie-core-7r0x.9). This is the shared shape every port lane builds on; nothing here switches a live path to Postgres yet. - config: add `database_url` beside `db_path` (config.go), mark it bootstrap-only in denied_keys, expose it in the webui StorageView/config schema, and add it to config.example.toml plus all deployments/*.toml. - docker-compose: add a postgres:18 service; `task dev` (dev:postgres) brings it up and waits for it before the State Store boots. - archied: `openStateStore` now opens and migrates the process-scoped Postgres pool via `openStateStorePool`. The State Store fails closed (D1.2) when database_url is absent or invalid rather than fall back to SQLite; serving against Postgres later requires an import-completion record (D1.3), which is a later lane's gate, not this one. - composition seam: task-store construction (state_store_task.go) and EDA-store construction (state_store_eda.go) are extracted from openStateStore, with the pool open in state_store_pool.go. This is a behaviour-preserving refactor only — no store, interface, error, ordering or logging change — so L1 and L2 build against separate files instead of sharing state_store.go. Tests: fail-closed pool behaviour is pinned (absent/invalid URL); the State Store boot/restart tests now run against a throwaway Postgres 18 container (pgtest TestMain). Scoped test command and module-wide build pass; see lane report.
95 lines
3.8 KiB
YAML
95 lines
3.8 KiB
YAML
# Optional external NATS, plus the agent image the daemon spawns per task.
|
|
#
|
|
# archied itself runs on the host under systemd, not here -- its chat tools
|
|
# operate on host files, which a container cannot reach. See
|
|
# deployments/systemd-user-service.md.
|
|
#
|
|
# Embedded NATS is the normal deployment and needs no Compose service.
|
|
# External broker: docker compose up -d nats
|
|
# Build worker: docker compose build agent
|
|
# Stop external: docker compose down
|
|
# Logs: journalctl --user -u archied -f (the daemon)
|
|
# docker compose logs -f nats (the bus)
|
|
|
|
services:
|
|
# ── PostgreSQL (State Store) ───────────────────────────────────
|
|
# The standalone archie-state-store process's database. PostgreSQL 18 is
|
|
# the required minimum and target; `postgres.Open` refuses anything older.
|
|
# `task dev` brings this up before the State Store via dev:postgres. The
|
|
# credentials and database name below are the dev default mirrored by
|
|
# deployments/dev.toml's database_url -- change both together.
|
|
postgres:
|
|
image: postgres:18
|
|
environment:
|
|
POSTGRES_USER: archie
|
|
POSTGRES_PASSWORD: archie
|
|
POSTGRES_DB: archie
|
|
# postgres:18 moved its default PGDATA under a versioned path; pin the
|
|
# classic location so the named volume keeps working across image updates.
|
|
PGDATA: /var/lib/postgresql/data/pgdata
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- pg_data:/var/lib/postgresql/data
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U archie -d archie"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# ── NATS JetStream ────────────────────────────────────────────────
|
|
nats:
|
|
image: nats:2.14-alpine3.22
|
|
command: -js -m 8222
|
|
ports:
|
|
- "4222:4222" # client
|
|
- "8222:8222" # monitoring (http://localhost:8222)
|
|
volumes:
|
|
- nats_data:/data
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:8222/healthz"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# ── agent image (built once, spawned per task by the daemon) ───────
|
|
# Not a long-running service: the daemon starts agent containers itself
|
|
# via the Docker socket. This stanza exists only so the image can be
|
|
# built locally.
|
|
#
|
|
# The build profile keeps `up -d` from starting it. Without it compose
|
|
# creates a container that exits 0 immediately and still reports
|
|
# "Started", which reads like a crash loop. Naming the service explicitly
|
|
# still works without activating the profile:
|
|
#
|
|
# docker compose build agent (also: task docker-build)
|
|
# docker compose pull agent -- plain `pull` skips profiled services
|
|
#
|
|
# Routine freshness is handled by the daemon, which pulls this image per
|
|
# task: see containers.pull_policy in the config. Watchtower cannot do it
|
|
# -- it only restarts long-running containers, and this is not one.
|
|
agent:
|
|
profiles: ["build"]
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
# Pinned to a verified digest -- archie-agent has no published semver
|
|
# tag yet (CI only pushes :latest). See
|
|
# deployments/systemd-user-service.md#pinning-the-archie-agent-image.
|
|
image: ghcr.io/samcharles93/archie-agent@sha256:870f1b1357979cfea23fccacb24166ebeb9ab321708ef2c2b218a763ed99b090
|
|
|
|
volumes:
|
|
nats_data:
|
|
pg_data:
|
|
|
|
# The subnet is pinned for the optional external-broker profile because its
|
|
# configured URL must be reachable from both the native daemon and workers.
|
|
# Embedded mode discovers its selected bridge gateway at startup instead.
|
|
networks:
|
|
default:
|
|
ipam:
|
|
config:
|
|
- subnet: 172.19.0.0/16
|