Align NOMAD Pi-hole replica with stack SOP

This commit is contained in:
Fizzlepoof
2026-05-15 15:43:17 +00:00
parent f3469e35fd
commit ce167138cf
5 changed files with 19 additions and 12 deletions

View File

@@ -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. 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` **Web UI port:** `8954`
### docker-compose.yaml ### docker-compose.yaml
@@ -244,7 +244,7 @@ services:
network_mode: host network_mode: host
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- /mnt/hdd-2/docker/appdata/unbound-nomad:/opt/unbound/etc/unbound/ - /mnt/docker-ssd/docker/appdata/unbound-nomad:/opt/unbound/etc/unbound/
healthcheck: healthcheck:
test: ["CMD-SHELL", "drill @127.0.0.1 -p 5335 cloudflare.com || exit 1"] test: ["CMD-SHELL", "drill @127.0.0.1 -p 5335 cloudflare.com || exit 1"]
interval: 30s interval: 30s
@@ -269,7 +269,7 @@ services:
FTLCONF_ntp_ipv6_active: "false" FTLCONF_ntp_ipv6_active: "false"
FTLCONF_ntp_sync_active: "false" FTLCONF_ntp_sync_active: "false"
volumes: 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: cap_add:
- SYS_NICE - 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/pihole-primary` | tank | Low write frequency |
| PD | `/mnt/tank/docker/appdata/unbound-primary` | tank | Config + root hints only | | 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 | | RPi4 | `~/pihole/` | SD card / SSD | Dedicated Pi, no other concerns |
--- ---

View File

@@ -27,22 +27,27 @@ def main() -> int:
env = load_env(ENV_FILE) env = load_env(ENV_FILE)
required = [ required = [
'LAN_INTERFACE', 'VIP_CIDR', 'KEEPALIVED_ROUTER_ID', 'KEEPALIVED_STATE', '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)] missing = [k for k in required if not env.get(k)]
if missing: if missing:
print(f'Missing required vars in {ENV_FILE}: {", ".join(missing)}', file=sys.stderr) print(f'Missing required vars in {ENV_FILE}: {", ".join(missing)}', file=sys.stderr)
return 1 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'] keepalived_password = env['KEEPALIVED_PASSWORD']
if len(keepalived_password) > 8: if len(keepalived_password) > 8:
print('KEEPALIVED_PASSWORD must be 8 characters or fewer for VRRP PASS auth.', file=sys.stderr) print('KEEPALIVED_PASSWORD must be 8 characters or fewer for VRRP PASS auth.', file=sys.stderr)
return 1 return 1
try: try:
web_port_hex = f"{int(env['PD_PIHOLE_WEB_PORT']):04X}" web_port_hex = f"{int(web_port):04X}"
except ValueError: 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 return 1
router_id_name = f"pihole_{re.sub(r'[^a-z0-9]+', '_', env['KEEPALIVED_STATE'].lower())}" 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, 'NOPREEMPT_LINE': nopreempt_line,
} }
replacements.update({k: env[k] for k in required}) replacements.update({k: env[k] for k in required})
replacements['PIHOLE_WEB_PORT'] = web_port
for key, value in replacements.items(): for key, value in replacements.items():
rendered = rendered.replace('${' + key + '}', value) rendered = rendered.replace('${' + key + '}', value)

View File

@@ -1,6 +1,7 @@
TZ=America/Chicago TZ=America/Chicago
APPDATA_PIHOLE_ROOT=/mnt/hdd-2/docker/appdata/pihole-nomad APPDATA_PIHOLE_ROOT=/mnt/docker-ssd/docker/appdata/pihole-nomad
APPDATA_UNBOUND_ROOT=/mnt/hdd-2/docker/appdata/unbound-nomad APPDATA_UNBOUND_ROOT=/mnt/docker-ssd/docker/appdata/unbound-nomad
PIHOLE_WEB_PORT=8954
NOMAD_PIHOLE_WEB_PORT=8954 NOMAD_PIHOLE_WEB_PORT=8954
PIHOLE_PASSWORD=CHANGE_ME PIHOLE_PASSWORD=CHANGE_ME
LAN_INTERFACE=enp5s0 LAN_INTERFACE=enp5s0

View File

@@ -1,7 +1,7 @@
# NOMAD Pi-hole / Unbound / Keepalived Replica # NOMAD Pi-hole / Unbound / Keepalived Replica
- **Repo stack path:** `/home/fizzlepoof/repos/truenas-stacks/pihole/nomad` - **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 - **Node role:** NOMAD backup / BACKUP1
- **VIP target:** `10.5.1.53/24` - **VIP target:** `10.5.1.53/24`
- **LAN interface:** `enp5s0` - **LAN interface:** `enp5s0`
@@ -10,7 +10,7 @@
Bring-up: Bring-up:
```bash ```bash
cd /mnt/hdd-1/docker/compose/pihole-nomad cd /mnt/docker-ssd/docker/compose/pihole-nomad
cp .env.example .env cp .env.example .env
bash bin/prepare_nomad.sh --up bash bin/prepare_nomad.sh --up
``` ```

View File

@@ -34,7 +34,7 @@ def main() -> int:
print(f'Missing required vars in {ENV_FILE}: {", ".join(missing)}', file=sys.stderr) print(f'Missing required vars in {ENV_FILE}: {", ".join(missing)}', file=sys.stderr)
return 1 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: if not web_port:
print('Missing Pi-hole web port in .env (set PIHOLE_WEB_PORT or node-specific port variable).', file=sys.stderr) print('Missing Pi-hole web port in .env (set PIHOLE_WEB_PORT or node-specific port variable).', file=sys.stderr)
return 1 return 1