name: headscale

networks:
  headscale-net:
    driver: bridge
  pangolin:
    external: true

services:
  headscale:
    image: headscale/headscale:0.26.0
    container_name: headscale
    restart: unless-stopped
    command: serve
    labels:
      me.tale.headplane.target: headscale
    networks:
      - headscale-net
      - pangolin
    ports:
      - "8084:8080"
    volumes:
      - /mnt/docker-ssd/docker/compose/headscale/config/headscale/config.yaml:/etc/headscale/config.yaml
      - /mnt/docker-ssd/docker/compose/headscale/config/headscale/policy.hujson:/etc/headscale/policy.hujson
      - /mnt/docker-ssd/docker/appdata/headscale:/var/lib/headscale
      - /mnt/docker-ssd/docker/appdata/headscale/run:/var/run/headscale
    healthcheck:
      test: ["CMD", "headscale", "version"]
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 30s

  headplane:
    image: ghcr.io/tale/headplane:latest
    container_name: headplane
    restart: unless-stopped
    depends_on:
      - headscale
    networks:
      - headscale-net
      - pangolin
    ports:
      - "3005:3000"
    volumes:
      - /mnt/docker-ssd/docker/compose/headscale/config/headplane/config.yaml:/etc/headplane/config.yaml
      - /mnt/docker-ssd/docker/compose/headscale/config/headscale/config.yaml:/etc/headscale/config.yaml
      - /mnt/docker-ssd/docker/appdata/headplane:/var/lib/headplane
      - /var/run/docker.sock:/var/run/docker.sock:ro
    healthcheck:
      test: ["CMD", "/bin/hp_healthcheck"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s
