Files
meshexplorer/.env.example
T
Alex Vanderpot a72c64a008 region system: derive IATA region codes from MQTT topics
Replace hardcoded (broker, topic) region slugs with uppercase IATA codes
derived from the meshcore/{IATA} base topic, discovered dynamically from
data (adding a region needs no code change). Adds region groups, Grafana
region/group filtering, and fixes the neighbor graph.

- regions.ts: single source of truth — regionFromTopic / normalizeRegion /
  regionSql / resolveSelector / selectorLabel. Legacy slugs (seattle->SEA)
  and bare meshcore + meshcore/salish -> SEA still resolve.
- regionGroups.ts + seeded region_groups table: PNW/CAL/DEU/POL.
- migration 004: region ALIAS column on meshcore_packets; 001 views expose
  region / regions[]; reworked neighbor MV (region-scoped, no cross-region
  edges, drops implausible >150km and (0,0) edges); scheduled meshcore_regions MV.
- API/streaming/actions resolve selectors; stream routes drop the hardcoded
  region allow-lists; map node query excludes (0,0) sentinel nodes.
- Dynamic region/group dropdowns (useRegions/RegionSelect); /api/regions.
- Grafana: cascading $region / $region_group template vars + panel filters.
- region-parity.ts (npm run check:regions) guards TS<->SQL drift.
- nix dev shell (flake.nix, Node 24).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 15:20:00 -04:00

52 lines
3.1 KiB
Bash

# MeshExplorer unified stack configuration.
# Copy this file to .env and fill in the values, then run:
# docker compose up --build
# (add `--profile bot` to also start the Discord relay).
# ─── ClickHouse ──────────────────────────────────────────────────────────────
# The read/write "default" user is used by the ingest daemon and the migration
# runner. Set a real password before deploying.
CLICKHOUSE_DB=default
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=changeme
# Read-only user used by the web app and the Discord bot. This account is only
# reachable on the internal docker network; the default matches ingest/clickhouse/users.xml.
CLICKHOUSE_READONLY_USER=readonly
CLICKHOUSE_READONLY_PASSWORD=readonly
# ─── MeshCore MQTT ingest ────────────────────────────────────────────────────
# JSON array of MQTT brokers to subscribe to for meshcore packets. Each entry:
# { "url": "...", "username": "...", "password": "...", "topics": ["meshcore/#"] }
# "topics" is optional and defaults to ["meshcore/#"]. The ingest daemon exits
# with an error if this is empty, so configure at least one broker.
MQTT_BROKERS=[{"url":"tcp://mqtt.example.com:1883","username":"CHANGE_ME","password":"CHANGE_ME","topics":["meshcore/#"]}]
MQTT_CLIENT_ID=meshcore-ingest
# Staleness watchdog: if a broker reports connected but delivers no messages for
# this many seconds, the daemon forces a fresh reconnect + resubscribe. Guards
# against "zombie" connections that survive an upstream broker swap. Default 300.
MQTT_STALE_AFTER_SECONDS=300
# ─── Web app ─────────────────────────────────────────────────────────────────
# Base URL for client-side API calls. Leave empty to use relative URLs.
NEXT_PUBLIC_API_URL=
# ─── Discord relay bot (optional, --profile bot) ─────────────────────────────
# Required when running the bot. Create a webhook in your Discord server.
DISCORD_WEBHOOK_URL=
# Optional: post into a specific thread instead of the channel.
DISCORD_THREAD_ID=
# Region/group filter for messages: an IATA code (e.g. SEA, PDX, BOS) or a group code
# (e.g. PNW). Legacy slugs (seattle/portland/boston) are still accepted.
MESH_REGION=SEA
# Poll interval (ms) and batch size.
POLL_INTERVAL=300
MAX_ROWS_PER_POLL=50
# Comma-separated base64 private keys used to decrypt channel messages.
PRIVATE_KEYS=
# ─── Grafana ─────────────────────────────────────────────────────────────────
# Admin password for the bundled Grafana (published on 127.0.0.1:3000). A
# ClickHouse datasource is auto-provisioned using the read-only user above.
GRAFANA_ADMIN_PASSWORD=admin