ReskSafety · Documentation

Deployment

What runs where, which environment variables matter, how to generate the secrets, and the checks to run before exposing the firewall.

  • Version 0.1.1
  • FastAPI + React
  • Python 3.11+
  • Apache-2.0

Services

ServicePortRole
backend8000FastAPI: firewall, auth, RBAC, policies, admin API
frontend3000React console (Vite build served by nginx)
dbinternalPostgreSQL 16 with a healthcheck; the backend waits for it

The Compose file builds both images locally. docker compose up -d backend db runs headless (API only) when you do not need the console.

Environment variables

VariableDefaultNotes
DATABASE_URLsqlite:///./resk.dbCompose uses PostgreSQL; SQLite is fine for a single node
JWT_SECRET_KEYrequiredSigning key; startup rejects the placeholder
CSRF_SECRETrequiredCSRF token signing; startup rejects the placeholder
PROVIDER_ENCRYPTION_KEYrequired in prodEncrypts provider API keys at rest
COOKIE_SECUREtrueKeep true behind HTTPS
LLM_BACKEND_TYPEopenaiopenai, deepseek, vllm, ollama, local, anthropic
LLM_BACKEND_URLhttps://api.deepseek.com/v1Base URL for OpenAI-compatible backends
LLM_BACKEND_API_KEYemptyDefault provider key; per-provider keys override it
ANTHROPIC_API_KEYemptyAccepted as an x-api-key credential on /v1/messages
CORS_ORIGINShttp://localhost:5173,…Comma-separated; tighten in production
LOG_PROMPTSfalseStore prompts (masked by ENV Match) in request logs
RATE_LIMIT_PER_MINUTE60Applied per route
RESK2_ENABLEDfalseEnable the resk2 semantic scanners
SECURITY_CONFIG_PATH./security.yamlScanning, logits and observability configuration
SEED_DEMO_DATAfalseKeep false: no fake users or statistics
ENV_MATCH_*enabledSee ENV Match

Secrets

openssl rand -hex 32                       # JWT_SECRET_KEY
openssl rand -hex 32                       # CSRF_SECRET
openssl rand -base64 32                    # PROVIDER_ENCRYPTION_KEY
openssl rand -hex 16                       # DB_PASSWORD

Compose refuses to start when JWT_SECRET_KEY, CSRF_SECRET or PROVIDER_ENCRYPTION_KEY is missing. Rotating PROVIDER_ENCRYPTION_KEY makes stored provider keys unreadable: re-enter them afterwards. Rotating JWT_SECRET_KEY invalidates every session.

Local development

cd backend
python -m venv .venv && . .venv/bin/activate
pip install -e .
cp .env.example .env          # then set the two secrets
uvicorn resk_app.main:app --reload --port 8000

The frontend runs with bun install && bun run dev in frontend/, proxying /api and /v1 to port 8000. ./start.sh automates both.

On first startup the schema is created and an admin/changeme account is seeded. Log in, change the password, then create roles and policies before pointing real traffic at the firewall.

TLS and reverse proxy

Production checklist

Backups and upgrades

docker compose exec db pg_dump -U resk resk > resk-$(date +%F).sql
docker compose pull && docker compose up -d --build

Schema changes are applied at startup by SQLAlchemy/Alembic-compatible migrations in this repository. Read the release notes before a major jump, and keep the previous image tag so you can roll back.