- Add Hook interface (filter + execute contract) in server/hooks/hook.h
- Add HookRunner in server/hooks/hook_runner.h: spawns a detached thread
per matching hook, with try/catch protection against crashes
- Add DnsUpdaterHook in server/hooks/dns_updater_hook.{h,cpp}:
triggers on server name changes, logs in to Technitium, deletes the
old A record (ignores 404), and adds the new A record
Config via env vars: TECHNITIUM_HOST/PORT/USER/PASS/ZONE, DNS_TTL
- Add Database::get_nics_for_server() to resolve a server's IPv4 address
- Wire HookRunner into InventoryServer; cmd_edit_server now fires hooks
with before/after Server snapshots
- Update CMakeLists.txt to include dns_updater_hook.cpp
- Document env vars in Dockerfile
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
34 lines
1.4 KiB
Bash
Executable file
34 lines
1.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Build all device-inventory images and load them onto the required k8s nodes.
|
|
# Run this from any machine with Docker and SSH access to the nodes.
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
NODE2_IP="192.168.2.195" # kube-node-2 (server + web-ui + cli CronJob)
|
|
NODE3_IP="192.168.2.196" # kube-node-3 (cli CronJob only)
|
|
|
|
echo "=== Building inventory-server:latest ==="
|
|
docker build -t inventory-server:latest -f "$SCRIPT_DIR/Dockerfile" "$SCRIPT_DIR"
|
|
|
|
echo "=== Building inventory-cli:latest ==="
|
|
docker build -t inventory-cli:latest -f "$SCRIPT_DIR/Dockerfile.cli" "$SCRIPT_DIR"
|
|
|
|
echo "=== Building inventory-web-ui:latest ==="
|
|
docker build -t inventory-web-ui:latest -f "$SCRIPT_DIR/web-ui/Dockerfile" "$SCRIPT_DIR/web-ui"
|
|
|
|
echo "=== Loading images onto kube-node-2 ($NODE2_IP) ==="
|
|
for img in inventory-server:latest inventory-web-ui:latest inventory-cli:latest; do
|
|
echo " → $img"
|
|
docker save "$img" | ssh "dan@$NODE2_IP" "sudo ctr --namespace k8s.io images import -"
|
|
done
|
|
|
|
echo "=== Loading images onto kube-node-3 ($NODE3_IP) ==="
|
|
for img in inventory-server:latest inventory-web-ui:latest inventory-cli:latest; do
|
|
echo " → $img"
|
|
docker save "$img" | ssh "dan@$NODE3_IP" "sudo ctr --namespace k8s.io images import -"
|
|
done
|
|
|
|
echo ""
|
|
echo "=== All images loaded. Apply the manifest with: ==="
|
|
echo " kubectl apply -f /home/dan/homelab/deployment/infrastructure/device-inventory.yaml"
|