Files
unpoller-unpoller-3/init/synology-docker-compose/docker-compose.yml
Cody Lee b960695f3b Add Docker health check support
Implements #406 by adding a --health CLI flag and HEALTHCHECK instruction
to the Dockerfile. This allows Docker and container orchestration platforms
to monitor container health automatically.

Changes:
- Added --health flag that validates configuration and plugin connectivity
- Implemented HealthCheck() method in pkg/poller/commands.go
- Updated Dockerfile with HEALTHCHECK instruction (30s interval, 10s timeout)
- Updated MANUAL.md with --health flag documentation
- Added health check documentation to Docker README
- Added comments to docker-compose examples about built-in health check

The health check:
- Validates configuration file is found and parseable
- Ensures at least one input and one enabled output are configured
- Performs basic validation on enabled outputs
- Returns exit code 0 (healthy) or 1 (unhealthy)
- Runs silently for Docker compatibility

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-08 13:09:10 -06:00

55 lines
1.6 KiB
YAML

# This is for unifi-poller v2.
version: '3'
services:
influxdb:
restart: always
image: influxdb:latest
volumes:
- ${INFLUXDB_LOCAL_VOLUME}:/var/lib/influxdb
environment:
- INFLUXDB_DATA_DIR=/var/lib/influxdb/data
- INFLUXDB_DATA_WAL_DIR=/var/lib/influxdb/wal
- INFLUXDB_DATA_META_DIR=/var/lib/influxdb/meta
networks:
- Grafana_Network
grafana:
image: grafana/grafana:latest
restart: always
ports:
- '3000:3000'
volumes:
- ${GRAFANA_LOCAL_VOLUME}:/var/lib/grafana
depends_on:
- influxdb
user: "${GRAFANA_LOCAL_USERID}"
environment:
- GF_SECURITY_ADMIN_USER=${GRAFANA_USERNAME}
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
- GF_INSTALL_PLUGINS=grafana-clock-panel,natel-discrete-panel,grafana-piechart-panel
- GF_SERVER_DOMAIN=${GRAFANA_SERVER_DOMAIN}
- GF_ENFORCE_DOMAIN=true
networks:
- Grafana_Network
unifi-poller:
restart: always
image: ghcr.io/unpoller/unpoller:${POLLER_TAG}
# Health check is built into the Docker image
# It validates configuration and checks plugin connectivity
environment:
- UP_INFLUXDB_USER=${INFLUXDB_ADMIN_USER}
- UP_INFLUXDB_PASS=${INFLUXDB_ADMIN_PASSWORD}
- UP_INFLUXDB_URL=http://influxdb:8086
- UP_UNIFI_DEFAULT_USER=${UNIFI_USER}
- UP_UNIFI_DEFAULT_PASS=${UNIFI_PASS}
- UP_UNIFI_DEFAULT_URL=${UNIFI_URL}
- UP_POLLER_DEBUG=${POLLER_DEBUG}
- UP_UNIFI_DEFAULT_SAVE_DPI=${POLLER_SAVE_DPI}
networks:
- Grafana_Network
networks:
Grafana_Network: