# documentation: https://github.com/henrygd/beszel?tab=readme-ov-file#getting-started
# slogan: A lightweight server resource monitoring hub with historical data, docker stats, and alerts.
# category: monitoring
# tags: beszel,monitoring,server,stats,alerts
# logo: svgs/beszel.svg
# port: 8090

# When adding a System in the UI, the Host/IP must be beszel-agent (or the container name, ex: beszel-agent-pswog4s8wks4o8osw44cw0k8)
# Add the public Key in "Key" env variable and token in the "Token" variable below (These are obtained from Beszel UI)
services:
  beszel:
    image: 'henrygd/beszel:0.18.7' # Released on 6 April 2026
    environment:
      - SERVICE_URL_BESZEL_8090
      - CONTAINER_DETAILS=${CONTAINER_DETAILS:-true}
      - SHARE_ALL_SYSTEMS=${SHARE_ALL_SYSTEMS:-false}
    volumes:
      - 'beszel_data:/beszel_data'
      - 'beszel_socket:/beszel_socket'
    healthcheck:
      test: ['CMD', '/beszel', 'health', '--url', 'http://localhost:8090']
      interval: 30s
      timeout: 20s
      retries: 10
      start_period: 5s
  beszel-agent:
    image: 'henrygd/beszel-agent:0.18.7' # Released on 6 April 2026
    network_mode: host # Network stats graphs won't work if agent cannot access host system network stack
    environment:
      # Required
      - LISTEN=/beszel_socket/beszel.sock
      - HUB_URL=$SERVICE_URL_BESZEL
      - TOKEN=${TOKEN}            # From hub token settings
      - KEY=${KEY}                # SSH public key(s) from hub
      # Optional
      - DISABLE_SSH=${DISABLE_SSH:-false}        # Disable SSH
      - LOG_LEVEL=${LOG_LEVEL:-warn}              # Logging level
      - SKIP_GPU=${SKIP_GPU:-false}               # Skip GPU monitoring
      - SYSTEM_NAME=${SYSTEM_NAME}                # Custom system name
    volumes:
      - beszel_agent_data:/var/lib/beszel-agent
      - beszel_socket:/beszel_socket
      - '/var/run/docker.sock:/var/run/docker.sock:ro'
    healthcheck:
      test: ['CMD', '/agent', 'health']
      interval: 60s
      timeout: 20s
      retries: 10
      start_period: 5s
