2026-04-12 23:15:02 +02:00
|
|
|
services:
|
|
|
|
|
wg-easy:
|
2026-05-03 22:41:38 +02:00
|
|
|
image: ghcr.io/wg-easy/wg-easy:15.2.2 # Pinnato — aggiornare deliberatamente con compose pull
|
2026-04-12 23:15:02 +02:00
|
|
|
container_name: wg-easy
|
|
|
|
|
restart: unless-stopped
|
|
|
|
|
|
2026-05-03 22:41:38 +02:00
|
|
|
# --- Limiti risorse (SBC con 1 GB RAM) ---
|
|
|
|
|
# mem_limit = memswap_limit disabilita lo swap per il container:
|
|
|
|
|
# se supera 256 MB Docker lo riavvia pulito invece di mandare in OOM l'host.
|
|
|
|
|
mem_limit: "${WG_MEM_LIMIT:-256m}"
|
|
|
|
|
memswap_limit: "${WG_MEMSWAP_LIMIT:-256m}"
|
|
|
|
|
cpus: "${WG_CPUS:-1.0}"
|
|
|
|
|
|
|
|
|
|
# --- Rotazione log: evita che i log riempiano la SD card ---
|
|
|
|
|
logging:
|
|
|
|
|
driver: json-file
|
|
|
|
|
options:
|
|
|
|
|
max-size: "10m"
|
|
|
|
|
max-file: "3"
|
|
|
|
|
|
|
|
|
|
# --- Health check: riavvio automatico se Node.js si blocca ---
|
|
|
|
|
healthcheck:
|
|
|
|
|
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:51821/"]
|
|
|
|
|
interval: 60s
|
|
|
|
|
timeout: 10s
|
|
|
|
|
retries: 3
|
|
|
|
|
start_period: 30s
|
|
|
|
|
|
2026-04-12 23:15:02 +02:00
|
|
|
environment:
|
|
|
|
|
PASSWORD_HASH: "${PASSWORD_HASH}"
|
|
|
|
|
TZ: "${TZ}"
|
|
|
|
|
WG_HOST: "${WG_HOST}"
|
|
|
|
|
WG_DEFAULT_DNS: "${WG_DEFAULT_DNS:-1.1.1.1,8.8.8.8}"
|
|
|
|
|
|
|
|
|
|
# Chiavi e configurazione WireGuard persistite fuori dal container
|
|
|
|
|
volumes:
|
|
|
|
|
- ./wg-data:/etc/wireguard
|
|
|
|
|
|
2026-05-03 22:41:38 +02:00
|
|
|
# File temporanei in RAM invece che sulla SD card
|
|
|
|
|
tmpfs:
|
|
|
|
|
- /tmp:size=32m,mode=1777
|
|
|
|
|
|
2026-04-12 23:15:02 +02:00
|
|
|
ports:
|
2026-05-03 22:41:38 +02:00
|
|
|
- "${WG_PORT:-51820}:51820/udp" # Traffico VPN WireGuard
|
2026-04-12 23:15:02 +02:00
|
|
|
- "${WG_UI_PORT:-51821}:51821/tcp" # Interfaccia web di gestione
|
|
|
|
|
|
|
|
|
|
cap_add:
|
|
|
|
|
- NET_ADMIN # Necessario per gestire le interfacce di rete (wg0) e le route
|
|
|
|
|
- SYS_MODULE # Necessario per caricare il modulo kernel wireguard
|
|
|
|
|
|
|
|
|
|
sysctls:
|
|
|
|
|
- net.ipv4.ip_forward=1 # Abilita il routing dei pacchetti IPv4 tra i client VPN e internet
|
|
|
|
|
- net.ipv6.conf.all.forwarding=1 # Abilita il routing IPv6 (richiesto anche se non si usa IPv6)
|