migrate: aggiorna configurazione a wg-easy v15

Rimuove le variabili d'ambiente obsolete (WG_HOST, PASSWORD_HASH,
WG_DEFAULT_DNS) ora gestite dalla web UI. Aggiunge INSECURE=true per
accesso HTTP locale. Pulisce i commenti superflui dal compose.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-04 23:58:30 +02:00
parent 78e1c37a9e
commit 2b38127156
2 changed files with 11 additions and 30 deletions
+3 -13
View File
@@ -3,16 +3,6 @@
# Copia .env.example in .env e compila i valori richiesti.
# ============================================================
# --- OBBLIGATORI ---
# IP pubblico o hostname DDNS del server (es. mio-host.duckdns.org)
WG_HOST=your-ddns-hostname.example.com
# Hash bcrypt della password per la web UI.
# Vedi README.md per come generarlo.
# ATTENZIONE: incolla il valore esatto, senza aggiungere $$ o escape.
PASSWORD_HASH=$2a$12$replacethiswithyourrealbcrypthash
# Fuso orario (formato IANA)
# Lista completa: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TZ=Europe/Rome
@@ -25,9 +15,6 @@ WG_PORT=51820
# Porta TCP interfaccia web
WG_UI_PORT=51821
# DNS inviati ai client
WG_DEFAULT_DNS=1.1.1.1,8.8.8.8
# --- OPZIONALI — Limiti risorse container (SBC) ---
# Decommenta e adatta alla RAM disponibile:
# 512 MB RAM → WG_MEM_LIMIT=128m
@@ -38,3 +25,6 @@ WG_DEFAULT_DNS=1.1.1.1,8.8.8.8
# WG_MEM_LIMIT=256m
# WG_MEMSWAP_LIMIT=256m
# WG_CPUS=1.0
# NOTA: host VPN, password e DNS si configurano dalla web UI al primo avvio —
# non servono variabili d'ambiente per questi valori (comportamento v15+).
+8 -17
View File
@@ -1,24 +1,19 @@
services:
wg-easy:
image: ghcr.io/wg-easy/wg-easy:15.2.2 # Pinnato — aggiornare deliberatamente con compose pull
image: ghcr.io/wg-easy/wg-easy:15.2.2
container_name: wg-easy
restart: unless-stopped
# --- 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
@@ -27,27 +22,23 @@ services:
start_period: 30s
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}"
INSECURE: "true"
# Chiavi e configurazione WireGuard persistite fuori dal container
volumes:
- ./wg-data:/etc/wireguard
# File temporanei in RAM invece che sulla SD card
tmpfs:
- /tmp:size=32m,mode=1777
ports:
- "${WG_PORT:-51820}:51820/udp" # Traffico VPN WireGuard
- "${WG_UI_PORT:-51821}:51821/tcp" # Interfaccia web di gestione
- "${WG_PORT:-51820}:51820/udp"
- "${WG_UI_PORT:-51821}:51821/tcp"
cap_add:
- NET_ADMIN # Necessario per gestire le interfacce di rete (wg0) e le route
- SYS_MODULE # Necessario per caricare il modulo kernel wireguard
- NET_ADMIN
- SYS_MODULE
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)
- net.ipv4.ip_forward=1
- net.ipv6.conf.all.forwarding=1