chore: prod env checker, secret guidance, internet-exposure runbook

This commit is contained in:
Jonas Miederer 2026-09-14 21:39:06 +02:00
parent c3c4986979
commit 25cf645295
5 changed files with 219 additions and 4 deletions

View file

@ -126,15 +126,32 @@ Flow workflow: design in Langflow → export into `backend/flows/<name>.json`
(`--pull`, or UI download) → commit → the watcher deploys it automatically.
Deleting a file removes the flow including its runs (git keeps the JSON).
## Production (self-hosted, internal use — no TLS/reverse proxy included)
## Production (self-hosted — TLS/reverse proxy required, not included)
1. Check out the repo on the host, create `.env` from `.env.example` with
real secrets and `FRONTEND_MODE=preview`.
2. `docker compose up -d --build`.
3. Code updates via `git pull` + `docker compose restart api frontend`
real secrets (`openssl rand -hex 32`) and `FRONTEND_MODE=preview`.
2. Validate it: `uv run python scripts/check_prod.py --env ../.env`
(run from `backend/`; blocks on weak secrets or dev modes).
3. `docker compose up -d --build`.
4. Code updates via `git pull` + `docker compose restart api frontend`
(the checkout is bind-mounted); image rebuilds only for dependency
changes (`docker compose up -d --build`).
Internet exposure checklist (both forwarded ports sit behind your HTTPS
proxy — nothing here substitutes for it):
- Proxy: force HTTPS (+ HSTS), and put an extra login (basic-auth or
OIDC) in front of Langflow `:7860`. Langflow has a history of
critical unauthenticated RCEs — treat its UI as privileged tooling,
never share flows publicly ("Shareable Playground" = RCE risk).
- Secrets: all `*_KEY`/`*_TOKEN`/`*_PASSWORD` long and random; rotate
after any incident or staff change; re-run `check_prod.py`.
- Langflow/LFX upgrades (pinned in lockstep): bump `LANGFLOW_VERSION`
(`.env`), `Dockerfile.lfx` ARG, and backend `lfx~=` together, then
`lfx upgrade --upgrade-flow=safe` + `lfx validate --level 4` on
`backend/flows/*.json`. Check Langflow security advisories monthly.
- Backups: `backend/data/` (SQLite) and the `langflow-data` volume.
Container updates: registry images (`langflowai/langflow:latest`)
auto-update nightly via Watchtower (`nickfedor/watchtower`). Locally built
images (`api`, `lfx`, `frontend`) update with `docker compose build --pull`.