Skip to content

feat: web dashboard, Docker, bilingual docs (v0.7.0)#8

Merged
devAsmodeus merged 7 commits intomainfrom
feat/web-and-docs
May 3, 2026
Merged

feat: web dashboard, Docker, bilingual docs (v0.7.0)#8
devAsmodeus merged 7 commits intomainfrom
feat/web-and-docs

Conversation

@devAsmodeus
Copy link
Copy Markdown
Owner

Summary

PR C of three. Adds a stdlib web dashboard, a Dockerised stack with
Prometheus + Grafana provisioning, and a bilingual (EN + RU) docs
overhaul. Pure stdlib, no new runtime dependencies.

  • Web dashboard — `webui.py` (stdlib `http.server`):
    `GET /` (single-page HTML, vanilla JS, inline-SVG sparkline, no CDN),
    `GET /api/stats` (JSON snapshot, `Cache-Control: no-store`),
    `GET /api/events` (Server-Sent Events for share / job / pool changes,
    keepalive every 15s), `GET /healthz`. New flags `--web-port` and
    `--web-host`. `StatsProvider` extended with `subscribe(callback)`.
  • Docker — `Dockerfile` (`python:3.11-slim`, healthcheck via stdlib
    `urllib`, no `curl` install), `docker-compose.yml` with miner +
    Prometheus + Grafana, provisioning files for both, `.dockerignore`.
  • Docs — `README.md` rewritten (EN top, RU bottom, mirrored
    sections), new `docs/{getting-started,deploy,architecture}.{en,ru}.md`,
    `docs/handoff/pr-c-summary.md` with file map and review checklist.
  • Version — `version = "0.7.0"`, CHANGELOG section,
    ROADMAP ticked (web, Docker) + new "remaining" list of explicitly
    punted items (Stratum V2, Rust/PyO3, GPU, FastAPI, Helm).

Tests: 225 → 242 (+17 in `test_webui.py`). All green on
`py -3.11 -m unittest discover -s tests -v`.

Test plan

  • `py -3.11 -m unittest discover -s tests -v` — 242 tests, all green.
  • `hope-hash --help` shows `--web-port` and `--web-host`.
  • `hope-hash --web-port 8001` exposes a working HTML page,
    live-updating `/api/stats`, and a streaming `/api/events`.
  • `docker build -t hope-hash:0.7.0 .` succeeds (Dockerfile is
    syntactically valid; image runs).
  • `BTC_ADDRESS=... docker compose up -d` brings up miner +
    Prometheus + Grafana; Grafana auto-loads the bundled dashboard.
  • README EN and RU halves match section-by-section.
  • All cross-links between `docs/*.{en,ru}.md` resolve.

Stack

  • PR A — `feat/ops-and-ux` (TUI, healthz, Telegram inbound, Grafana JSON).
  • PR B — `feat/perf-and-resilience` (multi-pool, solo, ctypes backend).
  • PR C — this PR — web + Docker + docs (v0.7.0).

```
🤖 Generated with Claude Code
```

@devAsmodeus devAsmodeus force-pushed the feat/perf-and-resilience branch from 0b8b85a to 660ab26 Compare May 2, 2026 19:36
@devAsmodeus devAsmodeus force-pushed the feat/web-and-docs branch from 1a46f90 to 76e7ec1 Compare May 2, 2026 19:37
Base automatically changed from feat/perf-and-resilience to main May 3, 2026 08:27
devAsmodeus and others added 7 commits May 3, 2026 11:28
Single-page HTML (vanilla JS, inline-SVG sparkline, no CDN), JSON
snapshot at /api/stats (no-store), Server-Sent Events at /api/events
covering share_found / share_accepted / share_rejected / job / pool,
and /healthz proxied through the same provider as MetricsServer.

StatsProvider extended with subscribe(callback) -> unsubscribe and
publish_event hook; update_job/record_share/update_pool now publish.
sha_backend tracked alongside the snapshot so the UI can show the
active backend next to the hashrate.

Tests: 17 new (StatsProvider pub/sub, render_html, HTML/JSON/SSE/healthz
endpoints, idempotent start/stop, lifecycle).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds --web-port (default 0 = off) and --web-host (default 127.0.0.1).
WebUIServer reuses the same _health_provider() callable as the metrics
server, so /healthz is consistent across both ports. StatsProvider is
constructed with the resolved sha_backend so /api/stats can show it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Dockerfile based on python:3.11-slim, healthcheck via stdlib urllib
(no curl install needed), ENTRYPOINT hope-hash. docker-compose.yml
brings up miner + Prometheus + Grafana with named volumes for state
and a bind-mount for the SQLite share journal.

Provisioning:
- deploy/prometheus/prometheus.yml — scrapes miner:8000/metrics every 15s.
- deploy/grafana/datasource.yml — Prometheus datasource at prometheus:9090.
- deploy/grafana/dashboard.yml — auto-loads the existing hope-hash.json.

.dockerignore strips git/tests/docs/db artifacts from build context.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Both halves mirror the same sections in the same order: tagline +
badges, what is this, status (v0.7.0), install, run, advanced flags
table, demo, benchmark, architecture, realistic expectations,
contributing pointers. Cross-links to docs/architecture.{en,ru}.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three docs x two languages, all parallel:
- getting-started — Python install, BTC address, first run, log walkthrough,
  common pitfalls (firewall, address format, pip on Windows, curses).
- deploy — docker compose walkthrough, Grafana login, Telegram setup,
  healthcheck, reverse-proxy snippet for SSE behind nginx.
- architecture — protocol summary, threading table, file map, hot path,
  observers, ctypes trade-off, solo caveats, BIP references.

Russian halves are written natively, not machine-translated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- __version__ = "0.7.0"; re-export WebUIServer + render_html.
- CHANGELOG [0.7.0] section listing webui, Docker, docs, tests delta.
- ROADMAP: tick web dashboard (stdlib http.server, not FastAPI) and
  Docker; add a "remaining" section for explicitly punted items
  (Stratum V2, Rust/PyO3, GPU, FastAPI, Helm, web write endpoints).
- docs/handoff/pr-c-summary.md with file map and review checklist.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@devAsmodeus devAsmodeus force-pushed the feat/web-and-docs branch from 76e7ec1 to 847d664 Compare May 3, 2026 08:29
@devAsmodeus devAsmodeus marked this pull request as ready for review May 3, 2026 10:03
@devAsmodeus devAsmodeus merged commit 7130106 into main May 3, 2026
10 checks passed
@devAsmodeus devAsmodeus deleted the feat/web-and-docs branch May 3, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant