# RisingWave — Streaming Database (PostgreSQL-compatible)
# Usage: docker compose -p smart-city -f risingwave/docker-compose.yml up -d
# Ports: 4566=PostgreSQL, 4567=Web UI
services:
  risingwave:
    image: risingwavelabs/risingwave:latest
    container_name: smart-city-risingwave
    networks:
      - traefik-public
      - smartcity-shared
    ports:
      - "4566:4566"   # PostgreSQL protocol
      - "4567:4567"   # Web UI
    volumes:
      - risingwave-data:/risingwave/data
    command: >
      risingwave
      --listen-addr 0.0.0.0:4566
      --meta-addr 0.0.0.0:5690
      --metrics-addr 0.0.0.0:1250
    deploy:
      resources:
        limits:
          memory: 2G
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -h localhost -p 4566 -U root"]
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 30s
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.risingwave.rule=Host(`risingwave.digitribe.fr')"
      - "traefik.http.routers.risingwave.entrypoints=websecure"
      - "traefik.http.routers.risingwave.tls=true"
      - "traefik.http.services.risingwave.loadbalancer.server.port=4567"

networks:
  traefik-public:
    external: true
  smartcity-shared:
    external: true

volumes:
  risingwave-data:
