Stabilize Datum container networking

This commit is contained in:
Dorian
2026-05-09 16:26:18 +01:00
parent 7a85e805a7
commit 2bbb89c53f
4 changed files with 24 additions and 22 deletions

View File

@@ -13,11 +13,9 @@ LOG_LEVEL=info
# STATIC_DIR=
# ---- Datum gateway (the Umbrel app we're polling) ----
# Umbrel/Portainer stacks cannot reliably resolve Datum's container name.
# Use Datum's current IP on umbrel_main_network and refresh it if Umbrel
# recreates the Datum container:
# docker inspect -f '{{.NetworkSettings.Networks.umbrel_main_network.IPAddress}}' datum_datum_1
DATUM_URL=http://10.21.0.11:21000
# Use Docker DNS on umbrel_main_network so Datum can be recreated without
# changing a stale container IP.
DATUM_URL=http://datum_datum_1:21000
DATUM_ADMIN_USER=admin
DATUM_ADMIN_PASSWORD=
# How often to scrape /clients (ms). Datum updates per-worker hashrate every

View File

@@ -46,12 +46,13 @@ Allowlist of npubs is set via `NOSTR_ALLOWED_NPUBS`. Anything else is rejected b
- Repository URL: `https://git.tx1138.com/lfg2025/gashboard`
- Compose path: `docker-compose.yml`
- Add env vars (see `.env.example`)
- Set `DATUM_URL` to Datum's current container IP:
```bash
docker inspect -f '{{.NetworkSettings.Networks.umbrel_main_network.IPAddress}}' datum_datum_1
```
- Use it as `DATUM_URL=http://<that-ip>:21000`.
- If Datum/Umbrel recreates the container, refresh this IP in Portainer and redeploy.
- Remove any old `DATUM_URL=http://10.21...` value from the stack env vars.
Leave `DATUM_URL` unset unless your Datum container name is different. By
default the stack uses `http://datum_datum_1:21000` on Umbrel's
`umbrel_main_network`, so Datum can be recreated without changing a stale
IP address.
- If your Umbrel install uses a different Datum container name, set
`DATUM_URL=http://<container-name>:21000`.
4. Open the dashboard, log in with one of the allowed npubs, watch your boards lose at hashing in style.

View File

@@ -64,7 +64,7 @@ function formatErr(err: unknown): string {
const datumHost = new URL(config.datum.url).hostname;
const hint =
hostname === datumHost
? "; check DATUM_NETWORK or set DATUM_URL to a hostname/IP reachable from the gashboard API container"
? "; make sure gashboard is attached to Umbrel's Docker network or set DATUM_URL to a hostname/IP reachable from the API container"
: "";
return `${err.message}: DNS could not resolve ${hostname} (${code})${hint}`;
}

View File

@@ -1,10 +1,7 @@
version: "3.9"
# gashboard — deploy as a Portainer Stack on the same Umbrel host that runs Datum.
#
# Umbrel's Portainer setup cannot reliably resolve Umbrel app container names
# from repository stacks. Use host networking and point DATUM_URL at Datum's
# current container IP on umbrel_main_network.
# Join Umbrel's shared Docker network so the API can reach Datum by container
# DNS name instead of a changing container IP.
services:
gashboard:
@@ -24,10 +21,9 @@ services:
PORT: "1337"
LOG_LEVEL: "${LOG_LEVEL:-info}"
CORS_ORIGIN: "${CORS_ORIGIN:-}"
# Reach the Datum gateway container directly. Refresh this IP if Umbrel
# recreates Datum:
# docker inspect -f '{{.NetworkSettings.Networks.umbrel_main_network.IPAddress}}' datum_datum_1
DATUM_URL: "${DATUM_URL?must be set, e.g. http://10.21.0.11:21000}"
# Reach the Datum gateway container through Docker DNS on Umbrel's shared
# network. This avoids hard-coding Datum's changing container IP.
DATUM_URL: "${DATUM_URL:-http://datum_datum_1:21000}"
DATUM_ADMIN_USER: "${DATUM_ADMIN_USER:-admin}"
DATUM_ADMIN_PASSWORD: "${DATUM_ADMIN_PASSWORD?must be set}"
DATUM_POLL_INTERVAL_MS: "${DATUM_POLL_INTERVAL_MS:-5000}"
@@ -35,10 +31,17 @@ services:
NOSTR_ALLOWED_NPUBS: "${NOSTR_ALLOWED_NPUBS?must be set}"
JWT_SECRET: "${JWT_SECRET?must be set}"
JWT_TTL_SECONDS: "${JWT_TTL_SECONDS:-86400}"
network_mode: host
ports:
- "${PORT:-1337}:1337"
networks:
- umbrel_main_network
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:1337/healthz"]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
networks:
umbrel_main_network:
external: true