2.0 KiB
description, paths
| description | paths | |||||||
|---|---|---|---|---|---|---|---|---|
| os.getenv + dotenv config, NIKE_ prefix, systemd + docker, fresh-env build order |
|
Config & deployment
-
Config is
os.getenv+python-dotenv, NOT pydantic-settings.config.pyloads.envfrom the repo root (path-anchored, so it works regardless of CWD) and readsNIKE_*vars into module constants. A new setting = a newos.getenv("NIKE_...", default)plus a line in.env.example. Do not add aSettingsmodel. -
Every env var uses the
NIKE_prefix (red_panda_standards.md). DB config is individual parts (NIKE_DB_HOST/PORT/USER/PASSWORD/NAME) — never a singleDATABASE_URL.SERVER_HOST/SERVER_PORThave no default and will raise if unset (deliberate — a missing port should fail loudly, not bind somewhere random). -
.envis gitignored; only.env.exampleis tracked. Never commit real secrets. Keep.env.examplein sync with theNIKE_*varsconfig.pyreads. -
NIKE_TRUSTED_PROXYgatesX-Forwarded-*trust.'*'is safe only because Nike's port is firewalled to HAProxy; keep that constraint in mind if the topology changes. -
Fresh-environment build order:
pip install -e .→scripts/apply_schema.py(provision the PG cache fromschema.sql) →cd dashboard && npm install && npm run build→python run.py. The dashboard build is a hard prerequisite for serving/. Any change to this flow must keep the fresh path working. -
Deploy is systemd (
nike.service) with a Docker option (Dockerfile+docker-compose.yml). Note the checked-innike.servicehas a staleWorkingDirectory/ExecStart(/home/robert/gitea/nike) — flag it if you touch the unit; the repo lives at~/git/nike. Per the estate venv convention the runtime venv is~/env/nike. -
run.pyis the entry point (python run.py→nike.server:main→ uvicorn). Keep it a thin shim.