Make the cluster's primary WireGuard option stop the primary server and its gateway in mirror mode

This commit is contained in:
Eduardo Silva
2026-11-23 14:00:35 -03:00
parent 1c3e162b5c
commit 2aa740eaaf
11 changed files with 196 additions and 7 deletions
+9 -4
View File
@@ -16,13 +16,18 @@ python manage.py collectstatic --noinput
# Export WireGuard, firewall and Caddy configs before bringing up interfaces
python manage.py export_configs
# Starts each WireGuard configuration file found in /etc/wireguard
# Starts each WireGuard configuration file found in /etc/wireguard, unless the cluster settings disable WireGuard
# on the primary server
shopt -s nullglob
config_files=(/etc/wireguard/*.conf)
if [ ${#config_files[@]} -gt 0 ]; then
for f in "${config_files[@]}"; do
wg-quick up "$(basename "${f}" .conf)"
done
if python manage.py primary_wireguard_enabled; then
for f in "${config_files[@]}"; do
wg-quick up "$(basename "${f}" .conf)"
done
else
echo "WireGuard is disabled on the primary server, interfaces not started."
fi
fi
if [[ "${DEV_MODE,,}" == "true" ]]; then
echo ""