Files
archie/config.example.toml
T
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

116 lines
3.9 KiB
TOML

# archie configuration
#
# This file starts the services. Everything else (forge connections, models,
# providers, chat, tools, containers, repositories, policies) is edited in the
# dashboard, and a saved value there overrides the same setting here.
#
# Secrets are never written here: each is a {engine, key} reference. The
# built-in "env" engine reads key as an environment variable.
# The URL the services connect as: a least-privilege role, created by
# `archie-state-store provision`. migration_database_url is the role that owns
# the schema and runs migrations; when it is absent, database_url does both,
# which is what a single-role install does.
# database_url = "postgres://archie_runtime:secret@localhost:5432/archie?sslmode=disable"
# migration_database_url = "postgres://archie_migrator:secret@localhost:5432/archie?sslmode=disable"
# work_dir = "~/.local/share/archie/work"
# state_dir = "~/.local/share/archie"
poll_interval = "60s"
label = "archie"
bot_user = "vectis-labs-archie"
[forge]
type = "github"
host = "https://github.com"
token = { engine = "env", key = "ARCHIE_GITHUB_TOKEN" }
[dispatch]
trigger = "assignee" # "assignee", "label" or "either"
ack_reaction = "eyes" # "off" for none
[models]
triage = "openai/gpt-5.4"
planner = "openai/gpt-5.4"
builder = "openai/gpt-5.4"
[providers.ollama]
class = "ollama"
[budgets]
max_steps = 60
wall_clock = "30m" # one agent call
gate_max_failures = 5
task_wall_clock = "4h" # a whole task run
[health]
listen = "127.0.0.1:8485"
# dependency_timeout = "5s"
# Trace export. Without an endpoint nothing is exported.
# [telemetry]
# endpoint = "127.0.0.1:4317" # OTLP/gRPC collector
# insecure = false # plaintext to the collector
# ca_file = "" # PEM bundle verifying the collector
# sample_ratio = 1.0 # share of new traces recorded
# headers = { authorization = "Bearer ..." }
[web]
listen = "127.0.0.1:8484" # "off" disables the dashboard
# trust_forwarded_headers = false # only behind a proxy you control
[services.gateway]
target = "127.0.0.1:8585"
# listen = "127.0.0.1:8585"
[services.state]
target = "127.0.0.1:9090"
# listen = "127.0.0.1:9090"
# [tls]
# ca_file = "/etc/archie/tls/ca.pem"
# cert_dir = "/etc/archie/tls"
# [nats]
# mode = "embedded" # or "external" with url
# url = "nats://localhost:4222"
# token_env = "NATS_TOKEN"
# [log]
# file = "~/.local/share/archie/logs/archied.log"
# level = "info"
# [bindings]
# encryption_key = { engine = "env", key = "ARCHIE_BINDING_KEY" }
# Access records: how long a recorded access denial is kept before the State
# Store's sweep deletes it. Zero means 90 days.
# [access]
# denial_retention = "2160h"
# Where releases and the extension catalogue come from on a new instance: an
# OCI repository and the base64 ed25519 key it signs with. Blank is the
# official source. Once stored, change them in the dashboard settings.
# [distribution]
# releases = "registry.example/owner/archie"
# releases_key = "base64 public key"
# catalogue = "registry.example/owner/archipelago/catalogue"
# catalogue_key = "base64 public key"
# Long-running agent loops that maintain memory, skills and — in dry run —
# file follow-up issues from recent runs. Definitions are data: the server
# validates them and the gateway applies them live.
# [[curators]]
# name = "self-intake"
# interval = "1h"
# tools = ["run_list", "run_events", "issue_list"]
# instructions = """
# You are archie's self-intake curator, in dry run. Each pass: list recent
# task runs with run_list, inspect anything parked or failed with run_events,
# check issue_list for each repo so nothing already open is repeated, then
# report candidate follow-up issues, each tied to the run that produced it.
# Do not create issues.
# """
# To let it file: add "issue_create" to tools and tell it to file each
# candidate (citing the run) instead of only reporting it.