Profile picture

[Docker] Palworld exporter

JaehyoJJAng2024년 02월 02일

◾️ Palworld Exporter

Palworld 서버용 모니터링 도구


▪️ 사전 준비

1. 게임 서버 ∙ exporter / 그라파나 ∙ 프로메테우스 각 컨테이너들을 동일한 도커 네트워크에 소속시켜야 함.

그러기 위해 pal-net 이라는 도커 네트워크를 생성하여 docker-compose.yaml 작성 시, 각 컨테이너들을 해당 네트워크로 지정

docker network create pal-net

2. 작업 디렉토리 구조

tree -L 2 ~/palworld

/home/master/palworld
├── deleteBanUserData.sh
├── docker-compose.yaml
├── engine.txt
├── game
│   ├── ...
├── PalworldManager.sh
├── prometheus 
│   └── prometheus.yml # 프로메테우스 컨테이너용 설정 파일
├── restart.sh
├── shutdown_message.sh
└── shutdown.sh

7 directories, 14 files

▪️ 도커로 설치


• Docker Compose

~/palworld/docker-compose.yaml

version: "3.9"

services:
  palworld:
    image: thijsvanloef/palworld-server-docker:latest
    restart: always
    container_name: palworld-server
    stop_grace_period: 30s
    ports:
      - 5555:8211/udp
      - 27015:27015/udp
    environment:
      - PUID=1000
      - PGID=1000
      - PORT=8211
      - PLAYERS=10
      - SERVER_PASSWORD=""
      - MULTITHREADING=true
      - RCON_ENABLED=true
      - RCON_PORT=25575
      - TZ=Asia/Seoul
      - ADMIN_PASSWORD=ADMIN_PASSWORD
      - COMMUNITY=false
      - SERVER_NAME="Pal World"
      - SERVER_DESCRIPTION=""
    volumes:
      - ./game:/palworld/
    networks:
      - "pal-net"

  exporter:
    image: docker.io/bostrt/palworld-exporter:latest
    restart: unless-stopped
    container_name: exporter
    ports:
      - 9877:9877/tcp
    depends_on:
      - palworld
    environment:
      - RCON_HOST=palworld
      - RCON_PORT=25575
      - RCON_PASSWORD=ADMIN_PASSWORD
      - SAVE_DIRECTORY=/palworld
    volumes:
      - ./game:/palworld/:z,ro
    networks:
      - "pal-net"

networks:
  pal-net:
    name: pal-net
    external: true

그라파나와 프로메테우스용 docker-compose.yaml 작성

~/grafana/docker-compose.yaml

version: "3.9"

services:
  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    ports:
      - "9090:9090"
    volumes:
      - ./prometheus:/etc/prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
    networks:
      - pal-net

  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    volumes:
      - type: volume
        source: "grafana"
        target: "/var/lib/grafana"
    ports:
      - "3000:3000"
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin
    networks:
      - pal-net

volumes:
  grafana: {}

networks:
  pal-net:
    name: pal-net
    external: true

• prometheus.yml

~/grafana/prometheus/prometheus.yaml

global:
  scrape_interval: 15s

scrape_configs:
  - job_name: "palworld"
    static_configs:
      - targets: ["exporter:9877"] # exporter 컨테이너명 지정

▪️ 컨테이너 실행

~/palworld/docker-compose.yaml

docker-compose up -d --build

~/grafana/docker-compose.yaml

docker-compose up -d --build

▪️ dashboard

image


Loading script...