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.
63 lines
3.0 KiB
TOML
63 lines
3.0 KiB
TOML
# Development overlay for `task dev` and `task dev:dashboard`.
|
|
#
|
|
# Match Vite's API/event proxy without changing the installed configuration.
|
|
# The dashboard on :8484 is the
|
|
# archie-ui process's listener, not archied's; this overlay is what both
|
|
# `go run ./cmd/archied -config-overlay deployments/dev.toml` and
|
|
# `go run ./cmd/archie-ui -config-overlay deployments/dev.toml` read. Only
|
|
# [web], [services.*] and [capture] land in archie-ui; the daemon ignores
|
|
# [web] entirely.
|
|
|
|
# `task dev` runs archie-state-store against this overlay, and the State Store
|
|
# fails closed without a PostgreSQL URL. These must reach the `postgres`
|
|
# service in docker-compose.yml, which `task dev` brings up first via
|
|
# dev:postgres -- keep them and that service in agreement. dev:postgres also
|
|
# provisions the two roles: the services serve as archie_runtime and migrate
|
|
# as archie_migrator, while the Compose-created archie role is only the
|
|
# admin that created them.
|
|
bot_user = "archie-dev"
|
|
|
|
database_url = "postgres://archie_runtime:archie@127.0.0.1:5432/archie?sslmode=disable"
|
|
migration_database_url = "postgres://archie_migrator:archie@127.0.0.1:5432/archie?sslmode=disable"
|
|
|
|
[web]
|
|
listen = "127.0.0.1:8484"
|
|
|
|
# `task dev` runs archie-state-store via dev:state-store, which passes no
|
|
# -listen, so the listen below is the port the store binds. It must agree with
|
|
# the target: these two lines are the only place that pair is stated. Move them
|
|
# when a port is already taken on the host -- before the
|
|
# listen key existed the collision could only be worked around by hand-writing
|
|
# a matching target and passing -listen, and it read as a code fault.
|
|
#
|
|
# Task containers dial the target over the Docker bridge gateway, so the store
|
|
# listens on every interface and [tls] (issued by `task dev:tls`) is required.
|
|
[services.state]
|
|
target = "172.17.0.1:9091"
|
|
listen = "0.0.0.0:9091"
|
|
|
|
[tls]
|
|
ca_file = "tmp/dev-tls/ca.pem"
|
|
cert_dir = "tmp/dev-tls"
|
|
|
|
# `task dev` runs archie-gateway via dev:gateway, which also passes no -listen:
|
|
# the listen below is what it binds. Stated explicitly so the value archie-ui
|
|
# dials is visible next to the State Store one.
|
|
[services.gateway]
|
|
target = "127.0.0.1:8585"
|
|
listen = "127.0.0.1:8585"
|
|
[services.daemon]
|
|
target = "127.0.0.1:8587"
|
|
listen = "127.0.0.1:8587"
|
|
|
|
# Dry-run self-intake curator (#1770): surveys recent runs and reports
|
|
# candidate follow-up issues as pass summaries; declares no issue-creating
|
|
# tool, so it cannot file. Needs a chat model configured to run at all.
|
|
[[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 — concrete, each tied to the run that produced it. Do not create issues; this pass reports only (no issue-creating tool is declared, so it cannot). End your reply with the report.
|
|
"""
|