blumeops/containers/unpoller/container.py
Erich Blume 4d1f4af25b Upgrade unpoller v2.34.0 → v3.2.0, migrate to container.py (#361)
## Summary

- Service Review pickup: unpoller (last reviewed 73 days ago).
- Upgrades unpoller from v2.34.0 to v3.2.0 (major version bump).
- Migrates the container build from a Dockerfile to a native Dagger pipeline (`containers/unpoller/container.py`) following the navidrome / miniflux pattern.
- Refreshes `service-versions.yaml` (last-reviewed, current-version).

## Breaking changes (upstream)

- **v3.0.0** — UniFi network API shifts (later 10.x). Some metric / event / log names and labels may have changed. Worth a follow-up sweep of the unpoller Grafana dashboard for missing series.
- **v3.2.0** — defaults to a 60s background poll feeding cached Prometheus scrapes (was on-demand poll per scrape). To restore previous behavior, set `interval = 0` in `up.conf`. Leaving the new default in this PR — every-15s scrapes will simply serve from cache, which is fine for our use.

## Build

- Image: `registry.ops.eblu.me/blumeops/unpoller:v3.2.0-1b27242`
- Built by build-container workflow run #559 from this branch.

## Test plan

- [ ] `argocd app set unpoller --revision unpoller-v3 && argocd app sync unpoller`
- [ ] Pod comes Ready
- [ ] Verify metrics exported (`Site/Client/UAP/USG/USW` counts in logs, `unpoller_*` series in Prometheus)
- [ ] Spot-check unpoller Grafana dashboard for missing series after the v3 API shift
- [ ] After merge: `argocd app set unpoller --revision main && argocd app sync unpoller`

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

Reviewed-on: #361
2026-05-28 09:59:46 -07:00

53 lines
1.3 KiB
Python

"""UnPoller — UniFi metrics exporter for Prometheus.
Two-stage build: Go backend, Alpine runtime.
Source cloned from forge mirror.
"""
import dagger
from blumeops.containers import (
alpine_runtime,
clone_from_forge,
go_build,
oci_labels,
)
VERSION = "v3.2.0"
async def build(src: dagger.Directory) -> dagger.Container:
source = clone_from_forge("unpoller", VERSION)
backend = go_build(
source,
"/unpoller",
ldflags=(
f"-s -w "
f"-X main.version={VERSION} "
f"-X main.builtBy=blumeops "
f"-X golift.io/version.Version={VERSION} "
f"-X golift.io/version.Branch=HEAD "
f"-X golift.io/version.BuildUser=blumeops "
f"-X golift.io/version.Revision=blumeops-build"
),
)
runtime = alpine_runtime(
extra_apk=["ca-certificates", "tzdata"],
create_user=False,
)
runtime = oci_labels(
runtime,
title="UnPoller",
description="UniFi metrics exporter for Prometheus",
version=VERSION,
)
return (
runtime.with_file("/usr/bin/unpoller", backend.file("/unpoller"))
.with_exposed_port(9130)
.with_user("65534")
.with_default_args(
args=["/usr/bin/unpoller", "--config", "/etc/unpoller/up.conf"]
)
)