name: pangolin
services:
  pangolin:
    image: fosrl/pangolin:1.10.3
    container_name: pangolin
    restart: unless-stopped
    labels:
      - diun.enable=true
    volumes:
      - ./config:/app/config
    healthcheck:
      test:
        - CMD
        - curl
        - -f
        - http://localhost:3001/api/v1/
      interval: 10s
      timeout: 10s
      retries: 15
  gerbil:
    image: fosrl/gerbil:1.2.1
    container_name: gerbil
    restart: unless-stopped
    labels:
      - diun.enable=true
    depends_on:
      pangolin:
        condition: service_healthy
    command:
      - --reachableAt=http://gerbil:3003
      - --generateAndSaveKeyTo=/var/config/key
      - --remoteConfig=http://pangolin:3001/api/v1/gerbil/get-config
      - --reportBandwidthTo=http://pangolin:3001/api/v1/gerbil/receive-bandwidth
    volumes:
      - ./config/:/var/config
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    ports:
      - 51820:51820/udp
      - 21820:21820/udp # port for ACCEPT_CLIENTS env variable
      - 443:443 # Port for traefik because of the network_mode
      - 80:80 # Port for traefik because of the network_mode
      - 2229:2229 # port for gitea, served from europa; git.ptrwd.com
      - 5432:5432 # port for postgres, served from io
  traefik:
    image: traefik:v3
    container_name: traefik
    restart: unless-stopped
    labels:
      - diun.enable=true
    network_mode: service:gerbil # Ports appear on the gerbil service
    depends_on:
      pangolin:
        condition: service_healthy
    command:
      - --configFile=/etc/traefik/traefik_config.yml
    volumes:
      - ./config/traefik:/etc/traefik:ro # Volume to store the Traefik configuration
      - ./config/letsencrypt:/letsencrypt # Volume to store the Let's Encrypt certificates
      - ./config/traefik/logs:/var/log/traefik # Volume to store Traefik logs
networks:
  default:
    driver: bridge
    name: pangolin
