Three related fixes for running Monitor inside a container with /:/host:ro bind-mounted and network_mode: host. * config: when HF_MONITER_ROOTFS is set, read the default identifier from <rootFS>/etc/hostname instead of os.Hostname(). Under network_mode: host the UTS namespace is not shared, so os.Hostname() returns a random docker-assigned string that changes across recreations, causing the backend to treat each restart as a new server. * telemetry: log gopsutil errors from BuildPayload instead of silently swallowing them. Previously a missing /host mount would send a payload full of zeroed fields with no indication of failure. * docker-compose: drop the 'ports:' block. It is silently ignored under network_mode: host (the bridge server binds directly on the host's 127.0.0.1:MONITOR_PORT).
23 lines
797 B
YAML
23 lines
797 B
YAML
version: "3.8"
|
|
|
|
services:
|
|
harborforge-monitor:
|
|
build: .
|
|
container_name: harborforge-monitor
|
|
restart: unless-stopped
|
|
environment:
|
|
- HF_MONITER_BACKEND_URL=https://monitor.hangman-lab.top
|
|
- HF_MONITER_IDENTIFIER=${HF_IDENTIFIER:-}
|
|
- HF_MONITER_API_KEY=${HF_API_KEY:-}
|
|
- HF_MONITER_REPORT_INTERVAL=${HF_REPORT_INTERVAL:-30}
|
|
- HF_MONITER_LOG_LEVEL=${HF_LOG_LEVEL:-info}
|
|
- HF_MONITER_ROOTFS=/host
|
|
- MONITOR_PORT=${MONITOR_PORT:-0}
|
|
volumes:
|
|
- /:/host:ro
|
|
# network_mode: host shares the host network namespace, so the bridge
|
|
# server (if MONITOR_PORT > 0) listens directly on the host's
|
|
# 127.0.0.1:<MONITOR_PORT>. `ports:` is ignored under network_mode:
|
|
# host, so it is intentionally omitted.
|
|
network_mode: host
|