Skip to content

Port newer dashboard from sean-michael.dev; serve under /tides; push to Docker Hub - #2

Merged
Sean-Michael merged 2 commits into
mainfrom
port-site-tides
Oct 18, 2026
Merged

Sean-Michael merged 2 commits into
mainfrom
port-site-tides

Conversation

@Sean-Michael

Copy link
Copy Markdown
Owner

The copy of the dashboard embedded in sean-michael.dev kept evolving after this repo's last commit (May 27). The site is being stripped down to a plain blog, so this brings those changes back here and makes BTO the one source of truth, deployed as its own container behind the site's Traefik.

What changed

Frontend

  • Mobile app layout (src/mobile/, styles/mobile.css) and the drag-to-zoom InteractiveChart, plus the newer Charts / FocusPanel / Sidebar / styles.
  • Fixed react-hooks lint errors in the ported code without changing behavior: the drag band read a ref during render (now mirrored in state), zoom reset used setState in an effect (zoom now remembers which range it was made in), and the retry callback referenced itself before declaration.
  • Background image now comes from BTO's own public/ instead of the main site's /static/images/.

Backend

  • Stale-if-error NOAA cache with retries: if NOAA is down, serve the last good data.
  • /bootstrap drops a failing station instead of failing the whole dashboard (502 only if every station fails).

Paths: everything lives under /tides so it can share the domain with the main site

  • UI at /tides (Vite base: '/tides/'), assets at /tides/assets, public files (favicon, background) under /tides/.
  • API at /api/tides/* (bootstrap, stations, health). / redirects to /tides.
  • index.html is served no-cache; anything outside /tides and /api/tides 404s (the main site owns it).

CI

  • New push job: after backend, frontend, and the image scan pass on main, publishes <dockerhub user>/bto:latest (+ sha tag). Needs repo secrets DOCKERHUB_USERNAME and DOCKERHUB_TOKEN.

Testing

  • Backend: 21 tests pass (new coverage for path prefix, public files, path traversal, failed-station handling, stale-if-error); ruff clean.
  • Frontend: eslint clean, 6 vitest tests pass, build emits /tides/-prefixed assets.
  • Built the prod Docker image and checked it in a browser: desktop and mobile layouts load live NOAA data with no console errors, drag-to-zoom works, and changing the range clears the zoom.

Deploy (after merge)

  1. Add DOCKERHUB_USERNAME / DOCKERHUB_TOKEN secrets to this repo.
  2. On the EC2 box, add to /opt/app/.env:
    COMPOSE_PROFILES=tides
    TIDES_IMAGE=<dockerhub user>/bto:latest
    
    The tides service and Traefik routes are already in Sean-Michael.dev's docker-compose.yaml.

🤖 Generated with Claude Code

…to Docker Hub

The copy embedded in the site kept evolving after this repo's last commit.
Bring those changes back here so BTO is the one source of truth again:

- Frontend: mobile app layout, drag-to-zoom InteractiveChart, updated
  Charts/FocusPanel/Sidebar and styles. Fixed react-hooks lint errors in
  the ported code (refs read during render, setState in effect, self-
  referencing retry callback) without changing behavior.
- Backend: stale-if-error NOAA cache with retries; bootstrap drops a
  failing station instead of failing the whole dashboard.
- Paths: UI at /tides (Vite base), API at /api/tides, / redirects to /tides,
  public files (favicon, background) served under /tides.
- CI: push <dockerhub user>/bto:latest after tests and image scan on main.
- backend: anyio 4.14.2, starlette 1.8.0, urllib3 2.8.0, pydantic-settings
  2.16.0, zeep 4.3.3, with floors in pyproject so they can't regress.
- frontend: refresh lockfile within existing ranges (vite 8.3.4, undici,
  brace-expansion, nanoid, postcss, browserslist, source-map-js).
- frontend-dev image: npm vendors stale undici/brace-expansion even at its
  latest release, so remove npm after `npm ci` and run Vite with node.

All three images scan clean at --fail-on high --only-fixed locally.
@Sean-Michael
Sean-Michael merged commit ddcd2b3 into main Oct 18, 2026
7 checks passed
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