services:
  opcua:
    image: mcr.microsoft.com/iotedge/opc-plc:latest
    container_name: scadalink-opcua
    ports:
      - "50000:50000"
      - "8080:8080"
    volumes:
      - ./opcua/nodes.json:/app/config/nodes.json:ro
    command: >
      --autoaccept
      --unsecuretransport
      --sph
      --sn=5 --sr=10 --st=uint
      --fn=5 --fr=1 --ft=uint
      --gn=5
      --nf=/app/config/nodes.json
      --pn=50000
    networks:
      - scadalink-net
    restart: unless-stopped

  opcua2:
    image: mcr.microsoft.com/iotedge/opc-plc:latest
    container_name: scadalink-opcua2
    ports:
      - "50010:50010"
      - "8081:8080"
    volumes:
      - ./opcua/nodes.json:/app/config/nodes.json:ro
    command: >
      --autoaccept
      --unsecuretransport
      --sph
      --sn=5 --sr=10 --st=uint
      --fn=5 --fr=1 --ft=uint
      --gn=5
      --nf=/app/config/nodes.json
      --pn=50010
    networks:
      - scadalink-net
    restart: unless-stopped

  ldap:
    image: glauth/glauth:latest
    container_name: scadalink-ldap
    ports:
      - "3893:3893"
    volumes:
      - ./glauth/config.toml:/app/config/config.cfg:ro
    networks:
      - scadalink-net
    restart: unless-stopped

  mssql:
    image: mcr.microsoft.com/mssql/server:2022-latest
    container_name: scadalink-mssql
    ports:
      - "1433:1433"
    environment:
      ACCEPT_EULA: "Y"
      MSSQL_SA_PASSWORD: "ScadaLink_Dev1#"
      MSSQL_PID: "Developer"
    volumes:
      - scadalink-mssql-data:/var/opt/mssql
      - ./mssql/setup.sql:/docker-entrypoint-initdb.d/setup.sql:ro
      - ./mssql/machinedata_seed.sql:/docker-entrypoint-initdb.d/machinedata_seed.sql:ro
    networks:
      - scadalink-net
    restart: unless-stopped

  smtp:
    image: axllent/mailpit:latest
    container_name: scadalink-smtp
    ports:
      - "1025:1025"
      - "8025:8025"
    environment:
      MP_SMTP_AUTH_ACCEPT_ANY: 1
      MP_SMTP_AUTH_ALLOW_INSECURE: 1
      MP_MAX_MESSAGES: 500
    networks:
      - scadalink-net
    restart: unless-stopped

  restapi:
    build: ./restapi
    container_name: scadalink-restapi
    ports:
      - "5200:5200"
    environment:
      API_NO_AUTH: 0
      PORT: 5200
    networks:
      - scadalink-net
    restart: unless-stopped

  playwright:
    image: mcr.microsoft.com/playwright:v1.58.2-noble
    container_name: scadalink-playwright
    ports:
      - "3000:3000"
    command: >
      npx -y playwright@1.58.2 run-server
      --host 0.0.0.0
      --port 3000
    ipc: host
    networks:
      - scadalink-net
    restart: unless-stopped

volumes:
  scadalink-mssql-data:

networks:
  scadalink-net:
    name: scadalink-net
    external: true
