36 Commits
Author SHA1 Message Date
sam 3a965e2a4f feat(nats): an external broker defers logins to archie through auth callout (#1866)
Task containers log in with their run credential on an external broker and
reach only their own subjects, decided by the embedded broker's authenticator.
The broker token is never put in a container environment.
2026-11-14 04:04:15 +11:00
sam c54d328f0d feat(store): run services as a non-superuser role and name every connection (#1857)
Every service connected to PostgreSQL as the database owner, which is a
superuser, so anything that compromised an app process owned the cluster, and
every connection reached the server with an empty application_name, so
pg_stat_activity could not say which service a session belonged to.

Split the DB credential into two login roles and name every pool:

- archie_migrator owns public and its objects and runs goose. Migrations run
  on a short-lived pool opened from the new migration_database_url, before the
  serving pool opens. It is not a superuser.
- archie_runtime serves requests with SELECT, INSERT, UPDATE, DELETE, sequence
  USAGE/SELECT and function EXECUTE only. It has no CREATE privilege, so it
  cannot change the schema.
- Every pool sets application_name: archie-state-store, archie-gateway, and a
  -migrate / -recovery / -schema / -provision suffix on the transient
  administrative connections. Existing one-URL installs keep working: an
  absent migration_database_url falls back to database_url and the migration
  runs on the serving pool exactly as before.

Provisioning is a new idempotent `archie-state-store provision` subcommand: it
needs an admin URL the services never hold (database owner or superuser),
creates or reconciles both roles, hands every public-schema object to the
migration role, revokes PUBLIC's CREATE on public, sets row-level grants, and
sets the migration role's default privileges so tables future migrations
create are usable without a hand-run grant. It stores SCRAM verifiers, refuses
superuser roles, and verifies the boundary before committing.

install.sh now provisions the bundled path and separates the credentials: the
superuser password the Compose database is created with lives only in a
compose-only postgres.env, while the env file the units load holds the
non-superuser PGPASSWORD. A bundled install that predates the split is
upgraded in place: the roles are created, the superuser password is rotated
out of the env file, and config.toml is moved to the runtime and migration
URLs. External databases keep their operator-managed credential; the
deployments README documents the one-shot provision command.

setup writes both bundled URLs, dev:postgres provisions the dev database, the
e2e stack provisions its throwaway server, and the deployment templates point
at the two roles.
2026-11-11 03:12:54 +11:00
sam 9d8f364af1 feat(releaseupdate): signed OCI distribution sources for releases and the catalogue (#1715)
Quality / check (push) Successful in 5m53s
deploy / gate (push) Canceled after 0s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
2026-10-31 18:18:43 +11:00
sam 3b6de96782 docs(deploy): name the registry each agent-image path publishes to
The pinning section said CI republished ghcr.io on every push to main. CI
publishes git.catlow.cloud, and only for a release tag; ghcr is where the
hand-run tools/publish.sh writes, which is the reference the default names.

A release zip pins a digest on a registry an anonymous pull cannot reach, and
[containers].registry_auth -- the setting that fixes it -- was documented
nowhere. Documented there, beside the pin.

Also corrected: every shipped profile does not pin the image, and the section
link omitted its number so it matched no heading.
2026-10-31 00:35:49 +11:00
sam c86b8659e5 build: stamp the agent image with the checkout's version
The container build was the one build path that could not learn a version: the
build context excludes .git, so it has to be passed in, and nothing passed one
-- Compose handed the Dockerfile no build args, so every locally built agent
answered "dev" while the daemon reported the tag. The Taskfile now derives the
version from git describe once, for both the host binaries and the image, and
task image:agent passes it through.

docker compose build agent also failed outright: the service named the image by
digest, and Compose refuses to tag a digest. The build-only service names it by
tag now; what a task container runs is still pinned in the daemon's own
[containers] image.
2026-10-25 20:24:27 +11:00
sam 127e5e70a0 build(taskfile): drop unused tasks and share the dev State Store wait 2026-10-17 17:21:10 +11:00
sam 2090c41960 fix(ops): external NATS needs a token and publishes monitoring on loopback only
Issue: archie-core-ov11
2026-10-13 16:09:23 +11:00
sam ab9db7cfe3 feat(install): bundled PostgreSQL has no network and is reached by Unix socket; print an AppArmor profile instead of disabling the userns restriction 2026-10-06 03:04:12 +11:00
sam 17b6fa7245 fix(setup): keep the generated database password out of config.toml 2026-10-06 01:55:37 +11:00
sam 7892c927ce feat(setup): one guided flow; ask for PostgreSQL and generate the bundled database's password 2026-10-06 01:49:34 +11:00
sam d82651222a refactor(examples): the firewall workflow moves to archipelago 2026-10-04 03:10:23 +11:00
sam 0d35e753b5 refactor: format markdown files using prettier, fix spelling concerns, reduce Taskfile bloat 2026-09-25 01:10:28 +10:00
sam 21f333a13e fix(controlplane): stored container policies replace file profiles; add profile image and workflow examples
A stored container-runtime-policies document that carries Profiles now
replaces the file's profiles instead of merging into them, so a profile
deleted in the dashboard stays deleted; one stored before profiles existed
still inherits the file's. Profiles drop their json tags so the stored
document keys them like its other fields.

Adds examples/profiles/Dockerfile.agent-net (agent image plus network
lookup tools) with a build-only agent-net compose service,
examples/workflows/firewall-investigate.yaml with a test that parses every
example against the registered step vocabulary, and names the postgres
service in the compose header.
2026-09-24 20:58:08 +10:00
sam feeaa16c7b feat(postgres): wire the State Store to Postgres — DB URL, fail-closed pool, composition seam
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.
2026-09-24 02:18:56 +10:00
sam 2d8a610bab fix(deploy): pin archie-agent image away from :latest (#751)
ghcr.io/samcharles93/archie-agent:latest is re-published on every main
push that touches the runtime's package closure, so a bare :latest
reference can change under a running deployment with no warning and no
way to reproduce a prior build.

archie-agent has no published semver tag yet -- CI (deploy.yml) only
ever pushes :latest to GHCR, confirmed via the GHCR package API. Pin
docker-compose.yml and the GitHub deployment profiles to the verified
digest of :latest as of 2026-09-05
(sha256:870f1b1357979cfea23fccacb24166ebeb9ab321708ef2c2b218a763ed99b090),
and document the pinning strategy -- including the semver-tag-once-
published preference and digest pinning for production -- in
deployments/systemd-user-service.md. Update the generic
docker-nats-stack.toml example to demonstrate the same convention.

Ref archie-core-kllw (GitHub #670)
2026-09-05 22:19:05 +10:00
sam 972fb5b8e1 feat(deployment): default to managed NATS workers
Autonomous workflows now always hand a complete task to a scoped archie-agent container. Embedded NATS is the default and external NATS changes only broker placement; legacy agent and containers.enabled inputs decode for migration but cannot select an execution path. The daemon flushes task-event subscriptions before a worker can publish, and runtime updates snapshot and restore the configured worker image.
2026-08-24 14:56:57 +10:00
sam 8e8c22be61 fix: docker-compose corrected image path 2026-08-10 02:28:48 +10:00
sam 367b89e5ee chore(deploy): run archied on the host, keep NATS and agents in Docker
The chat agent's file tools operate on host paths, so the daemon has to
see the host filesystem. It keeps spawning agent containers through the
Docker socket and talking to NATS, so compose still carries the bus and
the network; archied and watchtower leave it.

Pins the network subnet: the daemon hands agent containers its own
nats.url verbatim, so that URL has to work from the host and from inside
a container. The gateway address does; a Docker-assigned subnet would
move it silently when the network is recreated.
2026-07-31 02:00:11 +10:00
sam fd1abdd6c8 fix(deploy): stop the agent stanza starting, and pull agent images
The agent service created a container that exited 0 immediately while
compose reported it as "Started", which reads like a crash loop. A build
profile keeps it out of `up -d`; naming it still works for build and pull.

containers.pull_policy was "if-not-present", which is not a recognised
value -- the pool pulls only when it is "always" or "missing", so the
typo disabled pulling outright and the deployed agent image drifted a day
behind the daemon. Watchtower cannot cover for it: agent containers are
spawned per task, and it only restarts long-running ones.
2026-07-31 01:51:19 +10:00
sam 3ee3bcf202 chore(deploy): commit the compose stack, drop the required overlay
docker-compose.yml was never committed -- it only existed on the
deployment host. It bind-mounted ./config.docker.toml and passed
-config-overlay unconditionally, which made an untracked repo-root
file load-bearing: Docker creates a directory when a bind source is
missing, and the loader rejects a directory, so a fresh clone took the
daemon down at boot.

The stack now passes a single -config pointing at a path outside the
repo. Nothing in the working tree is required at runtime. The
docker-specific values move to deployments/docker-nats-stack.toml as a
reference config, alongside the other deployment guides.

Also drops the ./:/workspace mount, which existed only for
desktop-commander's work_dir.
2026-07-31 01:13:23 +10:00
sam cbb7929ea6 fix: use msg.Reply instead of header for NATS reply-to 2026-07-30 16:13:51 +10:00
sam ec8534dfe2 feat(gateway): ship model controls, shell tools, and release tracking 2026-07-27 06:16:39 +10:00
sam bf0e348cbb fix: pass HEYARCHIE_TELEGRAM_BOT_TOKEN through to archied
The telegram chat gateway is enabled via chat.telegram.token_env in
config.toml, but compose never forwarded the named variable, so
cfg.Chat.Telegram.TokenEnv resolved to empty and archied exited 1.
Same class of bug as ARCHIE_GITEA_TOKEN_ARCHIE.
2026-07-27 04:51:10 +10:00
sam 52015c81b0 fix: pass ARCHIE_GITEA_TOKEN_ARCHIE through to archied container
The archied service only forwarded ARCHIE_GITEA_TOKEN, but config.toml
names ARCHIE_GITEA_TOKEN_ARCHIE for the archie identity. Recreating the
container via docker compose (rather than a manual docker run with an
explicit -e) silently dropped the token.
2026-07-27 04:31:43 +10:00
sam bb784297ae feat: fix webui task table and add merge-to-deploy automation
- webui: task rows referenced Go-style field names but store.Task
  JSON-marshals with lowercase tags, so every task row rendered blank
- add .gitea/workflows/deploy.yml: build+push archied and archie-agent
  images to the registry on merge to main
- docker-compose.yml: add a watchtower service so carina picks up new
  images and restarts the daemons without needing CI to SSH in
2026-07-24 17:22:19 +10:00
sam d80401d595 feat: add config overlay and shared RPC/Yaegi packages
- Introduce `-config-overlay` flag and `config.LoadOverlay()` to merge a base config with an overlay file, only overriding fields the overlay sets. This enables docker-compose to mount the base config from the host and apply only deployment-specific overrides.
- Create `internal/natsrpc` package with reusable NATS request/reply primitives (Envelope, Client, Call, RegisterAll, Respond). Migrate storerpc, worktreerpc, and forgerpc to use it, eliminating duplicated marshal/unmarshal and error handling.
- Create `internal/yaegiutil` package with shared interpreter construction (stdlib + extra symbols), generic export resolution (Resolve), and panic recovery (Safe). Migrate all Yaegi-based surfaces (gate scripts, daemon plugins, skill plugins, workflow stages, skill scripts) to use it, reducing boilerplate and centralizing panic safety.
- Simplify `config.docker.toml` to contain only overlay fields (paths, container config) and remove the duplicated repos list – the base config is now the single source of truth.
- Update docker-compose.yml to pass both -config and -config-overlay flags and mount the base config from the host.
- Add tests for LoadOverlay, DockerConfigOverlaysExampleConfig, Envelope, and yaegiutil utilities.
2026-07-24 12:57:10 +10:00
sam 8f8d0188b8 fix: host bind mounts for worktree to fix Docker container mount paths 2026-07-24 12:31:31 +10:00
sam 242762b2fb refactor: archie:* → agent:* labels, remove stale archie label 2026-07-24 12:09:38 +10:00
sam b8ac644acd fix: sync docker config with inprocess — DeepSeek, 100M, diff cap 0 2026-07-24 11:44:04 +10:00
sam deda2b3d58 fix: remove image tag from archied compose service to force local builds 2026-07-22 21:14:09 +10:00
sam 53376823d4 fix: push images to Gitea registry, reference in compose and config 2026-07-22 11:09:03 +10:00
sam 3490bd4124 fix: use pre-built golangci-lint binary, fix NATS healthcheck 2026-07-22 10:56:06 +10:00
sam cac64bcea6 fix: remove nonexistent runtime stage from agent build target 2026-07-22 10:36:28 +10:00
sam 209c653d15 fix: correct config mount path, add host.docker.internal for Linux, remove non-existent grace_period field 2026-07-22 10:17:28 +10:00
sam b79018ad7a fix: bump NATS image to 2.14-alpine3.22 2026-07-22 10:09:28 +10:00
sam 99b8d49c1e feat: add Docker Compose stack with NATS and agent containers 2026-07-22 09:46:54 +10:00