mirror of
https://github.com/alexhopeoconnor/dnsmasq-webui.git
synced 2026-10-19 12:21:30 +10:00
- Register ISettingsModalService, INotificationService, IUpdateCheckService via assembly scanning (marker interfaces) - Add IApplicationOptionsValidator<TOptions> marker; scan only those for IValidateOptions registration - Fix ApplicationLifecycleLoggingHostedService: log RestartCommand/ReloadCommand/StatusCommand (no ApplyCommand) - NavMenu: spin animation for update-check button icon when checking; single icon with conditional nav-footer-spin class - Add NotificationHost/NotificationToast components and NotificationService for toasts - Effective config save flow, restore result, save service; various EffectiveConfig and DnsmasqOptions/validator updates - Test and script updates; docker-compose.test.yml, appsettings, DnsmasqConfKeys/tooltips/sections
103 lines
3.7 KiB
YAML
103 lines
3.7 KiB
YAML
# Run the app with real dnsmasq and several DHCP clients so hosts/leases are real.
|
||
# Some clients also make periodic DNS requests so the DNS cache and logs show activity.
|
||
# Prepare mount: ./scripts/prepare-test-mount.sh [--minimal-conf | --prepare-only | ...]
|
||
# Or set TESTDATA_MOUNT to override the data volume (default: ./testdata-mount).
|
||
# Set TEST_DNSMASQ_CONF to override main config path (default: /data/dnsmasq-test.conf; use /data/dnsmasq-test-minimal.conf for minimal).
|
||
#
|
||
# No systemd in container (dnsmasq runs as a process from entrypoint, like most dnsmasq images).
|
||
# StatusShowCommand/LogsCommand use ps so the Service status / Recent logs sections show something
|
||
# (process info). On a host with systemd you'd use systemctl status dnsmasq and journalctl instead.
|
||
# cap_add NET_ADMIN for dnsmasq.
|
||
#
|
||
# Networks: testnet 172.28.0.0/16 so dnsmasq can hand out 172.28.0.10–50.
|
||
services:
|
||
app:
|
||
build:
|
||
context: .
|
||
ports:
|
||
- "8080:8080"
|
||
cap_add:
|
||
- NET_ADMIN
|
||
environment:
|
||
DNSMASQ_CONF: ${TEST_DNSMASQ_CONF:-/data/dnsmasq-test.conf}
|
||
Dnsmasq__MainConfigPath: ${TEST_DNSMASQ_CONF:-/data/dnsmasq-test.conf}
|
||
Dnsmasq__ManagedFileName: zz-dnsmasq-webui.conf
|
||
# No systemd in container: restart by killing and re-running dnsmasq (same as entrypoint.sh). Config path must match DNSMASQ_CONF/MainConfigPath.
|
||
Dnsmasq__RestartCommand: "pkill -x dnsmasq || true; sleep 1; dnsmasq --test --conf-file=${TEST_DNSMASQ_CONF:-/data/dnsmasq-test.conf} >/tmp/dnsmasq-restart.err 2>&1 || { cat /tmp/dnsmasq-restart.err >&2; exit 1; }; dnsmasq -k --conf-file=${TEST_DNSMASQ_CONF:-/data/dnsmasq-test.conf} >/tmp/dnsmasq-restart.err 2>&1 & sleep 1; pgrep -x dnsmasq >/dev/null || { cat /tmp/dnsmasq-restart.err >&2; exit 1; }"
|
||
Dnsmasq__ReloadCommand: "pkill -HUP -x dnsmasq"
|
||
Dnsmasq__StatusCommand: "pgrep -x dnsmasq"
|
||
# Simulated systemctl status + real logs (dnsmasq logs to /data/dnsmasq.log via log-facility in dnsmasq-test.conf)
|
||
Dnsmasq__StatusShowCommand: "/app/dnsmasq-status.sh"
|
||
Dnsmasq__LogsCommand: "tail -n 100 /data/dnsmasq.log 2>/dev/null || echo '(no log file yet)'"
|
||
# Persist runtime log level across container restarts
|
||
RuntimeOverrides__FilePath: "/data/appsettings.Overrides.json"
|
||
volumes:
|
||
- ${TESTDATA_MOUNT:-./testdata-mount}:/data
|
||
networks:
|
||
testnet:
|
||
ipv4_address: 172.28.0.2
|
||
|
||
# DHCP only; keeps running with lease.
|
||
dhcp-client:
|
||
image: alpine:3.20
|
||
command: ["sh", "-c", "sleep 5 && exec udhcpc -i eth0 -f -n"]
|
||
networks:
|
||
testnet: {}
|
||
depends_on:
|
||
- app
|
||
|
||
# DHCP + periodic DNS lookups (every 20s) so DNS cache/logs show activity.
|
||
dhcp-client-dns-a:
|
||
image: alpine:3.20
|
||
command:
|
||
- sh
|
||
- -c
|
||
- |
|
||
udhcpc -i eth0 -f -n &
|
||
sleep 10
|
||
while true; do
|
||
nslookup google.com 2>/dev/null || true
|
||
nslookup cloudflare.com 2>/dev/null || true
|
||
sleep 20
|
||
done
|
||
networks:
|
||
testnet: {}
|
||
depends_on:
|
||
- app
|
||
|
||
# DHCP + periodic DNS lookups (every 45s); different interval for variety.
|
||
dhcp-client-dns-b:
|
||
image: alpine:3.20
|
||
command:
|
||
- sh
|
||
- -c
|
||
- |
|
||
udhcpc -i eth0 -f -n &
|
||
sleep 10
|
||
while true; do
|
||
nslookup example.com 2>/dev/null || true
|
||
nslookup github.com 2>/dev/null || true
|
||
sleep 45
|
||
done
|
||
networks:
|
||
testnet: {}
|
||
depends_on:
|
||
- app
|
||
|
||
# Third DHCP-only client so the leases table has more entries.
|
||
dhcp-client-2:
|
||
image: alpine:3.20
|
||
command: ["sh", "-c", "sleep 8 && exec udhcpc -i eth0 -f -n"]
|
||
networks:
|
||
testnet: {}
|
||
depends_on:
|
||
- app
|
||
|
||
networks:
|
||
testnet:
|
||
driver: bridge
|
||
ipam:
|
||
config:
|
||
- subnet: 172.28.0.0/16
|
||
gateway: 172.28.0.1
|