chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.5.0 Latest 5 packages
0
0
Each push to main deploys hud.place
.knotless/workflows/deploy.ymlnew+68−0
| @@ -0,0 +1,68 @@ | ||
# Deploys main to hud.place on each push, on the grain box, where HUD runs | ||
# as the compose project /etc/hud (hetzner-infra's services/hud). | ||
# | ||
# A pull lands on main only through the merge queue, whose batch runs every | ||
# check on the tree that lands, so this does not wait for main's own checks. | ||
# It couldn't: they are runner.knotless.dev's, which `after` does not see | ||
# from another runner, and a step can't read a private repository's checks. | ||
# | ||
# This run reaches the box with HUD_DEPLOY_KEY, a key the box takes only for | ||
# its forced command, hud-deploy (hetzner-infra's services/hud/hud-deploy.sh), | ||
# which can build HUD from an archive, bring a build up, or drop one, and | ||
# nothing else. The key is sealed to ci.knotless.dev, the runner that runs | ||
# only its owner's repositories, for pushes to main alone, so no other run | ||
# sees it. | ||
# | ||
# The commit is built on the box as hud:build-<commit>, beside what serves, | ||
# with the cargo cache the Dockerfile mounts. It then goes up: the running | ||
# image is kept as hud:before to roll back to, the candidate becomes | ||
# hud:current, and hud.place must answer /_health through the proxy. | ||
# Deploys run one at a time, in the order main moved (superseded: finish), | ||
# so none is cut off halfway and an older commit never goes up after a | ||
# newer one. | ||
on: | ||
push: | ||
refs: [refs/heads/main] | ||
superseded: finish | ||
runners: [ci.knotless.dev] | ||
image: alpine:3.22 | ||
secrets: [HUD_DEPLOY_KEY] | ||
env: | ||
# The grain box, which serves hud.place. | ||
HUD_BOX: root@167.233.237.163 | ||
HUD_URL: https://hud.place | ||
steps: | ||
- name: tools | ||
run: | | ||
apk add --no-cache curl git openssh-client >/dev/null | ||
# The box's forced command, given what to do and this commit. | ||
cat > /usr/local/bin/box <<'EOF' | ||
#!/bin/sh | ||
exec ssh -o ServerAliveInterval=30 "$HUD_BOX" "$1 $KNOTLESS_RUN_SHA" | ||
EOF | ||
chmod +x /usr/local/bin/box | ||
# The box's host key, as hetzner-infra's ci/known_hosts pins it. | ||
- uses: chadtmiller.com/steps/ssh-key@1 | ||
name: key | ||
with: {known-hosts: "167.233.237.163 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINaUk4YyxTjCsPg1XOsCIJiB1NlEakc9/tnS+QeYRRNQ"} | ||
secrets: {SSH_KEY: HUD_DEPLOY_KEY} | ||
- name: build | ||
# A build with a cold cargo cache compiles every dependency. | ||
timeout: 45 | ||
run: | | ||
git config --global --add safe.directory "$PWD" | ||
git archive --format=tar "$KNOTLESS_RUN_SHA" | box build | ||
- name: deploy | ||
run: | | ||
box up | ||
.knotless/workflows/deploy.ymlline 57Can't tell from here whether steps run with | ||
# As the network reaches it, through the proxy, which holds requests | ||
# for a moment while the container is replaced. | ||
for i in $(seq 30); do | ||
health=$(curl -fsS "$HUD_URL/_health" || true) | ||
[ "$health" != ok ] || { echo "$HUD_URL is up at $KNOTLESS_RUN_SHA"; exit 0; } | ||
sleep 2 | ||
done | ||
echo "$HUD_URL does not answer /_health: ${health:-no answer}" | ||
echo "the box runs hud:current at this commit, but it is not healthy;" | ||
echo "to roll back: docker tag hud:before hud:current, then docker compose up -d in /etc/hud" | ||
exit 1 | ||
.knotless/uses.lock+4−0
| @@ -11,3 +11,7 @@ chadtmiller.com/steps/rust-lint@1: | ||
version: 1.0.0 | ||
commit: 686cdbb38978730bb1ba5d1c999967e48497ce15 | ||
release: at://did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.release/3mza7iq7tundv.zvxvlxa6fe7s4pnwsnmgmm63aj.sjjb7q6l3fsl3spvqsuzdoe73w | ||
chadtmiller.com/steps/ssh-key@1: | ||
version: 1.0.0 | ||
commit: 686cdbb38978730bb1ba5d1c999967e48497ce15 | ||
release: at://did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.release/3mza7iq7tundv.pfrqohjhiqrsu5ecw3khmnp2pv.sjjb7q6l3fsl3spvqsuzdoe73w | ||
docs/running.md+2−0
| @@ -46,6 +46,8 @@ Add `http://localhost:8787/mcp` to a host that reaches it. For a public deployme | ||
| ||
Build it with `just image` (`Dockerfile`). It runs `hud serve` as uid 10001 and keeps the cache on the volume `/data`, so sign-ins and canvases live there too. | ||
| ||
Each push to main deploys it to hud.place (`.knotless/workflows/deploy.yml`). The deploy builds the image on hud.place's box with a cargo cache that's kept between builds, so a deploy compiles only HUD's own crates. Then it swaps the container. The image it replaces stays as `hud:before`, so you can roll back with `docker tag hud:before hud:current` and `docker compose up -d` in `/etc/hud`. | ||
| ||
## The iOS app | ||
| ||
`just ios` makes the Xcode project, `ios/HUD.xcodeproj`, from `ios/project.yml`. A Debug build reaches `just serve` at http://localhost:8787 by default, and a Release build reaches https://hud.place. Either can be pointed elsewhere on Home. | ||
AGENTS.md+2−1
| @@ -117,7 +117,8 @@ versions in the root `Cargo.toml`'s `[workspace.dependencies]`. | ||
(`.knotless/workflows/`): `check`, `test` and `web` as the merge queue's | ||
pre-flights, `lexicons`, `docs`, `e2e` (`just e2e`) and `e2e-spaces` | ||
(`just e2e-spaces`). `main` takes pulls only through the merge queue, each | ||
once review.knotless.dev has reviewed its head. A workflow's shared | ||
once review.knotless.dev has reviewed its head, and each push to it | ||
deploys hud.place (`deploy`, on ci.knotless.dev). A workflow's shared | ||
steps are pinned in `.knotless/uses.lock` (`knotless workflow pin`). | ||
- A lexicon in `schemas/` follows the Lexicon Style Guide | ||
(https://atproto.com/guides/lexinomicon) and passes `just lex`: goat's | ||
Dockerfile+13−2
| @@ -1,3 +1,5 @@ | ||
# syntax=docker/dockerfile:1 | ||
| ||
# The server as a container image: `hud serve`, listening on every address | ||
# of the container's network, its lexicon cache on the volume /data, run as | ||
# a user of its own. HUD_PUBLIC_URL, the origin it is reached at, is the | ||
| @@ -27,7 +29,16 @@ COPY schemas schemas | ||
COPY views views | ||
COPY themes themes | ||
COPY --from=web /src/web/dist web/dist | ||
RUN cargo build --release --locked -p hud | ||
# The cache mounts keep the registry and the build between builds on the | ||
# same machine, as the deploy's on hud.place's box (.knotless/workflows/ | ||
# deploy.yml), so a build compiles HUD's crates and not their dependencies. | ||
# CARGO_BUILD_JOBS is how many jobs cargo runs, where the build shares a | ||
# machine that serves something else; unset, every core. | ||
ARG CARGO_BUILD_JOBS | ||
RUN --mount=type=cache,target=/usr/local/cargo/registry \ | ||
--mount=type=cache,target=/src/target \ | ||
cargo build --release --locked -p hud \ | ||
&& cp target/release/hud /usr/local/bin/hud | ||
| ||
FROM debian:trixie-slim | ||
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \ | ||
| @@ -35,7 +46,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates | ||
&& groupadd --system --gid 10001 hud \ | ||
&& useradd --system --uid 10001 --gid 10001 --home-dir /data --shell /usr/sbin/nologin hud \ | ||
&& mkdir /data && chown hud:hud /data | ||
COPY --from=build /src/target/release/hud /usr/local/bin/hud | ||
COPY --from=build /usr/local/bin/hud /usr/local/bin/hud | ||
USER hud | ||
# `::` takes IPv4 too on Linux. | ||
ENV HUD_PORT=8787 HUD_BIND=:: HUD_CACHE_DIR=/data | ||