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>
3.0 KiB
Self-hosting the Flamenet account service
You probably do not need this.
A relay keeps its own accounts by default, and that is not a lesser mode: people register, message, exchange keys and verify the transparency log exactly as they would anywhere else. This service exists for one thing, a Flamenet credential that works across more than one relay, and running it only makes sense if you run more than one.
If you are hosting a relay, read docs/HOSTING.md in the relay repository
first. It explains the three shapes and which one you want.
What it needs
Postgres, and two secrets of at least 32 characters each.
cp .env.example .env
docker compose up -d
| Variable | |
|---|---|
POSTGRES_PASSWORD |
required |
ENCLAVE_JWT_SECRET |
required, 32+ characters. Signs session tokens. |
ENCLAVE_ACCOUNTS_SECRET |
required, 32+ characters. Derives pseudonyms and the decoy salts that stop handle enumeration. |
ENCLAVE_ACCOUNTS_DB_PASSWORD |
the login for the service's own restricted role |
ENCLAVE_ACCOUNTS_ALLOWED_ORIGINS |
only if a browser calls this service. The apps are not browsers. |
ENCLAVE_BIND |
defaults to 127.0.0.1. Leave it there and put a reverse proxy in front. |
ENCLAVE_ACCOUNTS_PORT |
defaults to 8100 |
docker-compose.yml runs the migrations in their own one-shot service before
the server starts, so a half-migrated database never serves traffic.
⛔ The two secrets you cannot change later
ENCLAVE_ACCOUNTS_SECRET derives every account's per-product pseudonym. Change
it and every existing account becomes a different person to every relay that
trusts you, orphaning their data with no way back. Set it once, back it up, and
treat losing it as losing the deployment.
ENCLAVE_JWT_SECRET has to match whatever verifies the tokens. A mismatch
looks like every session being rejected for no visible reason.
Prefer the asymmetric path: set ENCLAVE_JWT_PRIVATE_KEY to an Ed25519 seed
and relays verify through /.well-known/jwks.json instead. That is the
difference between a federation somebody else can join and one they cannot,
because the shared secret that checks a token is also the secret that mints
one.
Backups
One database, enclave-pgdata. There is no blob store and no per-tenant
schema; the whole service is a handful of small tables. pg_dump it.
A backup you have never restored is a belief, not a backup.
Upgrades
Migrations run automatically from the accounts-migrate service on each
docker compose up. They are append-only: Fluent records what it has run and
never runs it twice, so editing an applied migration works on a fresh database
and silently does nothing on yours.
The one that bit us
Production connects as accounts_service, a role whose search_path the schema
sets to enclave_accounts. Every table name in the models is unqualified and
relies on it. Connect as any other role and every query fails with
relation "accounts" does not exist, which reads like a broken migration and
is not.