Skip to content

Commit c38d0c8

Browse files
GiniGini
authored andcommitted
Expose controlled container runtime config
1 parent 2b439aa commit c38d0c8

5 files changed

Lines changed: 23 additions & 2 deletions

File tree

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Reference: `plan/04-cloud-infrastructure.md`
6969

7070
- [ ] **P4-01** Add auth — feature-gated Better Auth + hashed email-OTP foundation, real delivery webhook, session middleware, login UI, expanded local cross-user route negative coverage, matching Postgres auth-handle wiring, and `npm run e2e:postgres-auth-http` authenticated Postgres owner-scope proof are implemented; keep open until production delivery, org-backed policy, and exhaustive authenticated Postgres route/deployment acceptance are complete
7171
- [ ] **P4-02** Migrate database — Drizzle/PostgreSQL schema contract, eight migrations, owner-bound conversation/task-lineage/provider-message/MCP-history/legacy-provenance tables, isolated async chat, metadata, operational, workspace, and project-revision repositories, owner-required importer, organization/member staging, cross-owner relationship validation, optimistic-conflict/restart proofs, MCP audit retention, lease fencing, native-event projection proofs, transaction-backed fork history, HTTP driver/read-boundary evidence, and an opt-in `TaskStore` runtime (`npm run e2e:postgres-taskstore`, `npm run e2e:postgres-http`) are now present; the real importer also round-trips workspace/project/native bytes and projection metadata; keep open until private attachment export policy/round trips, complete workflow idempotency/concurrency, cross-instance live SSE, and production migration/deployment controls are safe
72-
- [ ] **P4-03** Containerise — current non-root multi-stage `Dockerfile`, hardened SQLite-volume `docker-compose.yml`, `.env.example`, and a GitHub Actions build/non-root/read-only smoke gate are implemented; keep open until the P4-02 Postgres contract is wired into the image/Compose path rather than shipping an unused database service
72+
- [ ] **P4-03** Containerise — current non-root multi-stage `Dockerfile`, hardened Compose image, explicit operator-controlled Postgres/auth environment contract, `.env.example`, and a GitHub Actions build/non-root/read-only smoke gate are implemented; keep open until the Postgres migration/backup procedure, production secret delivery, and deployment rollout/rollback controls are exercised
7373

7474
P4-02 progress note: Postgres is now a controlled opt-in server driver with matching Better Auth handle wiring and authenticated owner-scope rejection. The proofs cover standalone messages, atomic native projections, transaction-backed fork history, workspace byte/version restore/compare/copy recovery, current project-file update/restart recovery, durable project revision restore, interrupted-task reconciliation, HTTP driver/read-boundary checks, and a real legacy import of workspace/project/native bytes plus projection metadata. Remaining blockers are private attachment export policy/round trips, complete workflow idempotency/concurrency, cross-instance live SSE, and production migration/deployment controls.
7575
- [ ] **P4-04** Deploy to Railway or Fly.io — `railway.toml` or `fly.toml`; deploy instructions in `plan/04-cloud-infrastructure.md#deploy`

docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,23 @@ services:
1010
ONEVIBE_API_HOST: 0.0.0.0
1111
ONEVIBE_API_PORT: 4311
1212
ONEVIBE_DATA_DIR: /var/lib/onevibe
13+
# SQLite remains the local default. Set both variables explicitly for
14+
# the reviewed Postgres runtime; the database is operator-managed and
15+
# migrations are never run implicitly by the application container.
16+
ONEVIBE_PERSISTENCE_DRIVER: ${ONEVIBE_PERSISTENCE_DRIVER:-sqlite}
17+
DATABASE_URL: ${DATABASE_URL:-}
1318
ONEVIBE_LITELLM_URL: ${ONEVIBE_LITELLM_URL:-}
1419
ONEVIBE_LITELLM_API_KEY: ${ONEVIBE_LITELLM_API_KEY:-}
1520
ONEVIBE_LITELLM_MODEL: ${ONEVIBE_LITELLM_MODEL:-claude-sonnet-5}
1621
ONEVIBE_DEFAULT_PROVIDER: ${ONEVIBE_DEFAULT_PROVIDER:-}
1722
ONEVIBE_WALLET_TOKEN: ${ONEVIBE_WALLET_TOKEN:-}
1823
ONEVIBE_RUNTIME_URL: ${ONEVIBE_RUNTIME_URL:-}
1924
ONEVIBE_RUNTIME_BEARER_TOKEN: ${ONEVIBE_RUNTIME_BEARER_TOKEN:-}
25+
ONEVIBE_AUTH_ENABLED: ${ONEVIBE_AUTH_ENABLED:-false}
26+
BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET:-}
27+
ONEVIBE_AUTH_OTP_WEBHOOK_URL: ${ONEVIBE_AUTH_OTP_WEBHOOK_URL:-}
28+
BETTER_AUTH_URL: ${BETTER_AUTH_URL:-}
29+
ONEVIBE_TRUSTED_ORIGINS: ${ONEVIBE_TRUSTED_ORIGINS:-}
2030
volumes:
2131
- onevibe-data:/var/lib/onevibe
2232
init: true

docs/ARCHITECTURE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ It does not claim VM isolation, egress enforcement, real wallet signatures, or c
5555

5656
`Dockerfile` and `docker-compose.yml` provide a local production-shaped image for the current API. The image builds the Vite SPA, runs the hand-rolled API as a non-root UID, exposes only port 4311, persists the current SQLite store on a named volume, and applies `read_only`, `no-new-privileges`, dropped Linux capabilities, and a bounded `/tmp` tmpfs in Compose. The image is not a sandbox for agent execution: provider tools remain governed by the selected `RuntimeAdapter`, and no container claim substitutes for ONEComputer microVM attestation or egress enforcement.
5757

58-
Compose remains SQLite-first for local convenience, while the server can explicitly select Postgres with `ONEVIBE_PERSISTENCE_DRIVER=postgres` and `DATABASE_URL`. The opt-in coordinator stores task workspace bytes, immutable snapshots, current project files, and project revisions in Postgres and hydrates the local filesystem as a materialized cache. Attachment/import/export byte round trips, workflow concurrency, cross-instance live SSE, and managed deployment operations remain open; do not treat the local Compose image as production Postgres or sandbox evidence.
58+
Compose remains SQLite-first for local convenience, while its operator-controlled environment contract can explicitly select Postgres with `ONEVIBE_PERSISTENCE_DRIVER=postgres` and `DATABASE_URL`, and can enable Better Auth with the reviewed secret/webhook variables. The application container never runs migrations implicitly; operators apply the reviewed ledger before rollout. The opt-in coordinator stores task workspace bytes, immutable snapshots, current project files, and project revisions in Postgres and hydrates the local filesystem as a materialized cache. Private attachment export policy/round trips, workflow concurrency, HTTP multi-instance SSE acceptance, production secret delivery, and managed deployment operations remain open; do not treat the local Compose image as production Postgres or sandbox evidence.
5959

6060
The GitHub Actions container gate builds this same image and starts it with an immutable root, bounded writable data/tmp mounts, dropped capabilities, and no-new-privileges. It verifies the health endpoint and non-root UID; this is a packaging/runtime contract, not evidence of cloud deployment or sandbox isolation.
6161

docs/IMPLEMENTATION-LOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Implementation log
22

3+
## 2026-07-17 — expose the controlled container runtime contract
4+
5+
- Added explicit Compose variables for `ONEVIBE_PERSISTENCE_DRIVER`, `DATABASE_URL`, Better Auth enablement/secret/webhook/base URL/trusted origins, while keeping SQLite as the default. The image does not auto-run migrations and does not create an implicit Postgres service.
6+
- This wires the already-proven runtime switch into the deployment surface without claiming that secret delivery, backups, rollout/rollback, production email, or sandbox isolation are solved.
7+
- Verification: `docker compose config` passes with the default SQLite contract; the full application checks remain the release gate.
8+
39
## 2026-07-17 — prove authenticated Postgres HTTP ownership
410

511
- Commit `c311bba` adds `npm run e2e:postgres-auth-http`, which starts the real server with `ONEVIBE_PERSISTENCE_DRIVER=postgres`, Better Auth email OTP, and the loopback delivery fixture. Two sessions are created through the actual OTP webhook contract; an authenticated owner creates a project/task, the second owner cannot enumerate or read them, and diagnostics reports the selected Postgres driver and readiness.

docs/LIVE-E2E-ENGINEERING-LOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
This is the durable failure-and-evidence log for the backend POC. It records observed facts and fixes so future agents do not repeat the same experiments.
44

5+
## 2026-07-17 — Compose contract check
6+
7+
- `docker compose config` passed with the default SQLite contract and showed the new operator-controlled Postgres/auth variables without any retained values.
8+
- `docker build --tag onevibe-ci:local .` was attempted but Docker Desktop timed out while fetching public `node:22-bookworm-slim` metadata from Docker Hub. No source compilation result was produced; the image build gate remains pending an available registry/network path.
9+
510
## 2026-07-17 — authenticated Postgres HTTP proof
611

712
- Commit `c311bba` started the actual API with `ONEVIBE_PERSISTENCE_DRIVER=postgres`, a disposable data root, Better Auth enabled, and a loopback OTP webhook. Two distinct users completed email OTP sign-in and received separate session cookies.

0 commit comments

Comments
 (0)