services:
  nginx-lb:
    image: nginx:latest
    ports:
      - "7443:7443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    depends_on:
      - FWD_server
    networks:
      - app-net
      
  locator:
    image: apachegeode/geode
    ports:
      - "10334:10334"
      - "7070:7070"
    command: bash -c "gfsh start locator --name=locator --force && tail -f locator/locator.log"
    networks:
      - app-net
    healthcheck:
      test: ["CMD", "gfsh", "-e", "connect --locator=localhost[10334]", "-e", "status locator --name=locator"]
      interval: 10s
      timeout: 10s
      retries: 5
      start_period: 10s 
  
  FWD_server:
    image: my-server-image
    ports:
      # Map host ports 3333-3343 to container port 3333
      - "3333-3343:3333"
      - "3433-3443:3433"
      - "2080-2090:2080"
      - "9010-9011:9010"  # Expose JMX port
      # Keep 7443 internal if you prefer, or expose it similarly
    expose:
      - "7443" # Not exposed to host, only to the internal network
    extra_hosts:
      - "host.docker.internal:host-gateway" 
    networks:
      - app-net
    depends_on:
      locator:
        condition: service_healthy

networks:
  app-net:
    driver: bridge