Keep the engine's state in SQLite, not Postgres

One process owns this database — the image has run a single uvicorn
worker for that reason since the four-engines bug — so a file beside the
flows is the honest shape for it, and it is what lets `fluksio serve`
need no infrastructure at all. Live values, node execution and the work
queue never came here anyway; what does is a rollup a minute at a time,
a row per cascade and the run history, and WAL keeps the readers going
while that one writer works.

DATA_DIR is now the one setting that moves everything an installation
keeps; the rest derive from it and the images still spell theirs out.
The schema is prepared in-process at startup, so the prestart service is
gone, and the ten Postgres-only revisions collapse into one portable
baseline.

Three things only worked because psycopg was casting for us: a token's
subject arriving as a string where the column is a UUID, `greatest`, and
`date_bin`. The timestamps needed a column type of their own — SQLite
stores no offset, and a naive datetime read back either raises against an
aware `now` or serialises as local time.

Postgres stays in the stack only for Umami, behind the analytics profile.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-21 22:19:45 +02:00
co-authored by Claude Opus 5
parent f8abd91fc0
commit 73eeec29b1
51 changed files with 841 additions and 1089 deletions
+6 -9
View File
@@ -26,15 +26,15 @@ help: ## Show available targets
# ── Development (Docker) ──────────────────────────────────────────
dev-utils: ## Start only the utility containers (db, adminer, proxy, mailcatcher, prestart)
$(COMPOSE_DEV) up --build db adminer proxy mailcatcher prestart
dev-utils: ## Start only the utility containers (proxy, mailcatcher)
$(COMPOSE_DEV) up --build proxy mailcatcher
dev: ## Start the full dev stack (includes a local Traefik proxy)
$(COMPOSE_DEV) up --build
dev-local: ## Start the integrated local stack (called by the root `make dev`)
DOMAIN=$${DOMAIN:-localhost} ENVIRONMENT=$${ENVIRONMENT:-local} \
$(COMPOSE_LOCAL) up --build -d proxy db adminer prestart backend frontend mailcatcher
$(COMPOSE_LOCAL) up --build -d proxy backend frontend mailcatcher
up: ## Start the production stack
$(COMPOSE_PROD_RUN) up --build -d
@@ -121,13 +121,10 @@ seed-hosted-demo: ## Seed the hosted demo panel (operators only; API_URL select
test: test-backend test-frontend ## Run all tests (backend + frontend)
# The integrated stack publishes no host port for Postgres (docker/compose.local.yml
# drops them all), so the suite reaches the container on the compose network
# instead. Empty when the stack is down — then .env's localhost:5432 stands.
DB_HOST = $(shell docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}' fluksio-db 2>/dev/null | awk '{print $$1}')
test-backend: ## Run backend tests (pytest + coverage)
cd backend && $(if $(DB_HOST),POSTGRES_SERVER=$(DB_HOST)) uv run bash scripts/tests-start.sh
# Its own SQLite file in a temp directory (tests/__init__.py), so this needs
# nothing running and touches no development data.
cd backend && uv run bash scripts/test.sh
# The hostname the stack is served under. A checkout configured for a
# deployment carries the deployment's domain, and *.fluksio.com resolves to the