services:
  central-a:
    image: scadalink:latest
    container_name: scadalink-central-a
    environment:
      SCADALINK_CONFIG: Central
      ASPNETCORE_ENVIRONMENT: Development
      ASPNETCORE_URLS: "http://+:5000"
    ports:
      - "9001:5000"   # Web UI + Inbound API
      - "9011:8081"   # Akka remoting (host access for CLI/debugging)
    volumes:
      - ./central-node-a/appsettings.Central.json:/app/appsettings.Central.json:ro
      - ./central-node-a/logs:/app/logs
    networks:
      - scadalink-net
    restart: unless-stopped

  central-b:
    image: scadalink:latest
    container_name: scadalink-central-b
    environment:
      SCADALINK_CONFIG: Central
      ASPNETCORE_ENVIRONMENT: Development
      ASPNETCORE_URLS: "http://+:5000"
    ports:
      - "9002:5000"   # Web UI + Inbound API
      - "9012:8081"   # Akka remoting
    volumes:
      - ./central-node-b/appsettings.Central.json:/app/appsettings.Central.json:ro
      - ./central-node-b/logs:/app/logs
    networks:
      - scadalink-net
    restart: unless-stopped

  site-a-a:
    image: scadalink:latest
    container_name: scadalink-site-a-a
    environment:
      SCADALINK_CONFIG: Site
    ports:
      - "9021:8082"   # Akka remoting (host access for debugging)
      - "9023:8083"   # gRPC streaming
    volumes:
      - ./site-a-node-a/appsettings.Site.json:/app/appsettings.Site.json:ro
      - ./site-a-node-a/data:/app/data
      - ./site-a-node-a/logs:/app/logs
    networks:
      - scadalink-net
    restart: unless-stopped

  site-a-b:
    image: scadalink:latest
    container_name: scadalink-site-a-b
    environment:
      SCADALINK_CONFIG: Site
    ports:
      - "9022:8082"   # Akka remoting
      - "9024:8083"   # gRPC streaming
    volumes:
      - ./site-a-node-b/appsettings.Site.json:/app/appsettings.Site.json:ro
      - ./site-a-node-b/data:/app/data
      - ./site-a-node-b/logs:/app/logs
    networks:
      - scadalink-net
    restart: unless-stopped

  site-b-a:
    image: scadalink:latest
    container_name: scadalink-site-b-a
    environment:
      SCADALINK_CONFIG: Site
    ports:
      - "9031:8082"   # Akka remoting
      - "9033:8083"   # gRPC streaming
    volumes:
      - ./site-b-node-a/appsettings.Site.json:/app/appsettings.Site.json:ro
      - ./site-b-node-a/data:/app/data
      - ./site-b-node-a/logs:/app/logs
    networks:
      - scadalink-net
    restart: unless-stopped

  site-b-b:
    image: scadalink:latest
    container_name: scadalink-site-b-b
    environment:
      SCADALINK_CONFIG: Site
    ports:
      - "9032:8082"   # Akka remoting
      - "9034:8083"   # gRPC streaming
    volumes:
      - ./site-b-node-b/appsettings.Site.json:/app/appsettings.Site.json:ro
      - ./site-b-node-b/data:/app/data
      - ./site-b-node-b/logs:/app/logs
    networks:
      - scadalink-net
    restart: unless-stopped

  site-c-a:
    image: scadalink:latest
    container_name: scadalink-site-c-a
    environment:
      SCADALINK_CONFIG: Site
    ports:
      - "9041:8082"   # Akka remoting
      - "9043:8083"   # gRPC streaming
    volumes:
      - ./site-c-node-a/appsettings.Site.json:/app/appsettings.Site.json:ro
      - ./site-c-node-a/data:/app/data
      - ./site-c-node-a/logs:/app/logs
    networks:
      - scadalink-net
    restart: unless-stopped

  site-c-b:
    image: scadalink:latest
    container_name: scadalink-site-c-b
    environment:
      SCADALINK_CONFIG: Site
    ports:
      - "9042:8082"   # Akka remoting
      - "9044:8083"   # gRPC streaming
    volumes:
      - ./site-c-node-b/appsettings.Site.json:/app/appsettings.Site.json:ro
      - ./site-c-node-b/data:/app/data
      - ./site-c-node-b/logs:/app/logs
    networks:
      - scadalink-net
    restart: unless-stopped

  traefik:
    image: traefik:v3.4
    container_name: scadalink-traefik
    ports:
      - "9000:80"        # Central load-balanced entrypoint
      - "8180:8080"      # Traefik dashboard
    volumes:
      - ./traefik/traefik.yml:/etc/traefik/traefik.yml:ro
      - ./traefik/dynamic.yml:/etc/traefik/dynamic.yml:ro
    networks:
      - scadalink-net
    restart: unless-stopped

networks:
  scadalink-net:
    external: true
