Rootless-Docker server (wireguard-go + Caddy sharing netns) and unprivileged-LXC client (kernel WG + systemd watchdog/monitor/MTU-probe) with curl-pipeable bootstrap. Tuned for Telekom DSL/LTE Hybrid uplinks.
73 lines
2.0 KiB
YAML
73 lines
2.0 KiB
YAML
# Runs on the internet host under rootless Docker.
|
|
#
|
|
# Prereqs on the rootless-Docker user:
|
|
# - /dev/net/tun readable (e.g. udev rule or `sudo chmod 0666 /dev/net/tun`)
|
|
# - `sysctl net.ipv4.ip_unprivileged_port_start=80` on the host if you want
|
|
# Caddy to bind 80/443 from a rootless daemon; otherwise remap to 8080/8443.
|
|
#
|
|
# Bring up: docker compose up -d --build
|
|
# Logs: docker compose logs -f wg proxy
|
|
|
|
name: wirecon
|
|
|
|
services:
|
|
wg:
|
|
build: ./wg
|
|
container_name: wirecon-wg
|
|
restart: unless-stopped
|
|
# wireguard-go is userspace, but still needs NET_ADMIN within its own netns
|
|
# to create wg0 and program routes/iptables. In rootless Docker this
|
|
# capability is confined to the container's user namespace.
|
|
cap_add:
|
|
- NET_ADMIN
|
|
devices:
|
|
- /dev/net/tun:/dev/net/tun
|
|
sysctls:
|
|
net.ipv4.ip_forward: "1"
|
|
ports:
|
|
# WireGuard handshake/data
|
|
- "51820:51820/udp"
|
|
# Reverse-proxy ingress. Published here (not on `proxy`) because proxy
|
|
# shares wg's network namespace.
|
|
- "80:80/tcp"
|
|
- "443:443/tcp"
|
|
- "443:443/udp" # HTTP/3
|
|
volumes:
|
|
- ./wg/config:/etc/wireguard:ro
|
|
healthcheck:
|
|
test: ["CMD", "/usr/local/bin/healthcheck.sh"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 15s
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "5"
|
|
|
|
proxy:
|
|
image: caddy:2-alpine
|
|
container_name: wirecon-proxy
|
|
restart: unless-stopped
|
|
depends_on:
|
|
wg:
|
|
condition: service_healthy
|
|
# Share wg's network namespace so Caddy can reach 192.168.1.0/24 via wg0
|
|
# without host-level routing. All port publishing must live on the wg
|
|
# service above.
|
|
network_mode: "service:wg"
|
|
volumes:
|
|
- ./proxy/Caddyfile:/etc/caddy/Caddyfile:ro
|
|
- caddy_data:/data
|
|
- caddy_config:/config
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "5"
|
|
|
|
volumes:
|
|
caddy_data:
|
|
caddy_config:
|