# Pulsar Manager - Web UI pour Apache Pulsar Standalone
# Accès: https://pulsar.digitribe.fr
services:
  pulsar-manager-db:
    image: postgres:15-alpine
    container_name: smart-city-pulsar-manager-db
    restart: unless-stopped
    environment:
      POSTGRES_USER: admin
      POSTGRES_PASSWORD: Digitribe972
      POSTGRES_DB: pulsar_manager
    volumes:
      - pulsar-manager-db-data:/var/lib/postgresql/data
    networks:
      - pulsar-manager-net
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U superset"]
      interval: 10s
      timeout: 5s
      retries: 5

  pulsar-manager:
    image: apachepulsar/pulsar-manager:v0.2.0
    container_name: smart-city-pulsar-manager
    restart: unless-stopped
    depends_on:
      pulsar-manager-db:
        condition: service_healthy
    environment:
      # Variables mappées par supervisord.conf custom
      REDIRECT_HOST: pulsar.digitribe.fr
      REDIRECT_PORT: "443"
      DRIVER_CLASS_NAME: org.postgresql.Driver
      URL: jdbc:postgresql://pulsar-manager-db:5432/pulsar_manager
      USERNAME: superset
      PASSWORD: Digitribe972
      INITIALIZATION_MODE: embedded
      LOG_LEVEL: INFO
    volumes:
      - ./config/supervisord-manager.conf:/etc/supervisord.conf:ro
      - ./config/application.properties:/pulsar-manager/application.properties:ro
    networks:
      - pulsar-manager-net
      - traefik-public
      - smartcity-shared
    ports:
      - "7750:7750"
    healthcheck:
      test: ["CMD-SHELL", "wget -qO- http://localhost:7750 || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 60s
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.pulsar-manager.rule=Host(`pulsar.digitribe.fr`)"
      - "traefik.http.routers.pulsar-manager.entrypoints=websecure"
      - "traefik.http.routers.pulsar-manager.tls=true"
      - "traefik.http.services.pulsar-manager.loadbalancer.server.port=7750"

networks:
  pulsar-manager-net:
    name: pulsar-manager-net
    driver: bridge
  traefik-public:
    external: true
  smartcity-shared:
    external: true

volumes:
  pulsar-manager-db-data:
