---
services:
  palworld:
    image: thijsvanloef/palworld-server-docker:latest
    restart: unless-stopped
    network_mode: service:watcher                   # This is important!
    container_name: palworld-server
    environment:
      PUID: 1000
      PGID: 1000
      PORT: 8211  # Optional but recommended
      PLAYERS: 16  # Optional but recommended
      SERVER_PASSWORD: "worldofpals"  # Optional but recommended
      MULTITHREADING: true
      RCON_ENABLED: true
      RCON_PORT: 25575
      TZ: "UTC"
      DISABLE_GENERATE_SETTINGS: true
      ADMIN_PASSWORD: "adminPasswordHere"
      COMMUNITY: false  # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD!
      SERVER_NAME: "palworld-server-docker by Thijs van Loef"
      SERVER_DESCRIPTION: "palworld-server-docker by Thijs van Loef"
      ALLOW_CONNECT_PLATFORM: "Steam" # Defaults to "Steam" if not set, set this to "Xbox" if you want to host a server for Xbox players. CROSSPLAY BETWEEN XBOX-STEAM IS NOT YET SUPPORTED
    volumes:
      - ./palworld:/palworld/

  watcher:
      image: dnwjn/palworld-server-watcher:latest
      container_name: palworld-watcher
      environment:
         - CONTAINER_NAME=palworld-server             # The name of the server container
         - GAME_PORT=8211                             # The same value as `PORT` in the server container
         - QUERY_PORT=27015                           # The same value as `QUERY_PORT` in the server container
         - LOOP_SLEEP_SECONDS=30                      # How often to check the server status
         - CONNECT_GRACE_SECONDS=60                   # After starting the server, how long to wait before continuing the loop
         - SHUTDOWN_DELAY_SECONDS=300                 # How long to wait after the last player leaves to shutdown the server
      ports:
        - 8211:8211/udp                               # The same value as `GAME_PORT`
      #   - 27015:27015/udp                           # Enable to show up in the server list
      volumes:
         - /var/run/docker.sock:/var/run/docker.sock  # This could be different depending on the operating system