This repository has been archived on 2026-11-14. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
flamenet-files/docker-compose.yml
Paul HittandClaude Opus 5 7abe9c0ab2 Remove Flamenet Files, and delete accounts outright
Files was folded into the messenger, so this repository is the account
service and nothing else. The file server, its web client, its tenant
schemas and the documentation for all of it are gone.

Removed: EnclaveServer and its routes, EnclaveAccess, EnclaveCrypto, the
browser client under client/, the Files spec and vectors, the tenant SQL
under sql/, the web build and the node CI job, and the Leaf dependency
that only ever rendered the file server's pages. The Dockerfile built
EnclaveServer and shipped Public/ and Resources/; it now builds the
account service alone.

Nothing was lost. Every table in the production Files database was empty
when this was written: no nodes, no blobs, no identities, no tenants.
flamenetfiles.com, www.flamenetfiles.com and files.flamenet.io were
served by that stack and now answer 404; the compose file, the env and a
schema dump are on the box under /srv/prod/backups/, and the two docker
volumes were kept rather than pruned.

The service now issues pseudonyms for one product. `050_retire_files.sql`
deletes the `files` rows and replaces the CHECK constraint rather than
dropping it, so a container still being drained cannot write one back.
Every account had a `files` pseudonym and none had a `files` identity,
which is why there is no key material to migrate: the row was bookkeeping
for a product nobody enrolled in.

That also settles the delete endpoint added on this branch. It was built
around keeping a shared account alive while another product still held an
identity, and with one product that rule can never fire. `AccountRemoval`
and its five tests are gone, the response no longer reports which of two
outcomes happened, and a delete simply removes the account. None of it
had shipped, so there is no wire compatibility to keep.

Verified: the suites pass, the live delete script passes against a real
Postgres and a running service, and the image builds and boots to its
"DATABASE_URL is required" refusal, which is the account service and not
a file server.

`flamenet/files/auth/v1` stays as the authentication context string. It
is a wire constant baked into every stored verifier, not a product name,
and changing it would lock out every existing account. Said so in
ARCHITECTURE.md so nobody tidies it later.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 17:30:55 -04:00

88 lines
4.0 KiB
YAML

# Self-hosting Enclave.
#
# Note the two roles. `migrate` connects as the schema owner because installing
# policies, triggers and grants requires it. `app` connects as the per-tenant
# role, which is neither a superuser nor BYPASSRLS -- if it were, every
# row-level security policy would be silently ignored and no label would be
# enforced. The server checks this at boot and refuses to start rather than
# serve unlabelled data. See SELF-HOSTING.md.
services:
db:
image: postgres:18-alpine
environment:
POSTGRES_DB: enclave
POSTGRES_USER: enclave_owner
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
volumes:
# Postgres 18 expects a single mount at /var/lib/postgresql, NOT at
# /var/lib/postgresql/data as in 17 and earlier -- data then lives in a
# version-named subdirectory so `pg_upgrade --link` works across a mount
# boundary. Using the old path makes the container restart-loop on boot.
#
# Named explicitly: an anonymous volume shows up as "dangling" and gets
# destroyed by a routine `docker volume prune`. This one holds every file
# your users have.
- enclave-pgdata:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U enclave_owner -d enclave"]
interval: 5s
timeout: 5s
retries: 12
restart: unless-stopped
# Deliberately not published to the host. Reach it with `docker compose exec db psql`.
# The shared FlameNet account service. Its own container and its own database
# role, granted nothing outside enclave_accounts — so it cannot read a single
# file row, and the file server cannot read an account. The signed token is
# the entire interface between them.
accounts-migrate:
build: .
depends_on:
db:
condition: service_healthy
environment:
DATABASE_URL: postgres://enclave_owner:${POSTGRES_PASSWORD}@db:5432/enclave
ENCLAVE_JWT_SECRET: ${ENCLAVE_JWT_SECRET:?set ENCLAVE_JWT_SECRET in .env}
ENCLAVE_ACCOUNTS_SECRET: ${ENCLAVE_ACCOUNTS_SECRET:?set ENCLAVE_ACCOUNTS_SECRET in .env}
ENCLAVE_ACCOUNTS_DB_PASSWORD: ${ENCLAVE_ACCOUNTS_DB_PASSWORD:?set ENCLAVE_ACCOUNTS_DB_PASSWORD in .env}
command: ["./EnclaveAccounts", "migrate", "--yes"]
restart: "no"
accounts:
build: .
depends_on:
accounts-migrate:
condition: service_completed_successfully
environment:
DATABASE_URL: postgres://accounts_service:${ENCLAVE_ACCOUNTS_DB_PASSWORD}@db:5432/enclave
ENCLAVE_JWT_SECRET: ${ENCLAVE_JWT_SECRET}
ENCLAVE_ACCOUNTS_SECRET: ${ENCLAVE_ACCOUNTS_SECRET}
ENCLAVE_TENANT: ${ENCLAVE_TENANT:-default}
# Listed explicitly rather than reflected, so no other page can drive it.
ENCLAVE_ACCOUNTS_ALLOWED_ORIGINS: ${ENCLAVE_ACCOUNTS_ALLOWED_ORIGINS:-http://127.0.0.1:8080,http://localhost:8080}
# Registration is limited to three per address per hour by default, which
# is right for a deployment and wrong for a development machine where
# every test run creates accounts from one address. Raised here and only
# here; a real deployment should leave it alone, or raise it a little if
# its users share an office address.
ENCLAVE_SIGNUPS_PER_ADDRESS: ${ENCLAVE_SIGNUPS_PER_ADDRESS:-100}
# Same reasoning for sign-in attempts, and the same warning: every test
# run on this machine arrives from one address, and forty in five minutes
# is two runs. Only the *address* budget is raised. The per-handle one is
# left at its default on purpose, because it is the limiter that actually
# stops a password guess and a test suite that never meets it would not
# notice it breaking.
ENCLAVE_AUTH_ATTEMPTS_PER_ADDRESS: ${ENCLAVE_AUTH_ATTEMPTS_PER_ADDRESS:-400}
LOG_LEVEL: ${LOG_LEVEL:-info}
command: ["./EnclaveAccounts", "serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8100"]
ports:
- "${ENCLAVE_BIND:-127.0.0.1}:${ENCLAVE_ACCOUNTS_PORT:-8100}:8100"
restart: unless-stopped
volumes:
enclave-pgdata:
name: enclave-pgdata