No description
  • Erlang 92.7%
  • Python 5%
  • Dockerfile 1.4%
  • Shell 0.9%
Find a file
2026-11-24 01:12:59 +01:00
.github ci: call the C4 gate that reads the front page 2026-10-23 21:09:31 +02:00
apps start.sh: write the cookie through a temp file at 0600 and refuse an empty one (review note c) 2026-11-23 16:08:27 +01:00
architecture docs: the model and the floors test carry macula 18 / mcl_om 1.6 2026-10-30 15:21:47 +01:00
assets docs: the model and the floors test carry macula 18 / mcl_om 1.6 2026-10-30 15:21:47 +01:00
config Distribution and epmd on loopback, and no cookie in any shipped file (mcl-tube#1) 2026-11-23 15:11:06 +01:00
deploy Distribution and epmd on loopback, and no cookie in any shipped file (mcl-tube#1) 2026-11-23 15:11:06 +01:00
scripts start.sh: write the cookie through a temp file at 0600 and refuse an empty one (review note c) 2026-11-23 16:08:27 +01:00
security/fovea security: operate.confidentiality is assessed, a retracted clip is unservable (#9) 2026-10-07 15:25:11 +02:00
.gitignore scaffold: rebar3 new mcl_service store=1 2026-09-23 14:06:14 +02:00
.tool-versions build: mcl_om 0.27 and the team image pair; tests leave the release; dialyzer clean 2026-09-24 02:38:25 +02:00
CHANGELOG.md build: 0.6.0, macula 18 and mcl_om 1.6 (mcl-om#42) 2026-10-30 15:06:09 +01:00
Containerfile Distribution and epmd on loopback, and no cookie in any shipped file (mcl-tube#1) 2026-11-23 15:11:06 +01:00
LICENSE scaffold: rebar3 new mcl_service store=1 2026-09-23 14:06:14 +02:00
README.md README: drop the GitHub Sponsors badge, add the Buy Me a Coffee badge 2026-11-23 22:20:50 +00:00
rebar.config build: 0.6.0, macula 18 and mcl_om 1.6 (mcl-om#42) 2026-10-30 15:06:09 +01:00
SECURITY.md SECURITY.md: response times, attachment and identity rules, drills (macula-io/macula#174) 2026-10-31 02:59:47 +01:00

mcl-tube

CI License ghcr.io BEAM Buy Me a Coffee

Macula

Video channels over the mesh: owners publish clips, anyone looks them up and streams them.


This exists so a channel owner can publish video from their own box and anyone on the mesh can find it and watch it, with no platform in between.

Status

Runs on macula 18 through mcl_om 1.6, and opens its own reckon-db store (mcl_tube_store). Its advertisements name an ML-KEM key and every procedure of its own requires a sealed caller: lookups and the watch stream are sealed end to end, and a caller that does not seal is refused with sealed_required. Every macula SDK seals by default.

What it does

  • An owner creates a channel, uploads clips (each is scanned before it can be published), publishes, retracts and archives them, through a web UI served locally by the service.
  • Anyone on the mesh looks a channel, a clip or a piece of content (a thumbnail, a logo) up, and streams a published clip, over four procedures of its own.
  • The catalog is announced on four facts, so a catalogue (the portal's) can list channels and clips without asking.

Four apps, one per department:

App Department What it holds
guide_tube_lifecycle CMD the channel and clip lifecycles, event sourced, and the catalog announcements
project_tube PRJ the read model, in memory, rebuilt from the store at boot
query_tube QRY the lookups and the watch stream
mcl_tube service the owner web UI and the mcl_om contract

The contract

Procedures

Served under the org mcl-tube, so callers dial mcl-tube/<name>:

Procedure Kind Answers
mcl-tube/lookup_channel request/reply a channel's current details
mcl-tube/lookup_video_clip request/reply a clip's details
mcl-tube/lookup_content request/reply a published clip's thumbnail or a channel's logo, by mcid
mcl-tube/watch_video_clip stream a published clip's bytes

A retracted or archived clip is unservable on every path: its lookup and its thumbnail answer not_found, a new stream is refused, and a stream already open ends with a stream error at the next chunk. Its listing is withdrawn with video_clip_retracted_v1, and every published clip is re-announced at least every 5 minutes, so a catalogue can expire a listing nobody re-announced instead of trusting one withdraw fact to arrive.

Facts

Canonical macula app facts in io.macula/mcl-tube/tube/catalog/:

Topic When
channel_announced_v1 a channel was created or reconfigured, and on a heartbeat
video_clip_published_v1 a clip became visible
video_clip_retracted_v1 a clip was retracted or archived
video_clip_viewed_v1 a clip was watched to the end, once per view

Text fields (names, descriptions, owners, tags) are sent as CBOR text, so every stack reads them as strings; ids and mcids stay bytes. Channel and clip announcements are upserts by id, safe to receive twice. A view is announced exactly once, live, when it is recorded, because a consumer counts views by fact.

Both lists are pinned by tests (mcl_tube_service_tests, tube_catalog_topic_tests). A change is a new name, not an edit.

Like every mcl service, it also answers the open procedures mcl_om adds: mcl-tube/info gives its name, version and description, its org and claim labels, node id, the macula and mcl_om versions, uptime, the health word and the procedures it advertises; mcl-tube/get_limits gives the inbound guard's limits and current-window stats. Open to any mesh caller, public facts only.

Configuration

Variable Default Meaning
MCL_REALM required 64-hex realm tag, sha256 of the realm name
MCL_REALM_NAME required the realm name the catalog topics carry, e.g. io.macula. The service refuses to start unless its sha256 is MCL_REALM
MCL_REALM_KEY required the realm's public signing key, hex
MACULA_STATION_SEEDS required station hosts, host[:port], comma-separated
MACULA_STATION_NODE_IDS required the matching 64-hex station node ids
MCL_TUBE_HTTP_PORT 8491 the owner web UI
MCL_TUBE_HTTP_IP 127.0.0.1 where the owner web UI binds. It has no authentication of its own, and the container runs on host networking: the image default is loopback (reach it over an SSH tunnel, and widen only knowingly) — the dev fleet's compose overrides it to 0.0.0.0 (LAN), see macula-fleet PORTS.md
MCL_DATA /bulk0/mcl-tube (compose) host directory for the store, the clips and the content cache
MCL_SERVICE_NAME mcl-tube label on the boot claim the realm's operator sees on the Providers desk
MCL_BOX unset label naming the host, also on the boot claim; set it where you deploy

Deploy

What an operator does, in order:

  1. Set MCL_REALM and MCL_REALM_NAME, and mount the data directory on a bulk drive. deploy/docker-compose.yml also mounts the named identity volume mcl-tube-secrets; keep it, because the next step is tied to it.
  2. Have the realm grant this node its provider authorization. Serving an org-namespaced procedure needs a realm-issued grant (D25) naming this node's id, and a person admits it on the realm. Until then the realm has not authorized this node, calls resolve to nothing, and /health is degraded, naming the procedures still missing an authorization under provider_grants. A new identity is a new, unadmitted node.
  3. Reach the owner UI over a tunnel: ssh -L 8491:127.0.0.1:8491 <box>, then browse to http://localhost:8491/.

Health

/health answers whether callers can reach the service. mcl_om reports the procedures the realm has not granted this node a provider authorization for: degraded at once when no delegation names this node (an operator has to grant it), after a 60 s grace window for any other refusal, so a lookup that fails once does not flap.

Build and test

rebar3 eunit
rebar3 lint

OTP 28.4.3, pinned in .tool-versions, the Containerfile and CI, and a test fails when they disagree with the VM running it. The image builds in the team's ghcr.io/macula-io/macula-ci-otp and runs on ghcr.io/macula-io/macula-pq-runtime (Debian trixie, OpenSSL with ML-DSA), with ffmpeg added, both pinned by dated tag and digest; CI runs in the same build image.

Architecture

The C4 model is in architecture/README.md, with its diagrams drawn by architecture/c4_diagrams.py into assets/. Change the script, run it (python3 architecture/c4_diagrams.py), and look at the result before committing.

mcl-tube system context

License

Apache-2.0. See LICENSE.