blumeops/containers/unpoller/container.py
Erich Blume 1b27242437 C1(unpoller-v3): upgrade v2.34.0 -> v3.2.0, migrate to container.py
Major version bump from v2.34.0 to v3.2.0.

Breaking changes upstream:
- v3.0.0: UniFi network API shifts (later 10.x); metrics, events and logs
  may have changed names/labels.
- v3.2.0: defaults to a 60s background poll feeding cached Prometheus
  scrapes (was on-demand poll per scrape). Set interval = 0 in up.conf
  to restore on-demand behavior if needed.

Also migrate the container build from a Dockerfile to a native Dagger
pipeline (containers/unpoller/container.py) using the shared helpers in
blumeops.containers, following the navidrome/miniflux pattern. The
build-container workflow already prefers container.py when present.

Refresh last-reviewed and current-version in service-versions.yaml.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 09:34:12 -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"]
)
)