# documentation: https://github.com/wg-easy/wg-easy
# slogan: The easiest way to run WireGuard VPN + Web-based Admin UI.
# category: vps
# tags: wireguard,vpn,web,admin
# logo: svgs/wireguard.svg
# port: 8000

services:
  wg-easy:
    image: ghcr.io/wg-easy/wg-easy:latest
    environment:
      - SERVICE_URL_WIREGUARDEASY_51821
      - WG_HOST=${SERVICE_URL_WIREGUARDEASY}
      - LANG=${LANG:-en}
      - WG_PORT=51820
      - _PASSWORD=${SERVICE_PASSWORD_ADMIN}
    volumes:
      - wg-easy:/etc/wireguard
    ports:
      - 51820:51820/udp
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    sysctls:
      - net.ipv4.conf.all.src_valid_mark=1
      - net.ipv4.ip_forward=1
    entrypoint:
      - /bin/bash
      - -c
      - |
        eval "wgpw '${SERVICE_PASSWORD_ADMIN}' > /pass-hash"
        eval "$(cat /pass-hash) dumb-init node server.js"
