# Ostrakon community edition, self-hosted. Read README.md first. # # cp .env.example .env # then fill the three secrets # docker compose up -d # # The only configuration file is .env (see .env.example). Every API setting is an OSTRAKON_* # environment variable, so nothing is mounted for the API. name: ostrakon services: api: image: ghcr.io/ostrakon-app/api:${OSTRAKON_VERSION:-latest} restart: unless-stopped environment: OSTRAKON_DATABASE_HOST: postgres OSTRAKON_DATABASE_PORT: "5432" OSTRAKON_DATABASE_USER: ${OSTRAKON_DATABASE_USER:-ostrakon} OSTRAKON_DATABASE_DATABASE: ${OSTRAKON_DATABASE_DATABASE:-ostrakon} OSTRAKON_DATABASE_PASSWORD: ${OSTRAKON_DATABASE_PASSWORD:?OSTRAKON_DATABASE_PASSWORD is required, set it in .env (openssl rand -hex 24)} OSTRAKON_DATABASE_SSL_MODE: disable OSTRAKON_REDIS_HOST: redis OSTRAKON_REDIS_PORT: "6379" OSTRAKON_AUTH_JWT_SECRET: ${OSTRAKON_AUTH_JWT_SECRET:?OSTRAKON_AUTH_JWT_SECRET is required, set it in .env (openssl rand -base64 48)} OSTRAKON_AUTH_OSP_PEPPER: ${OSTRAKON_AUTH_OSP_PEPPER:?OSTRAKON_AUTH_OSP_PEPPER is required, set it in .env (openssl rand -base64 48)} # No OSTRAKON_EDITION on purpose: community is the API default. OSTRAKON_SIGNUP_ENABLED: ${OSTRAKON_SIGNUP_ENABLED:-true} OSTRAKON_COOKIE_SECURE: ${OSTRAKON_COOKIE_SECURE:-true} OSTRAKON_GEOIP_ENABLED: ${OSTRAKON_GEOIP_ENABLED:-false} OSTRAKON_GEOIP_DATABASE: /data/GeoLite2-City.mmdb OSTRAKON_LOG_LEVEL: ${OSTRAKON_LOG_LEVEL:-info} # Caddy is the only peer that reaches the API (the port is not published) and it # overwrites X-Forwarded-For with the real client IP. These are the private ranges # Docker allocates networks from. OSTRAKON_SERVER_TRUSTED_PROXIES: 172.16.0.0/12,192.168.0.0/16,10.0.0.0/8 volumes: # A directory, not a file: a missing file would be created as a directory by Docker. - ${OSTRAKON_GEOIP_DIR:-./geoip}:/data:ro healthcheck: # 127.0.0.1, not localhost: busybox wget tries ::1 first and the API listens on IPv4 only. test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:3000/health"] interval: 5s timeout: 5s retries: 10 start_period: 5s depends_on: postgres: condition: service_healthy redis: condition: service_healthy web: image: ghcr.io/ostrakon-app/web:${OSTRAKON_VERSION:-latest} restart: unless-stopped environment: # `:80` serves plain HTTP. A domain name turns on automatic HTTPS (README, mode b). SITE_ADDRESS: ${OSTRAKON_SITE_ADDRESS:-:80} # Peers allowed to set the client IP through X-Forwarded-For, empty = nobody. TRUSTED_PROXIES: ${OSTRAKON_TRUSTED_PROXIES:-} ports: - "${OSTRAKON_BIND_ADDRESS:-127.0.0.1}:${OSTRAKON_HTTP_PORT:-8080}:80" - "${OSTRAKON_BIND_ADDRESS:-127.0.0.1}:${OSTRAKON_HTTPS_PORT:-8443}:443" volumes: # The web image ships its own Caddyfile. This one has no Cloudflare or # fixed-domain specifics and reads the site address from the env. - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddy_data:/data - caddy_config:/config depends_on: api: condition: service_healthy postgres: # Keep in sync with docker/docker-compose.yml (the API tests run on the same image). image: timescale/timescaledb:2.24.0-pg16@sha256:5db0a2eb9cde672e5ea90336f72d220c016cc5046c61d88d284e7f0aa47ef7db restart: unless-stopped environment: POSTGRES_USER: ${OSTRAKON_DATABASE_USER:-ostrakon} POSTGRES_DB: ${OSTRAKON_DATABASE_DATABASE:-ostrakon} POSTGRES_PASSWORD: ${OSTRAKON_DATABASE_PASSWORD:?OSTRAKON_DATABASE_PASSWORD is required, set it in .env (openssl rand -hex 24)} volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] interval: 5s timeout: 5s retries: 10 start_period: 10s redis: image: redis:7-alpine restart: unless-stopped command: redis-server --appendonly yes volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 5s retries: 10 volumes: postgres_data: redis_data: caddy_data: caddy_config: