Skip to content
Viewing as a member

What it is

discord.sh. An Astro/Starlight site — the topsite’s directory, guides and dashboard — and the axum that serves the build output. One version and one image cover both, because a static site and the process handing it out have no separate lifecycle.

Layout

apps/discordsh/
web/ the Starlight site, builds static to web/dist
web/server/ discordsh-web, the axum that serves that dist
web/e2e/ Playwright, drives the pair
bot/ discordsh-bot, released on its own version

What the server does

Static files. ServeDir per asset prefix with brotli and gzip variants precompressed at image build time, directory requests rewritten to index.html, and Astro’s own 404.html served at a 404 status so a typo’d URL is not indexed as a page. /health for the kubelet and /version for anything that wants to know which release answered it.

The pages the build cannot know are written at request time from kbve-ballot’s public directory, when BALLOT_URL is set:

  • /s/{key} — a listing’s page, rendered into the Astro shell with its schema.org data, so neither a reader nor a crawler waits on a script.
  • /c/{id}/ — a category’s page with its top servers, cached for five minutes.
  • /sitemap-listings.xml — every live server and bot, cached for an hour.
  • discord.sh/<name> — a vanity name, redirected to its listing, and /<name>/join to its Discord invite.

When ballot is slow or down, each falls back to the page as built and the browser island asks again. The server links axum, tower-http and reqwest for those reads — and no database driver: a process that hands out HTML has no business holding one.

The API beside it

The site’s own calls — votes, bumps, listings, reviews, the owner dashboard — go same-origin to /api/v1/ballot/*, which the gateway sends to kbve-ballot (services/ballot). The rest of /api still goes to the discordsh StatefulSet running the old ghcr.io/kbve/discordsh image, built outside this workspace, and everything else comes here. See kube/discordsh/manifests/httproute.yaml.

Same-origin is why it is a route split rather than a second hostname: moving those calls elsewhere is a CORS conversation and a browser that has to be told about it. When the old image is retired, that file loses a rule.

Where the version shows up

One bump lands in three places that cannot disagree, because the build stamps them from this doc before it compiles anything:

  • the image tag
  • apps/discordsh/version.toml, which web/astro.config.mjs reads at build time and the site footer prints
  • web/server/Cargo.toml, which the binary reports at /version

Deploying

A bump to the version: in this doc’s frontmatter, on the default branch, is the release. The build reads it, stamps it into the files it compiles from, and publishes it as the tag; the deploy job then opens a merge request writing that tag into the manifest this doc names, and the manifest moves when it is merged.

version.toml is watched too, so sh tools/version-sync/sync.sh bump discordsh-web <version> works and writes both. See apps/discordsh/ci.yml and tools/version-sync.

The HTTPRoute is not part of that loop: it carries no image line, version-sync never touches it, and it changes once — at the cutover, and again when the API arrives.

Discuss on the forum

Questions, fixes and notes on this page live in the KBVE forum.