port LXC side to Alpine/OpenRC, add Proxmox host-side creator
- Replace systemd units with OpenRC init scripts (supervise-daemon) - Add wirecon-watchdog-loop.sh since OpenRC has no timers - Switch install.sh to apk + rc-update - Update bootstrap.sh to install git/bash via apk - New proxmox/create-lxc.sh: picks next VMID, downloads Alpine template, creates unprivileged LXC with tun passthrough, chains bootstrap - Rewrite README around the Proxmox one-liner flow
This commit is contained in:
1 parent
390e10b06d
commit
5b9abdae08
13 files changed
+290
-128
No files matched your search
@@ -0,0 +1,5 @@
|
||||
# OpenRC config for Alpine's wg-quick init script.
|
||||
# Used when the service is invoked without an instance suffix
|
||||
# (i.e. `rc-service wg-quick ...`). We prefer the per-interface symlink
|
||||
# form (/etc/init.d/wg-quick.wg0) which derives the interface from the
|
||||
# service name, so this file can stay empty.
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/sbin/openrc-run
|
||||
# wirecon tunnel continuous monitor — supervised long-running loop.
|
||||
|
||||
name="wirecon-monitor"
|
||||
description="wirecon WireGuard tunnel monitor"
|
||||
|
||||
supervisor="supervise-daemon"
|
||||
command="/usr/local/bin/wirecon-monitor.sh"
|
||||
respawn_delay=5
|
||||
respawn_max=0 # unlimited restarts
|
||||
output_log="/var/log/wirecon-monitor.log"
|
||||
error_log="/var/log/wirecon-monitor.log"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
after wg-quick.wg0
|
||||
}
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/sbin/openrc-run
|
||||
# wirecon watchdog — OpenRC has no timers, so we supervise a loop wrapper
|
||||
# that re-runs the tick script every WATCHDOG_INTERVAL seconds.
|
||||
|
||||
name="wirecon-watchdog"
|
||||
description="wirecon WireGuard tunnel watchdog"
|
||||
|
||||
supervisor="supervise-daemon"
|
||||
command="/usr/local/bin/wirecon-watchdog-loop.sh"
|
||||
respawn_delay=5
|
||||
respawn_max=0
|
||||
output_log="/var/log/wirecon-watchdog.log"
|
||||
error_log="/var/log/wirecon-watchdog.log"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
after wg-quick.wg0
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
[Unit]
|
||||
# Make sure we come up after the LAN is ready.
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
# wg-quick@ is Type=oneshot with RemainAfterExit=yes by default.
|
||||
# If `wg-quick up` itself fails (e.g. transient DNS blip resolving the
|
||||
# server endpoint at boot), retry a few times before giving up — the
|
||||
# watchdog takes over from there.
|
||||
Restart=on-failure
|
||||
RestartSec=10s
|
||||
# oneshot needs this for Restart to apply:
|
||||
# (systemd accepts Restart on oneshot in practice)
|
||||
@@ -1,17 +0,0 @@
|
||||
[Unit]
|
||||
Description=wirecon tunnel continuous monitor
|
||||
After=wg-quick@wg0.service network-online.target
|
||||
Wants=wg-quick@wg0.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
EnvironmentFile=-/etc/wirecon/wirecon.conf
|
||||
ExecStart=/usr/local/bin/wirecon-monitor.sh
|
||||
Restart=always
|
||||
RestartSec=5s
|
||||
SyslogIdentifier=wirecon-monitor
|
||||
# Low priority; observation only.
|
||||
Nice=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,11 +0,0 @@
|
||||
[Unit]
|
||||
Description=wirecon tunnel watchdog (one tick)
|
||||
After=wg-quick@wg0.service network-online.target
|
||||
Wants=wg-quick@wg0.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
EnvironmentFile=-/etc/wirecon/wirecon.conf
|
||||
ExecStart=/usr/local/bin/wirecon-watchdog.sh
|
||||
SyslogIdentifier=wirecon-watchdog
|
||||
Nice=-5
|
||||
@@ -1,14 +0,0 @@
|
||||
[Unit]
|
||||
Description=wirecon watchdog — run check every 20s
|
||||
After=wg-quick@wg0.service
|
||||
|
||||
[Timer]
|
||||
# Kick off soon after boot, then every 20s.
|
||||
OnBootSec=30s
|
||||
OnUnitActiveSec=20s
|
||||
AccuracySec=1s
|
||||
# Prevents timer drift if a check takes a while (e.g. during a reconnect).
|
||||
Unit=wirecon-watchdog.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
@@ -27,6 +27,9 @@ MTU_MAX=1420
|
||||
# Monitor cadence (seconds between log emissions)
|
||||
MONITOR_INTERVAL=10
|
||||
|
||||
# Watchdog cadence (seconds between tick invocations by the loop wrapper)
|
||||
WATCHDOG_INTERVAL=20
|
||||
|
||||
# Log tag (shows up as SYSLOG_IDENTIFIER in journald)
|
||||
LOG_TAG=wirecon
|
||||
|
||||
|
||||
Reference in new issue
Block a user