From e5de7c532d39eec48c0d9b0f1230b4342c3184c7 Mon Sep 17 00:00:00 2001 From: Fizzlepoof Date: Fri, 15 May 2026 15:43:17 +0000 Subject: [PATCH] Align NOMAD Pi-hole replica with stack SOP --- docs/planning/DEPLOY_PIHOLE.md | 8 ++++---- pihole/bin/render_keepalived_conf.py | 12 +++++++++--- pihole/nomad/.env.example | 5 +++-- pihole/nomad/README.md | 4 ++-- pihole/nomad/bin/render_keepalived_conf.py | 2 +- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/docs/planning/DEPLOY_PIHOLE.md b/docs/planning/DEPLOY_PIHOLE.md index e226a93..662731d 100644 --- a/docs/planning/DEPLOY_PIHOLE.md +++ b/docs/planning/DEPLOY_PIHOLE.md @@ -229,7 +229,7 @@ sudo docker logs unbound-pihole-primary --tail 20 N.O.M.A.D. runs Ubuntu bare metal. Deploy via Docker Compose on the host. -**Appdata:** `/mnt/hdd-2/docker/appdata/` +**Appdata:** `/mnt/docker-ssd/docker/appdata/` **Web UI port:** `8954` ### docker-compose.yaml @@ -244,7 +244,7 @@ services: network_mode: host restart: unless-stopped volumes: - - /mnt/hdd-2/docker/appdata/unbound-nomad:/opt/unbound/etc/unbound/ + - /mnt/docker-ssd/docker/appdata/unbound-nomad:/opt/unbound/etc/unbound/ healthcheck: test: ["CMD-SHELL", "drill @127.0.0.1 -p 5335 cloudflare.com || exit 1"] interval: 30s @@ -269,7 +269,7 @@ services: FTLCONF_ntp_ipv6_active: "false" FTLCONF_ntp_sync_active: "false" volumes: - - /mnt/hdd-2/docker/appdata/pihole-nomad/etc-pihole:/etc/pihole + - /mnt/docker-ssd/docker/appdata/pihole-nomad/etc-pihole:/etc/pihole cap_add: - SYS_NICE @@ -517,7 +517,7 @@ Enable Pangolin auth — Pi-hole admin should not be publicly accessible. |------|------|------|--------| | PD | `/mnt/tank/docker/appdata/pihole-primary` | tank | Low write frequency | | PD | `/mnt/tank/docker/appdata/unbound-primary` | tank | Config + root hints only | -| N.O.M.A.D. | `/mnt/hdd-2/docker/appdata/pihole-nomad` | Local HDD | Docker-managed local appdata | +| N.O.M.A.D. | `/mnt/docker-ssd/docker/appdata/pihole-nomad` | Local SSD | Docker-managed local appdata | | RPi4 | `~/pihole/` | SD card / SSD | Dedicated Pi, no other concerns | --- diff --git a/pihole/bin/render_keepalived_conf.py b/pihole/bin/render_keepalived_conf.py index 156aab7..da0b93c 100755 --- a/pihole/bin/render_keepalived_conf.py +++ b/pihole/bin/render_keepalived_conf.py @@ -27,22 +27,27 @@ def main() -> int: env = load_env(ENV_FILE) required = [ 'LAN_INTERFACE', 'VIP_CIDR', 'KEEPALIVED_ROUTER_ID', 'KEEPALIVED_STATE', - 'KEEPALIVED_PRIORITY', 'KEEPALIVED_PASSWORD', 'PD_PIHOLE_WEB_PORT' + 'KEEPALIVED_PRIORITY', 'KEEPALIVED_PASSWORD' ] missing = [k for k in required if not env.get(k)] if missing: print(f'Missing required vars in {ENV_FILE}: {", ".join(missing)}', file=sys.stderr) return 1 + web_port = env.get('PIHOLE_WEB_PORT') or env.get('PD_PIHOLE_WEB_PORT') or env.get('SERENITY_PIHOLE_WEB_PORT') or env.get('RPI4_PIHOLE_WEB_PORT') + if not web_port: + print('Missing Pi-hole web port in .env (set PIHOLE_WEB_PORT or node-specific port variable).', file=sys.stderr) + return 1 + keepalived_password = env['KEEPALIVED_PASSWORD'] if len(keepalived_password) > 8: print('KEEPALIVED_PASSWORD must be 8 characters or fewer for VRRP PASS auth.', file=sys.stderr) return 1 try: - web_port_hex = f"{int(env['PD_PIHOLE_WEB_PORT']):04X}" + web_port_hex = f"{int(web_port):04X}" except ValueError: - print('PD_PIHOLE_WEB_PORT must be an integer.', file=sys.stderr) + print('Pi-hole web port must be an integer.', file=sys.stderr) return 1 router_id_name = f"pihole_{re.sub(r'[^a-z0-9]+', '_', env['KEEPALIVED_STATE'].lower())}" @@ -55,6 +60,7 @@ def main() -> int: 'NOPREEMPT_LINE': nopreempt_line, } replacements.update({k: env[k] for k in required}) + replacements['PIHOLE_WEB_PORT'] = web_port for key, value in replacements.items(): rendered = rendered.replace('${' + key + '}', value) diff --git a/pihole/nomad/.env.example b/pihole/nomad/.env.example index fa8e0a1..11d216a 100644 --- a/pihole/nomad/.env.example +++ b/pihole/nomad/.env.example @@ -1,6 +1,7 @@ TZ=America/Chicago -APPDATA_PIHOLE_ROOT=/mnt/hdd-2/docker/appdata/pihole-nomad -APPDATA_UNBOUND_ROOT=/mnt/hdd-2/docker/appdata/unbound-nomad +APPDATA_PIHOLE_ROOT=/mnt/docker-ssd/docker/appdata/pihole-nomad +APPDATA_UNBOUND_ROOT=/mnt/docker-ssd/docker/appdata/unbound-nomad +PIHOLE_WEB_PORT=8954 NOMAD_PIHOLE_WEB_PORT=8954 PIHOLE_PASSWORD=CHANGE_ME LAN_INTERFACE=enp5s0 diff --git a/pihole/nomad/README.md b/pihole/nomad/README.md index af357a2..e92ced0 100644 --- a/pihole/nomad/README.md +++ b/pihole/nomad/README.md @@ -1,7 +1,7 @@ # NOMAD Pi-hole / Unbound / Keepalived Replica - **Repo stack path:** `/home/fizzlepoof/repos/truenas-stacks/pihole/nomad` -- **Suggested live stack path:** `/mnt/hdd-1/docker/compose/pihole-nomad` +- **Suggested live stack path:** `/mnt/docker-ssd/docker/compose/pihole-nomad` - **Node role:** NOMAD backup / BACKUP1 - **VIP target:** `10.5.1.53/24` - **LAN interface:** `enp5s0` @@ -10,7 +10,7 @@ Bring-up: ```bash -cd /mnt/hdd-1/docker/compose/pihole-nomad +cd /mnt/docker-ssd/docker/compose/pihole-nomad cp .env.example .env bash bin/prepare_nomad.sh --up ``` diff --git a/pihole/nomad/bin/render_keepalived_conf.py b/pihole/nomad/bin/render_keepalived_conf.py index da0b93c..a172b75 100755 --- a/pihole/nomad/bin/render_keepalived_conf.py +++ b/pihole/nomad/bin/render_keepalived_conf.py @@ -34,7 +34,7 @@ def main() -> int: print(f'Missing required vars in {ENV_FILE}: {", ".join(missing)}', file=sys.stderr) return 1 - web_port = env.get('PIHOLE_WEB_PORT') or env.get('PD_PIHOLE_WEB_PORT') or env.get('SERENITY_PIHOLE_WEB_PORT') or env.get('RPI4_PIHOLE_WEB_PORT') + web_port = env.get('PIHOLE_WEB_PORT') or env.get('PD_PIHOLE_WEB_PORT') or env.get('NOMAD_PIHOLE_WEB_PORT') or env.get('SERENITY_PIHOLE_WEB_PORT') or env.get('RPI4_PIHOLE_WEB_PORT') if not web_port: print('Missing Pi-hole web port in .env (set PIHOLE_WEB_PORT or node-specific port variable).', file=sys.stderr) return 1