version: "3.9" # Turnstone with external Postgres DB. # Data lives in the named volume `turnstone_pgdata` — survives image rebuilds. # To adopt an EXISTING Postgres install, set DATABASE_URL to point at it and # remove the `db` service and `depends_on` blocks. # # Quick start: # docker compose up -d # # Then open http://localhost:8520 services: db: image: postgres:16-alpine restart: unless-stopped environment: POSTGRES_DB: turnstone POSTGRES_USER: turnstone POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-turnstone_dev} volumes: - turnstone_pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U turnstone -d turnstone"] interval: 5s timeout: 5s retries: 5 turnstone: build: . restart: unless-stopped ports: - "${TURNSTONE_PORT:-8520}:8520" depends_on: db: condition: service_healthy environment: # Backend selection — comment out DATABASE_URL to fall back to SQLite DATABASE_URL: postgresql://turnstone:${POSTGRES_PASSWORD:-turnstone_dev}@db:5432/turnstone TURNSTONE_TENANT_ID: ${TURNSTONE_TENANT_ID:-} TURNSTONE_API_KEY: ${TURNSTONE_API_KEY:-} TURNSTONE_GLEAN_INTERVAL: ${TURNSTONE_GLEAN_INTERVAL:-900} TURNSTONE_SOURCE_HOST: ${TURNSTONE_SOURCE_HOST:-} TURNSTONE_SUBMIT_ENDPOINT: ${TURNSTONE_SUBMIT_ENDPOINT:-} volumes: - ./patterns:/app/patterns:ro - ./data:/app/data # optional: persists SQLite files if DATABASE_URL unset volumes: turnstone_pgdata: name: turnstone_pgdata