~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/stream

jetstream v2 in zig · mirror of https://tangled.org/zat.dev/stream

0
0
68 lines · 2.8 KB Raw History
# strata

The public archive map at https://stream.waow.tech/strata/: namespaces as
spheres sized by archived event counts, with search, profile avatars, and
canvas pan/zoom. It is a static page; counts come from one summary snapshot of
[Strata](https://strata.zat.dev) taken at deploy time, so visitors make no
archive, summary, or profile API requests.

## service

The Cloudflare API, R2 snapshot reader, archive writer, and drain scripts live in
[`service/`](service/). The service was imported with its Git history from the
former local `zat.dev/strata` repository. This directory owns both the map and
its backing service; they deploy independently.

```sh
cd strata/service
npm ci
npm run check
npm run deploy
```

The Worker remains `strata` at `strata.zat.dev`, with its existing R2 buckets and
secrets. It no longer binds D1. HeavyPad reconciles footer counts in SQLite and
publishes only changed serving objects; see [snapshot architecture](service/docs/snapshots.md).
The hourly ingestion flow stays in `my-prefect-server/flows/strata.py` and
publishes snapshots instead of writing D1. The deployed drain stays at `/opt/strata` on
the Stream host: its binaries, progress file, and work directory are runtime
state, not repository files. Deploy script updates there without replacing
that state. See [service architecture](service/docs/how-it-works.md).

## deploy the map

```sh
cd strata && bun install     # once: pinned esbuild and @atcute/lexicons
just strata                  # from the repo root
```

`scripts/deploy-strata-preview` fetches the snapshot, bundles `app.js` with
d3 into one hashed script, writes gzip sidecars, uploads a release directory,
and atomically switches the `site/strata` symlink on the host. See
[docs/deploying.md](../docs/deploying.md#strata-playground) for the route,
caching, and rollback. `--output-dir <dir>` builds without publishing.

## local

`uv run strata/server.py` serves http://127.0.0.1:4179 with a live `/api/`
backed by Strata and, for historical sampling, the archive key from the sops
store. The key stays in the server process; the loopback server rejects other
hosts and origins.

## data and generated files

- `*-parser.js` are bundled from `*-schema.js`; `bun run parsers` rebuilds all
  three.
- `identity-catalog.json` maps namespaces to Bluesky profiles:
  `python3 strata/refresh-identities.py` (bounded batches, stops on HTTP errors).
- `storage-report.json` compares archive storage:
  `uv run strata/inspect-storage.py` (reads listings and indexes only).

Neither refresh runs on deploy.

## memory

Avatars decode at their natural size. Spheres and list swatches up to 128 px
use Bluesky's 128 px `avatar_thumbnail`; only larger spheres load the 1000 px
image. With the full image everywhere the page peaked above 700 MB in Mobile
Safari and got pages embedding it (after hours' TV) killed.