feat: implement Foundation V1 walking skeleton
CI / test (push) Successful in 7m31s

This commit is contained in:
m
2026-08-16 15:22:49 +03:00
commit 9b136621ef
205 changed files with 6345 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
# Portainer deployment target
Target: `https://docker.cin.su`.
The initial recommended stack file is `deploy/docker-compose.prod.yml`.
## Credential behavior for Codex
1. Try existing `PORTAINER_API_KEY` / endpoint metadata from the environment or an already configured secret store.
2. Do not print the key.
3. Do not scan unrelated repositories for plaintext passwords.
4. If no usable credential exists, ask the user for a Portainer API key (preferred) and endpoint ID if needed.
The exact Portainer API call used for automated stack creation must be verified against the Portainer version actually running before Codex implements automation. Until then deployment through Portainer's Git/stack UI is valid.
+95
View File
@@ -0,0 +1,95 @@
name: assistant-dev
services:
postgres:
image: postgres:18.6-alpine
environment:
POSTGRES_DB: assistant
POSTGRES_USER: assistant_bootstrap
POSTGRES_PASSWORD: ${POSTGRES_SUPERUSER_PASSWORD:-assistant_dev_only}
CONTINUITY_DB_PASSWORD: ${CONTINUITY_DB_PASSWORD:-assistant_continuity_dev_only}
IDENTITY_DB_PASSWORD: ${IDENTITY_DB_PASSWORD:-assistant_identity_dev_only}
AUTHORITY_DB_PASSWORD: ${AUTHORITY_DB_PASSWORD:-assistant_authority_dev_only}
SITUATION_DB_PASSWORD: ${SITUATION_DB_PASSWORD:-assistant_situation_dev_only}
WORK_DB_PASSWORD: ${WORK_DB_PASSWORD:-assistant_work_dev_only}
CAPABILITY_DB_PASSWORD: ${CAPABILITY_DB_PASSWORD:-assistant_capability_dev_only}
COMMIT_DB_PASSWORD: ${COMMIT_DB_PASSWORD:-assistant_commit_dev_only}
ports: ["15432:5432"]
volumes:
- assistant_pg_dev:/var/lib/postgresql
- ../database/bootstrap/001_roles_and_schemas.sql:/docker-entrypoint-initdb.d/001_roles_and_schemas.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U assistant_bootstrap -d assistant"]
interval: 5s
timeout: 3s
retries: 20
nats:
image: nats:2-alpine
command: ["-js", "-m", "8222"]
ports: ["14222:4222", "19222:8222"]
core-runtime:
build:
context: ..
dockerfile: deploy/images/runtime.Dockerfile
args: { TARGET: core-runtime }
environment:
LISTEN_ADDR: ":8080"
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DATABASE: assistant
POSTGRES_USER: situation_role
POSTGRES_PASSWORD: ${SITUATION_DB_PASSWORD:-assistant_situation_dev_only}
IDENTITY_POSTGRES_USER: identity_role
IDENTITY_POSTGRES_PASSWORD: ${IDENTITY_DB_PASSWORD:-assistant_identity_dev_only}
CREATOR_BOOTSTRAP_TOKEN: ${CREATOR_BOOTSTRAP_TOKEN:-creator_dev_only_replace_me}
CREATOR_SESSION_SIGNING_KEY: ${CREATOR_SESSION_SIGNING_KEY:-creator_dev_only_signing_key_32_bytes}
WORK_POSTGRES_USER: work_role
WORK_POSTGRES_PASSWORD: ${WORK_DB_PASSWORD:-assistant_work_dev_only}
CAPABILITY_POSTGRES_USER: capability_role
CAPABILITY_POSTGRES_PASSWORD: ${CAPABILITY_DB_PASSWORD:-assistant_capability_dev_only}
ports: ["19080:8080"]
depends_on:
postgres: { condition: service_healthy }
continuity-runtime:
build:
context: ..
dockerfile: deploy/images/runtime.Dockerfile
args: { TARGET: continuity-runtime }
environment:
LISTEN_ADDR: ":8081"
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DATABASE: assistant
POSTGRES_USER: continuity_role
POSTGRES_PASSWORD: ${CONTINUITY_DB_PASSWORD:-assistant_continuity_dev_only}
ports: ["19081:8081"]
commit-runtime:
build:
context: ..
dockerfile: deploy/images/runtime.Dockerfile
args: { TARGET: commit-runtime }
environment:
LISTEN_ADDR: ":8082"
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DATABASE: assistant
POSTGRES_USER: commit_role
POSTGRES_PASSWORD: ${COMMIT_DB_PASSWORD:-assistant_commit_dev_only}
AUTHORITY_POSTGRES_USER: authority_role
AUTHORITY_POSTGRES_PASSWORD: ${AUTHORITY_DB_PASSWORD:-assistant_authority_dev_only}
CORE_RUNTIME_URL: http://core-runtime:8080
ports: ["19082:8082"]
cognitive-worker:
build:
context: ..
dockerfile: deploy/images/runtime.Dockerfile
args: { TARGET: cognitive-worker }
environment: { LISTEN_ADDR: ":8083" }
ports: ["19083:8083"]
volumes:
assistant_pg_dev:
+86
View File
@@ -0,0 +1,86 @@
name: assistant
services:
postgres:
build:
context: ..
dockerfile: deploy/images/postgres.Dockerfile
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-assistant}
POSTGRES_USER: ${POSTGRES_SUPERUSER}
POSTGRES_PASSWORD: ${POSTGRES_SUPERUSER_PASSWORD}
CONTINUITY_DB_PASSWORD: ${CONTINUITY_DB_PASSWORD}
IDENTITY_DB_PASSWORD: ${IDENTITY_DB_PASSWORD}
AUTHORITY_DB_PASSWORD: ${AUTHORITY_DB_PASSWORD}
SITUATION_DB_PASSWORD: ${SITUATION_DB_PASSWORD}
WORK_DB_PASSWORD: ${WORK_DB_PASSWORD}
CAPABILITY_DB_PASSWORD: ${CAPABILITY_DB_PASSWORD}
COMMIT_DB_PASSWORD: ${COMMIT_DB_PASSWORD}
volumes:
- assistant_pg:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_SUPERUSER} -d ${POSTGRES_DB:-assistant}"]
interval: 10s
timeout: 5s
retries: 20
nats:
image: nats:2-alpine
restart: unless-stopped
command: ["-js", "-m", "8222"]
volumes: ["assistant_nats:/data"]
core-runtime:
build: { context: .., dockerfile: deploy/images/runtime.Dockerfile, args: { TARGET: core-runtime } }
restart: unless-stopped
environment:
LISTEN_ADDR: ":8080"
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DATABASE: ${POSTGRES_DB:-assistant}
POSTGRES_USER: situation_role
POSTGRES_PASSWORD: ${SITUATION_DB_PASSWORD}
IDENTITY_POSTGRES_USER: identity_role
IDENTITY_POSTGRES_PASSWORD: ${IDENTITY_DB_PASSWORD}
CREATOR_BOOTSTRAP_TOKEN: ${CREATOR_BOOTSTRAP_TOKEN}
CREATOR_SESSION_SIGNING_KEY: ${CREATOR_SESSION_SIGNING_KEY}
WORK_POSTGRES_USER: work_role
WORK_POSTGRES_PASSWORD: ${WORK_DB_PASSWORD}
CAPABILITY_POSTGRES_USER: capability_role
CAPABILITY_POSTGRES_PASSWORD: ${CAPABILITY_DB_PASSWORD}
depends_on: { postgres: { condition: service_healthy } }
continuity-runtime:
build: { context: .., dockerfile: deploy/images/runtime.Dockerfile, args: { TARGET: continuity-runtime } }
restart: unless-stopped
environment:
LISTEN_ADDR: ":8081"
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DATABASE: ${POSTGRES_DB:-assistant}
POSTGRES_USER: continuity_role
POSTGRES_PASSWORD: ${CONTINUITY_DB_PASSWORD}
commit-runtime:
build: { context: .., dockerfile: deploy/images/runtime.Dockerfile, args: { TARGET: commit-runtime } }
restart: unless-stopped
environment:
LISTEN_ADDR: ":8082"
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DATABASE: ${POSTGRES_DB:-assistant}
POSTGRES_USER: commit_role
POSTGRES_PASSWORD: ${COMMIT_DB_PASSWORD}
AUTHORITY_POSTGRES_USER: authority_role
AUTHORITY_POSTGRES_PASSWORD: ${AUTHORITY_DB_PASSWORD}
CORE_RUNTIME_URL: http://core-runtime:8080
# External mutation credentials belong here only via Portainer/Docker secrets/env injection.
cognitive-worker:
build: { context: .., dockerfile: deploy/images/runtime.Dockerfile, args: { TARGET: cognitive-worker } }
restart: unless-stopped
environment: { LISTEN_ADDR: ":8083" }
volumes:
assistant_pg:
assistant_nats:
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env sh
set -eu
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -v ON_ERROR_STOP=1 -v continuity_password="$CONTINUITY_DB_PASSWORD" <<'SQL'
ALTER ROLE continuity_role PASSWORD :'continuity_password';
SQL
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -v ON_ERROR_STOP=1 -v identity_password="$IDENTITY_DB_PASSWORD" <<'SQL'
ALTER ROLE identity_role PASSWORD :'identity_password';
SQL
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -v ON_ERROR_STOP=1 -v authority_password="$AUTHORITY_DB_PASSWORD" <<'SQL'
ALTER ROLE authority_role PASSWORD :'authority_password';
SQL
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -v ON_ERROR_STOP=1 -v situation_password="$SITUATION_DB_PASSWORD" <<'SQL'
ALTER ROLE situation_role PASSWORD :'situation_password';
SQL
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -v ON_ERROR_STOP=1 -v work_password="$WORK_DB_PASSWORD" <<'SQL'
ALTER ROLE work_role PASSWORD :'work_password';
SQL
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -v ON_ERROR_STOP=1 -v capability_password="$CAPABILITY_DB_PASSWORD" <<'SQL'
ALTER ROLE capability_role PASSWORD :'capability_password';
SQL
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -v ON_ERROR_STOP=1 -v commit_password="$COMMIT_DB_PASSWORD" <<'SQL'
ALTER ROLE commit_role PASSWORD :'commit_password';
SQL
+5
View File
@@ -0,0 +1,5 @@
FROM postgres:18.6-alpine
COPY database/bootstrap/001_roles_and_schemas.sql /docker-entrypoint-initdb.d/001_roles_and_schemas.sql
COPY deploy/images/002_owner_passwords.sh /docker-entrypoint-initdb.d/002_owner_passwords.sh
RUN chmod 0555 /docker-entrypoint-initdb.d/002_owner_passwords.sh
+13
View File
@@ -0,0 +1,13 @@
# syntax=docker/dockerfile:1
FROM golang:1.26.6-alpine AS build
WORKDIR /src
COPY go.mod ./
COPY . .
ARG TARGET
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/runtime ./cmd/${TARGET}
FROM alpine:3.23
RUN addgroup -S assistant && adduser -S -G assistant assistant
USER assistant
COPY --from=build /out/runtime /usr/local/bin/assistant-runtime
ENTRYPOINT ["/usr/local/bin/assistant-runtime"]