Native iPhone monitoring for Harvester HCI. Self-hosted incidents, cluster health and optional push notifications. Apache 2.0.
  • JavaScript 53.4%
  • Swift 41.9%
  • Python 4.2%
  • Dockerfile 0.5%
Find a file
Richard Tyler Miles 641e664646
All checks were successful
Service tests / test (push) Successful in 1m48s
Container validation / container (push) Successful in 1m42s
Merge pull request 'Verify and publish source-pinned service containers' (#4) from codex/container-delivery into main
2026-10-16 01:10:04 +00:00
.forgejo/workflows Verify and publish source-pinned service containers 2026-10-15 19:07:41 -06:00
deploy Add native admin inventory, observability, and push diagnostics 2026-10-15 18:42:45 -06:00
ios Keep notification incident details available beyond inbox limits 2026-10-15 18:48:09 -06:00
server Keep notification incident details available beyond inbox limits 2026-10-15 18:48:09 -06:00
.dockerignore Bootstrap standalone Harvester Monitor for Miles Systems 2026-10-15 16:14:59 -06:00
.env.example Add native admin inventory, observability, and push diagnostics 2026-10-15 18:42:45 -06:00
.gitignore Bootstrap standalone Harvester Monitor for Miles Systems 2026-10-15 16:14:59 -06:00
.nvmrc Bootstrap standalone Harvester Monitor for Miles Systems 2026-10-15 16:14:59 -06:00
AGENTS.md Bootstrap standalone Harvester Monitor for Miles Systems 2026-10-15 16:14:59 -06:00
Dockerfile Verify and publish source-pinned service containers 2026-10-15 19:07:41 -06:00
LICENSE Bootstrap standalone Harvester Monitor for Miles Systems 2026-10-15 16:14:59 -06:00
NOTICE Bootstrap standalone Harvester Monitor for Miles Systems 2026-10-15 16:14:59 -06:00
package.json Add native admin inventory, observability, and push diagnostics 2026-10-15 18:42:45 -06:00
README.md Verify and publish source-pinned service containers 2026-10-15 19:07:41 -06:00
SECURITY.md Bootstrap standalone Harvester Monitor for Miles Systems 2026-10-15 16:14:59 -06:00

Harvester Monitor

A native iPhone app for Harvester HCI, by Miles Systems. Monitor nodes, virtual machines, Longhorn volumes, Kubernetes warning events, and your own custom server events. Browse Rancher managed clusters, Kubernetes pods and controllers, Longhorn disks and replicas, Harvester add-ons and VM backups. Keep a durable incident history, acknowledge incidents, and snooze alerts. Native charts show Prometheus CPU, memory, and network history alongside a searchable Grafana dashboard index.

Independent, self-hosted, Apache 2.0. No SaaS account, proprietary control plane, SMS provider, or external database is required. This is a community project, not an official Harvester or SUSE application.

Architecture

iPhone (SwiftUI, Keychain) ──HTTPS + access token──> Monitor service (Node 26 + SQLite)
                                                        │
                              read-only Kubernetes API ─┤
                              Alertmanager webhook ─────┤
                              custom event API ─────────┤
                              optional Apple APNs <─────┘

Cluster credentials and Apple signing keys stay on the service. The iPhone stores only its monitor URL and access token in Keychain. Connections require HTTPS; Debug builds also allow loopback HTTP for simulator development. Redirects are rejected so a mistyped service URL cannot forward the access token elsewhere.

The current service supports one shared operator profile per installation. Devices using the same access token share acknowledgement and notification settings. Deploy a separate instance for a separate cluster/operator. Multiple profiles and per-user authentication are future work; this is not a multi-tenant control plane.

Run the service

Requires Node 26; there are no npm runtime dependencies.

nvm use
npm test
npm run token

Keep the generated access token private. Put its MONITOR_ACCESS_TOKEN_SHA256 digest in a protected environment file (see .env.example), and enter the raw access token in the iPhone app. Use a separate generated token/digest for event producers via MONITOR_EVENT_TOKEN_SHA256. This producer token can only submit events/webhooks, never read snapshots, register devices, or change preferences.

Outside Kubernetes, provide the Kubernetes HTTPS endpoint, CA file, and a service account token file with the read-only permissions in deploy/kubernetes.yaml. No insecure TLS switch or cluster-admin token is needed.

node --env-file=.env server/main.mjs

The default listener is 127.0.0.1:8789. Put a trusted HTTPS reverse proxy in front of it for iPhone access. Preserve streaming responses for /v1/monitor/stream (disable proxy buffering, allow long read timeouts). Do not expose the plaintext listener on the Internet. Rotate access by generating a new token and replacing the digest, restarting the service, then reconnecting devices. The service does not log credentials.

Run in Harvester

  1. Build docker build -t YOUR_REGISTRY/harvester-monitor:0.2.0 . and push it.
  2. Replace the example image in deploy/kubernetes.yaml with that image.
  3. Create the harvester-monitor namespace and a monitor-access Secret there, containing MONITOR_ACCESS_TOKEN_SHA256 and optionally MONITOR_EVENT_TOKEN_SHA256. Keep the Secret outside source control. Apply the manifest.
  4. Add an HTTPS ingress using your own hostname and certificate. No public hostname, certificate issuer, cluster address, or storage class is hard-coded.
  5. Open the iPhone app, enter the monitor URL and raw access token, and Connect.

The container build runs all service tests on the actual Alpine/Node runtime, then copies only production modules into the final non-root image. Container CI also checks module loading, SQLite, and the default paused preference as that non-root user. Builds record the source revision in OCI image labels.

Maintainers can run Publish service image from main after adding REGISTRY_USERNAME and REGISTRY_TOKEN to this repository's Actions secrets. The token needs Forgejo write:package authority for the MilesSystems image; repository-write authority alone does not grant registry publishing. Use a dedicated registry identity with only the needed package access. Never commit or paste the raw token into an issue, PR, or workflow file. Publishing is manual and never runs on pull requests. Images use the full source SHA as their tag; deploy the returned manifest digest to pin the exact built image. This workflow publishes source-derived service code only, without cluster credentials, Apple keys, or phone registrations.

The service uses one 1 GiB PVC for SQLite history. Keep one replica and the Recreate strategy; back up the SQLite database with its WAL consistently before storage changes. No cluster objects are modified by the service. Its RBAC reads node/pod status and metrics, warning events, Deployments/StatefulSets/DaemonSets, PVCs, KubeVirt VMs, Rancher cluster health, Longhorn volumes/nodes/replicas, Harvester add-ons and VM backups. It cannot read Secrets, pod environment values, ConfigMaps, container logs, or exec into containers. It cannot create, patch, delete, or restart workloads.

Liveness /healthz means the process responds, not that the cluster is healthy. The app shows each source's availability, check time, and stale data. A source failure or truncated list preserves incidents and never fabricates recovery. Kubernetes Warning events are history, not permanently open incidents. Deliberately halted VMs are not treated as failures. Node CPU and memory usage come from the Kubernetes metrics API and are shown separately from pod requests, declared limits, and allocatable capacity. Missing limits are unbounded; their sum is not a ceiling. Temperature remains unavailable. Source failures clear measured usage and preserve resource history with a visible warning. Server-sent events update the foreground app after collection and incident/preference changes, without a phone polling loop. The app reconnects on foreground or pull-to-refresh after a stream disconnect.

Rancher, Longhorn, Grafana and Prometheus

The Overview links to native searchable resource lists with namespace and needs-attention filters. Resource details contain diagnostic state, node placement, controller readiness, pod restarts, volume/PVC relationships, replica state, disk physical capacity/free space versus scheduled provisioned space, and backup state. The current inventory covers one connected Kubernetes API. Rancher managed clusters are listed with their ready/connected conditions; the service does not recursively connect to downstream clusters or perform Rancher administrative mutations.

Set PROMETHEUS_URL for native last-hour CPU, memory, and network charts and current Prometheus rules. Set GRAFANA_URL for database health and dashboard search. Use a Grafana Viewer service-account token in GRAFANA_TOKEN_FILE when required. Set GRAFANA_PUBLIC_URL for dashboard links the phone can open in its system browser. Charts remain native; dashboard layouts are opened in Grafana. No dashboard JavaScript or embedded webview runs inside the app. Set the other *_PUBLIC_URL variables for optional full Harvester/Rancher/Longhorn console links. These URLs must be HTTPS, with no user credentials or query strings.

Integration credentials stay in mounted files on the service, never in snapshots or on the phone. Upstreams accept HTTPS with certificate verification or explicitly configured internal .svc/loopback HTTP; redirects are rejected. Custom CAs are supported with the corresponding *_CA_FILE variable. Queries are fixed on the service; the phone cannot turn it into an arbitrary Prometheus or HTTP proxy.

Optionally set ALERTMANAGER_URL to read active, silenced, and inhibited alerts without modifying existing receivers or SMS routes. Silenced/inhibited alerts remain suppressed. Prometheus rule lists never generate push directly, because that would bypass Alertmanager policy. Webhook ingestion is still supported; polling and webhooks share the same fingerprint/start-time identity. Prefer one authoritative Alertmanager for each monitor installation.

Build the iPhone app

Requires Xcode with an iOS 17+ SDK. Open ios/HarvesterMonitor.xcodeproj and choose your own Apple signing team. No developer account identifier is checked in.

python3 ios/Scripts/generate_project.py
xcodebuild -project ios/HarvesterMonitor.xcodeproj -scheme HarvesterMonitor \
  -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build \
  CODE_SIGN_IDENTITY=- build

The simulator can connect to a monitor on http://127.0.0.1:8789 in Debug builds. Physical devices need their own install through Xcode pairing or TestFlight. Wireless installation works with an available paired developer connection. There is no webview and no external app client such as Expo.

Optional push

Push preferences start off, including after deployment. Viewing telemetry does not require APNs. To enable push, supply a push-capable Apple Developer team and APNs .p8 key on the service through APNS_TEAM_ID, APNS_KEY_ID, APNS_KEY_FILE, and APNS_TOPIC. Use your app's bundle ID as the topic. Apple Personal Teams do not support the Push Notifications capability.

Build with MONITOR_PUSH_ENTITLEMENTS=HarvesterMonitor/Monitor.entitlements MONITOR_PUSH_CAPABLE=YES after configuring your signing team/provisioning. Debug uses sandbox APNs; Release uses production APNs. Then explicitly enable push in the app and grant iOS permission. Only recent unacknowledged open incidents are eligible; critical-only is the default. Global pause and target snoozes are honored before each send. Delivery attempts and deduplication receipts persist across restarts. Invalid devices are revoked. Disconnect revokes that phone's registration before forgetting its token. Settings shows server key readiness, this build's push capability, iOS permission, phone registration/environment, and the last delivery attempt. Turning push on requests permission first; denial never enables the server preference. A critical escalation creates a new delivery opportunity while preserving original history.

After opting in, use Send a test to this iPhone. It only targets that registered phone, requires unpaused preferences, and is limited to once per minute. It does not create a fake cluster incident, change alert routing, or enable notifications. "Accepted by Apple" is an APNs response, not proof of a visible banner. Confirm the banner and tap it: real incident notifications open the incident; test notifications record their receipt in Settings. Check Focus, notification settings, bundle topic, APNs environment, and provisioning if no banner appears. A real-device test with a paid team and APNs key is required before claiming push works on a physical iPhone.

APNs receives the alert title and a bounded summary. Keep secrets out of alert messages. Delivery uses at most 20 attempts per cycle and three attempts per device/incident, with backoff. The operator decides whether to enable it.

Events and Alertmanager

POST /v1/monitor/events accepts eventKey, title, summary, target, severity (critical, warning, info) and status (open, resolved, event). Send the same stable eventKey to update/resolve a custom event. Supply a bearer access or producer token in the Authorization header. Do not include real credentials in event messages or commit sample production events.

Alertmanager can POST its standard webhook to /v1/webhooks/alertmanager, using the producer bearer token, with send_resolved: true. Configure a new optional receiver; do not replace existing alert routing. Partial webhook groups update only their listed alerts. Silence/suppression must be applied in Alertmanager.

Limits and operations

  • Snapshots contain up to 100 open incidents and 100 history entries; search filters this snapshot. Node/VM/volume lists are bounded at 2,000 objects per source.
  • Collection runs every 30 seconds. APNs never blocks telemetry collection.
  • SQLite history is retained until explicitly maintained; monitor PVC free space.
  • For whole-cluster outage alerts, run this service outside the cluster's failure domain, using the external Kubernetes URL, CA and a read-only service-account token file. After a successful connection, three consecutive failed node API reads create a critical cluster-API incident. A successful read resolves it. An in-cluster instance cannot report its own total power/network loss. Running outside the cluster does not protect against loss of that external host or its internet connection; independent host monitoring is still the operator's job.
  • No destructive infrastructure controls, SMS, metrics fabrication, or cluster credentials on the phone.
  • There is no App Store/TestFlight release yet. Physical push delivery must be tested with the operator's team, provisioning, device and APNs configuration.

Contributions: use a scoped branch and pull request, run npm test, and build the native app for Swift changes. See SECURITY.md for reporting issues.

License and references

Apache License 2.0, copyright Miles Systems. All source in this repository is provided under that license; third-party trademarks remain with their owners.