############################################################################## # Clavex — minimal production-ready stack for self-hosting # # Usage: # curl -fsSL https://get.clavex.eu | sh # — or — # docker compose -f docker-compose.minimal.yml up -d # # Prerequisites: Docker Engine 24+ with the Compose v2 plugin. # # Secrets are loaded from .env (auto-generated by the installer script). # FGA support (OpenFGA) is available via: docker compose --profile fga up -d ############################################################################## services: # ── PostgreSQL ───────────────────────────────────────────────────────────── postgres: image: postgres:17-alpine restart: unless-stopped environment: POSTGRES_USER: clavex POSTGRES_PASSWORD: ${CLAVEX_DB_PASSWORD} POSTGRES_DB: clavex volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U clavex"] interval: 5s timeout: 3s retries: 10 # Not exposed externally — reachable only by Clavex inside the Docker network. # ── Redis ────────────────────────────────────────────────────────────────── redis: image: redis:7-alpine restart: unless-stopped command: ["redis-server", "--requirepass", "${CLAVEX_REDIS_PASSWORD}"] volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "-a", "${CLAVEX_REDIS_PASSWORD}", "ping"] interval: 5s timeout: 3s retries: 10 # ── OpenFGA (optional, enable with --profile fga) ───────────────────────── openfga: image: openfga/openfga:latest profiles: ["fga"] restart: unless-stopped depends_on: postgres: condition: service_healthy command: run --datastore-engine postgres --datastore-uri "postgres://clavex:${CLAVEX_DB_PASSWORD}@postgres:5432/clavex?sslmode=disable" healthcheck: test: ["CMD", "/usr/local/bin/openfga", "healthcheck"] interval: 10s timeout: 5s retries: 10 # ── Clavex ───────────────────────────────────────────────────────────────── clavex: image: ghcr.io/clavex-eu/clavex:3.0.1 restart: unless-stopped depends_on: postgres: condition: service_healthy redis: condition: service_healthy ports: - "${CLAVEX_HTTP_PORT:-8080}:8080" environment: CLAVEX_DEV: "false" CLAVEX_HTTP_ADDR: ":8080" CLAVEX_HTTP_BASE_DOMAIN: "${CLAVEX_BASE_DOMAIN:-localhost:8080}" CLAVEX_DATABASE_MODE: external CLAVEX_DATABASE_DSN: "postgres://clavex:${CLAVEX_DB_PASSWORD}@postgres:5432/clavex?sslmode=disable" CLAVEX_REDIS_ADDR: "redis:6379" CLAVEX_REDIS_PASSWORD: "${CLAVEX_REDIS_PASSWORD}" CLAVEX_AUTH_ISSUER_BASE: "${CLAVEX_ISSUER_BASE:-http://localhost:8080}" CLAVEX_AUTH_ADMIN_SECRET: "${CLAVEX_ADMIN_SECRET}" CLAVEX_AUTH_SIGNING_KEY_FILE: "/data/signing.pem" # FGA — uncomment after starting with --profile fga # CLAVEX_FGA_ENABLED: "true" # CLAVEX_FGA_ENDPOINT: "http://openfga:8080" volumes: - clavex_data:/data healthcheck: test: ["CMD", "wget", "-qO-", "http://localhost:8080/healthz"] interval: 10s timeout: 5s retries: 12 volumes: postgres_data: redis_data: clavex_data: