Adapt installers to upstream wireguard-ui build (Go+embed, yarn assets)

Upstream builds a single static binary (main.go at repo root, no
cmd/... subpackage) that go:embeds templates/ and assets/ at compile
time, and uses a relative ./db directory (jsondb) instead of SQLite -
so WorkingDirectory in the systemd unit now matters for the DB path,
not for template/static serving like before.

Frontend assets (admin-lte, jquery plugins) need yarn + prepare_assets.sh
before go build, so all installers now also install nodejs/npm/yarn and
run prepare_assets.sh when assets/dist is missing or package.json changed.

Binary is now literally named "wireguard-ui" (matches upstream), listens
on 0.0.0.0:5000 by default. systemd unit rewritten accordingly with
WorkingDirectory=/var/lib/wireguard-ui-multi.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
sysops
2026-07-10 18:38:02 +02:00
co-authored by Claude Sonnet 5
parent 94f0e69676
commit e5c0a5888f
6 changed files with 156 additions and 58 deletions
+6 -4
View File
@@ -130,11 +130,14 @@ echo "Starting container..."
pct start "$VMID"
sleep 5
echo "Installing base dependencies inside container (Go, git, wireguard-tools, nftables)..."
echo "Installing base dependencies inside container (Go, Node/yarn, git, wireguard-tools, nftables)..."
pct exec "$VMID" -- bash -c "
set -e
apt-get update
apt-get install -y wireguard-tools nftables curl ca-certificates git
apt-get install -y wireguard-tools nftables curl ca-certificates git nodejs npm
if ! command -v yarn >/dev/null 2>&1; then
npm install -g yarn
fi
if ! command -v go >/dev/null 2>&1; then
ARCH=\$(dpkg --print-architecture)
curl -fsSL https://go.dev/dl/go1.22.5.linux-\${ARCH}.tar.gz -o /tmp/go.tar.gz
@@ -160,9 +163,8 @@ pct exec "$VMID" -- bash -c "
echo "Running native installer inside container..."
pct exec "$VMID" -- bash -c "
set -e
export PATH=/usr/local/go/bin:/usr/local/bin:\$PATH
cd /opt/wireguard-ui-multi-src
go mod tidy
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o wireguard-ui-multi ./cmd/wireguard-ui-multi
bash scripts/install.sh
"