Serves the React UI and HTTP API on the LAN. Design details: README.md.

Prerequisites

  • Raspberry Pi OS with Python 3
  • Redis running locally
  • Temperature daemon (hot-tub-temps) and control daemon (hot-tub-control) recommended for live data
  • Built frontend at src/web/frontend/dist/ (committed in the repo, or build on a dev machine with Node.js)

1. Install service

From the hot-tub repository on the Pi:

cd /path/to/hot-tub
sudo deploy/web/install.sh

Optional fixed install root:

sudo INSTALL_ROOT=/opt/hot-tub deploy/web/install.sh

The script installs python3-redis, python3-flask, creates /etc/hot-tub/web.json, installs systemd unit hot-tub-web, and logrotate for /var/log/hot-tub/web.log. The service is enabled on boot.

Install order: Redis → hot-tub-temps → hot-tub-control → hot-tub-web.

2. Configure

Edit /etc/hot-tub/web.json if needed:

Key Default Purpose
bind_host 0.0.0.0 Listen address (LAN)
bind_port 8080 HTTP port
redis_url redis://127.0.0.1:6379/0 Local Redis only
static_dir path to frontend/dist Built React app
stale_s 15 Upstream snapshot age for degraded health

3. Verify

systemctl status hot-tub-web
tail -f /var/log/hot-tub/web.log
curl -s http://localhost:8080/api/status | python3 -m json.tool
curl -N http://localhost:8080/api/events
redis-cli GET health:web

From a phone on Wi‑Fi: http://<pi-ip>:8080/

4. Development (off the Pi)

Build the UI when changing frontend code:

cd src/web/frontend
npm install
npm run dev    # Vite dev server; proxies /api to :8080
npm run build  # output: dist/

Run the Python service locally:

cd src
PYTHONPATH=. python3 -m web --config web/config.example.json -v

Stack test without hardware: local Redis, temp_sim, python3 -m control --no-gpio, and python3 -m web.

5. Disable / remove

sudo systemctl disable --now hot-tub-web
sudo rm /etc/systemd/system/hot-tub-web.service
sudo systemctl daemon-reload

File locations

Path Purpose
/etc/hot-tub/web.json Service config
/var/log/hot-tub/web.log Application log
src/web/frontend/dist/ Static UI served at /