athena_rs 3.3.0

Database gateway API
Documentation
services:
  athena-gateway:
    networks:
      - athena-net
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "5042:4052"
    env_file:
      - .env
    environment:
      RUST_LOG: "${RUST_LOG:-info}"
      ATHENA_PG_POOL_MIN_CONNECTIONS: "0"
      ATHENA_PG_POOL_ACQUIRE_TIMEOUT_SECS: "8"
      ATHENA_PG_POOL_IDLE_TIMEOUT_SECS: "120"
      ATHENA_PG_POOL_MAX_LIFETIME_SECS: "900"
      ATHENA_PG_POOL_TEST_BEFORE_ACQUIRE: "1"
      ATHENA_REALTIME_REGISTRY_PURGE_INTERVAL_SECS: "30"
      ATHENA_REALTIME_REGISTRY_INACTIVE_AFTER_SECS: "300"
      # Optional caching can point to Redis via ATHENA_REDIS_URL.
      # Local Postgres provisioned by this Compose stack.
      POSTGRES_ATHENA_LOGGING_URI: "postgres://athena:athena@postgres:5432/athena_logging"
    restart: unless-stopped
    depends_on:
      postgres:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "curl", "-sf", "http://localhost:4052/"]
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 15s

  athena-wss-gateway:
    networks:
      - athena-net
    build:
      context: ./apps/wss-gateway
      dockerfile: Dockerfile
    environment:
      ATHENA_API_BASE: http://athena-gateway:4052
      PORT: 7070
    depends_on:
      athena-gateway:
        condition: service_healthy
    ports:
      - "7070:7070"
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-sf", "http://localhost:7070/health"]
      interval: 15s
      timeout: 5s
      retries: 3
      start_period: 10s

  postgres:
    networks:
      - athena-net
    image: postgres:16-alpine
    ports:
      - "5433:5432"
    environment:
      POSTGRES_USER: athena
      POSTGRES_PASSWORD: athena
      POSTGRES_DB: athena_logging
    volumes:
      - postgres-data:/var/lib/postgresql/data
      - ./sql/provision.sql:/docker-entrypoint-initdb.d/01_provision.sql:ro
    restart: unless-stopped
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U athena -d athena_logging"]
      interval: 5s
      timeout: 3s
      retries: 10
      start_period: 5s
    

  redis:
    networks:
      - athena-net
    image: redis:8.2.4-alpine3.22
    ports:
      - "6379:6379"
    restart: unless-stopped
    volumes:
      - redis-data:/data
    command: ["redis-server", "--save", "", "--appendonly", "no"]

  sequin:
    profiles:
      - sequin
    image: sequin/sequin:latest
    pull_policy: always
    ports:
      - "7376:7376"
    environment:
      - PG_HOSTNAME=postgres
      - PG_DATABASE=sequin
      - PG_PORT=5432
      - PG_USERNAME=postgres
      - PG_PASSWORD=postgres
      - PG_POOL_SIZE=20
      # Un-comment for SSL
      # - PG_SSL=true
      - SECRET_KEY_BASE=wDPLYus0pvD6qJhKJICO4dauYPXfO/Yl782Zjtpew5qRBDp7CZvbWtQmY0eB13If
      - VAULT_KEY=2Sig69bIpuSm2kv0VQfDekET2qy8qUZGI8v3/h3ASiY=
      - REDIS_URL=redis://athena-redis:6379
      - CONFIG_FILE_PATH=/config/playground.yml
    volumes:
      - ./playground.yml:/config/playground.yml
    depends_on:
      sequin_redis:
        condition: service_started
      sequin_postgres:
        condition: service_healthy

  sequin_postgres:
    profiles:
      - sequin
    image: postgres:16
    ports:
      - "7377:5432"
    environment:
      - POSTGRES_DB=sequin
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    command: ["postgres", "-c", "wal_level=logical"]
    volumes:
      - sequin_postgres_data:/var/lib/postgresql/data
      # Creates a sample database for Sequin's Quickstart guide
      - ./postgres-init:/docker-entrypoint-initdb.d
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d sequin"]
      interval: 10s
      timeout: 2s
      retries: 5
      start_period: 2s
      start_interval: 1s

  sequin_redis:
    profiles:
      - sequin
    image: redis:7
    ports:
      - "7378:6379"
    command: ["redis-server", "--port", "6379"]
    volumes:
      - sequin_redis_data:/data

  prometheus:
    profiles:
      - sequin
    image: prom/prometheus
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
    ports:
      - "9090:9090"

  grafana:
    profiles:
      - sequin
    image: grafana/grafana
    ports:
      - "3000:3000"
    depends_on:
      - prometheus
    volumes:
      - grafana_data:/var/lib/grafana
      - ./grafana_datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml
      - ./grafana_dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml
      - ./dashboard.json:/etc/grafana/dashboards/dashboards/sequin.json

volumes:
  redis-data:
  postgres-data:
  sequin_postgres_data:
  sequin_redis_data:
  grafana_data:

networks:
  athena-net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.29.0.0/16