build(dev,chat): point dev server at archie and wire chat pages catalogue

This commit is contained in:
sam committed 2026-11-25 23:05:04 +11:00
1 parent 74a560533e
commit 56dbb31923
6 files changed
+118 -61

No files matched your search

+74 -27
View File
@@ -136,7 +136,11 @@ tasks:
- go run ./cmd/archied prbench {{.CLI_ARGS}}
dev:
desc: Run development services and Vite at http://localhost:5173
desc: Run archie (with live reload) and Vite at http://localhost:5173
deps: [dev:archie, dev:ui]
dev:legacy:
desc: Run the legacy multi-service stack and Vite at http://localhost:5173
deps: [dev:daemon, dev:gateway, dev:messaging, dev:state-store, dev:dashboard, dev:ui]
dev:tls:
@@ -175,13 +179,36 @@ tasks:
exit 1
- |
# docker-compose.yml creates the dev database with a superuser named
# archie; provision the least-privilege roles deployments/dev.toml
# points at. Idempotent, so this also upgrades a volume created before
# the role split.
go run ./cmd/archie-state-store provision \
-admin-url "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable" \
-runtime-url "postgres://archie_runtime:archie@127.0.0.1:5432/archie?sslmode=disable" \
-migration-url "postgres://archie_migrator:archie@127.0.0.1:5432/archie?sslmode=disable"
# archie; provision the least-privilege runtime and migrator roles
# idempotently without depending on the legacy state-store binary.
# Single-binary archie uses its own database (archie_dev) so its goose
# migration history does not collide with the legacy archie database.
docker compose exec -T postgres psql -v ON_ERROR_STOP=1 -U archie -d postgres <<'SQL'
DO $$
BEGIN
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'archie_migrator') THEN
CREATE ROLE archie_migrator LOGIN PASSWORD 'archie';
ELSE
ALTER ROLE archie_migrator WITH LOGIN PASSWORD 'archie';
END IF;
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'archie_runtime') THEN
CREATE ROLE archie_runtime LOGIN PASSWORD 'archie';
ELSE
ALTER ROLE archie_runtime WITH LOGIN PASSWORD 'archie';
END IF;
END
$$;
SELECT 'CREATE DATABASE archie_dev OWNER archie_migrator'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'archie_dev')\gexec
GRANT CREATE, CONNECT ON DATABASE archie TO archie_migrator;
GRANT CONNECT ON DATABASE archie TO archie_runtime;
GRANT CREATE, CONNECT ON DATABASE archie_dev TO archie_migrator;
GRANT CONNECT ON DATABASE archie_dev TO archie_runtime;
SQL
docker compose exec -T postgres psql -v ON_ERROR_STOP=1 -U archie -d archie \
-c "GRANT CREATE, USAGE ON SCHEMA public TO archie_migrator; GRANT USAGE ON SCHEMA public TO archie_runtime;"
docker compose exec -T postgres psql -v ON_ERROR_STOP=1 -U archie -d archie_dev \
-c "GRANT CREATE, USAGE ON SCHEMA public TO archie_migrator; GRANT USAGE ON SCHEMA public TO archie_runtime;"
dev:wait-state:
internal: true
@@ -195,78 +222,93 @@ tasks:
exit 1
dev:daemon:
desc: Run archied with live reload
desc: Run legacy archied
cmds:
- task: dev:wait-state
- air -build.args_bin="-config-overlay,deployments/dev.toml"
- go run ./cmd/archied -config-overlay deployments/dev.toml
dev:dashboard:
desc: Run the dashboard backend
desc: Run the legacy dashboard backend
cmds:
- go run ./cmd/archie-ui -config-overlay deployments/dev.toml
dev:state-store:
desc: Run the State Store with development PostgreSQL
desc: Run the legacy State Store with development PostgreSQL
deps: [dev:postgres, dev:tls]
cmds:
- go run ./cmd/archie-state-store -config-overlay deployments/dev.toml
dev:gateway:
desc: Run the development Gateway
desc: Run the legacy development Gateway
cmds:
- task: dev:wait-state
- go run ./cmd/archie-gateway -config-overlay deployments/dev.toml
dev:messaging:
desc: Run the development Messaging Service
desc: Run the legacy development Messaging Service
cmds:
- task: dev:wait-state
- go run ./cmd/archie-messaging -config-overlay deployments/dev.toml
dev:archie:
desc: Run the single archie binary against the development PostgreSQL (admin token "dev")
desc: Run the single archie binary against the development PostgreSQL (admin token "dev", live reload via air if installed)
deps: [dev:postgres]
vars:
DIR: tmp/dev-archie
cmds:
- |
set -eu
mkdir -p {{.DIR}}
mkdir -p {{.DIR}}/state
# Generated once: the age identity seals the dev credentials, so keep
# it across runs. Roles come from dev:postgres.
if [ ! -f {{.DIR}}/config.toml ]; then
umask 077
install -m 0600 /dev/null {{.DIR}}/config.toml
{
echo 'listen = "127.0.0.1:8080"'
echo 'listen = "127.0.0.1:8484"'
echo 'state_dir = "{{.ROOT_DIR}}/{{.DIR}}/state"'
echo "admin_token_sha256 = \"$(printf dev | sha256sum | cut -d' ' -f1)\""
echo "age_identity = \"$(go run ./cmd/archie -new-age-identity)\""
echo "age_identity = \"$(go run -tags no_ui ./cmd/archie -new-age-identity)\""
echo '[database]'
echo 'url = "postgres://archie_runtime:archie@127.0.0.1:5432/archie?sslmode=disable"'
echo 'owner_url = "postgres://archie_migrator:archie@127.0.0.1:5432/archie?sslmode=disable"'
echo 'url = "postgres://archie_runtime:archie@127.0.0.1:5432/archie_dev?sslmode=disable"'
echo 'owner_url = "postgres://archie_migrator:archie@127.0.0.1:5432/archie_dev?sslmode=disable"'
} > {{.DIR}}/config.toml
elif ! grep -q '^state_dir' {{.DIR}}/config.toml; then
sed -i '1i state_dir = "{{.ROOT_DIR}}/{{.DIR}}/state"' {{.DIR}}/config.toml
fi
- go run ./cmd/archie -config {{.DIR}}/config.toml
- |
if command -v air >/dev/null 2>&1; then
exec air -build.args_bin="-config,{{.DIR}}/config.toml"
fi
exec go run -tags no_ui ./cmd/archie -config {{.DIR}}/config.toml
dev:ui:
desc: Run Vite (requires the dashboard backend)
desc: Run Vite (proxies API requests to 127.0.0.1:8484 by default; override with ARCHIE_DEV_API)
dir: ui
deps: [ui:deps]
cmds:
- pnpm install
- pnpm run dev
e2e:smoke:
desc: Run the single-binary smoke check against a disposable archie instance (defaults to dev:archie on 127.0.0.1:8484)
cmds:
- |
ARCHIE_SMOKE_URL="${ARCHIE_SMOKE_URL:-http://127.0.0.1:8484}" \
ARCHIE_SMOKE_TOKEN="${ARCHIE_SMOKE_TOKEN:-dev}" \
node e2e/archie-smoke.cjs
e2e:up:
desc: Start the local stack without Docker (PostgreSQL 18, services, Vite) and seed it
desc: Start the legacy local multi-service stack without Docker (PostgreSQL 18, services, Vite) and seed it
cmds:
- bash e2e/stack.sh start
- bash e2e/seed.sh
e2e:down:
desc: Stop the local e2e stack
desc: Stop the legacy local e2e stack
cmds:
- bash e2e/stack.sh stop
e2e:check:
desc: List browser checks; use -- all or -- CHECK to run, add --headed to watch
desc: List legacy browser checks; use -- all or -- CHECK to run, add --headed to watch
cmds:
- node e2e/run.cjs {{.CLI_ARGS}}
@@ -288,14 +330,19 @@ tasks:
- Taskfile.yml
- "**/*.go"
# Files the binaries embed.
- config.example.toml
- "internal/**/*.sql"
- "internal/**/*.yaml"
- "internal/**/*.json"
- "internal/**/*.tpl"
- "internal/**/*.tmpl"
- "internal/**/*.md"
- "modules/**/*.cedar"
- "modules/**/*.yaml"
- go.mod
- go.sum
- "ui/dist/**"
- ui/pages/pages.json
generates:
- "{{.BIN_DIR}}/archied"
- "{{.BIN_DIR}}/archie-gateway"