Tunnels for your services, coorperatively coordinated over AT Protocol.

Offer a cloud-config for running your own Provider on Hetzner #23

Merged byjp.me
targeting main from provider-cloud-config
Merged opened by byjp.me
targeting main from provider-cloud-config

Adds a cloud-config that turns a new Hetzner server, from the Docker CE app, into a running, closed Provider that admits only its operator, and a way to fill it in on jetbridge.link.

  • web/static/provider.cloud-config.yaml, served as https://jetbridge.link/provider.cloud-config.yaml. It installs unbound (with cache-max-negative-ttl: 30, and checks that it validates DNSSEC), lets ufw in only 22, 80 and 443/tcp, turns off SSH passwords, makes the data directories, waits until the API hostname's A record resolves through 127.0.0.1 to the server's own IPv4 address, runs init --api-host --abuse-contact --operator, then starts the runbook's compose file from /opt/jetbridge. While it waits, it logs which name to point at which address. The three values sit in one block near the top, written to /opt/jetbridge/setup.conf; the script reads them with sed and only ever quotes them, so nothing typed there reaches the shell.
  • /providers gets a small Build your own link under the table. It opens a native <dialog> that asks for the three values and fills them into the same file (imported with ?raw), to copy or download. The fill-in logic is web/src/lib/cloudconfig.ts, which refuses any value with whitespace or control characters, since those could end its line in the YAML.
  • Copy.svelte's accessible name is now just its label, so a whole file isn't read aloud; Cmd.svelte adds the command to its label instead.
  • A pointer in the runbook's Install and run, and a line in AGENTS.md saying the template's key= lines must stay empty.
  • It pulls the Provider image from seamark.cr/byjp.me/jetbridge-provider, which serves it without a login, as docker-client.sh already does for the client. The runbook, README and AGENTS.md name seamark.cr for pulling too, since atcr.io's token endpoint refuses anonymous pulls; releases still push to atcr.io. JET-j9bi, which tracked that, is scrapped.

For you to review: the prose #

The cloud-config's comments #

#cloud-config
#
# A Jetbridge Provider on a new Hetzner Cloud server. It starts closed, so it
# admits only you.
#
# 1. Fill in the three values under write_files, below.
# 2. In Hetzner's Cloud Console, create a server from the Docker CE app. Any
#    type will do; cax11 is plenty. Choose your SSH key, and paste this file
#    into Cloud config. Or, with the hcloud CLI:
#
#      hcloud server create --name jetbridge --image docker-ce --type cax11 \
#        --ssh-key <your key> --user-data-from-file provider.cloud-config.yaml
#
# 3. Point your API hostname's A record at the new server's IPv4 address, and
#    its AAAA record, if it has one, at the server's IPv6 address. The Provider
#    publishes both. Setup waits for the A record, then finishes by itself.
#
# To watch it, ssh root@<the server's address> and run:
#
#   cloud-init status --wait
#   tail -f /var/log/cloud-init-output.log
#   docker logs -f jetbridge-provider
#
# Back up /var/lib/jetbridge-provider. Its pds/ directory holds the Provider's
# signing key, which is its identity. The runbook says how, and how to run it:
# https://tangled.org/byjp.me/jetbridge/blob/main/docs/provider-runbook.md


  # Fill in each value after its =
  - path: /opt/jetbridge/setup.conf
    content: |
      # The hostname for your Provider's API, such as provider.example.com
      api_host=
      # An email address or URL for abuse reports, which you must read and answer
      abuse_contact=
      # Your atproto handle or DID. The Provider admits only this account.
      operator=

The script's own comments:

# Values are read as text and only ever quoted, never run.
# Ubuntu's unbound validates DNSSEC and listens on 127.0.0.1.

What it logs (each prefixed jetbridge: ):

api_host, abuse_contact and operator must all be filled in
the resolver on 127.0.0.1 doesn't validate DNSSEC
this server has no IPv4 address
point $host's A record at $ip; checking again in 30 seconds
started; follow it with: docker logs -f jetbridge-provider

The dialog #

  • Link on /providers: Build your own
  • Heading: Build your own Provider
  • Fields (label, then placeholder):
    • API hostname, provider.example.com
    • Abuse contact, abuse@example.com or a URL
    • Operator, you.bsky.social or a DID
  • File row: provider.cloud-config.yaml, a Copy button (accessible name "Copy provider.cloud-config.yaml") and Download. Both stay disabled until every field is valid; an invalid field's label turns red.
  • Steps, numbered in red:
    1. Create a Hetzner server from the Docker CE app, with this as its Cloud config.
    2. Point the API hostname at the server.

The runbook (Install and run) #

On Hetzner Cloud, a cloud-config can do all of this, with unbound and a firewall, when you create the server. Build it on jetbridge.link's Providers page, or fill in the file yourself.

Where the images are pulled from #

The runbook (docker run ... init, the compose file's image:, evidence verify, and the sentence "The image seamark.cr/byjp.me/jetbridge-provider runs as uid 65532:") and the README's docker run for the client now name seamark.cr/byjp.me/jetbridge-provider and -client, with no other wording changed.

AGENTS.md's one-time-setup paragraph now says:

CI pushes the images to atcr.io/byjp.me/jetbridge-provider and atcr.io/byjp.me/jetbridge-client (IMAGE_NAMESPACE); atcr.io stores their layers on the account's default hold, JP's atcr.byjp.me, but requires a login to pull. People pull seamark.cr/byjp.me/jetbridge-provider and seamark.cr/byjp.me/jetbridge-client instead, which serve the same images without one. If they move to another registry, change IMAGE_NAMESPACE and the image names in docs/provider-runbook.md, the README, web/static/provider.cloud-config.yaml and web/static/docker-client.sh.

Commits 2

Offer a cloud-config for running your own Provider on Hetzner
Note that atcr.io refuses anonymous pulls of the images
Sign up or Sign in to add to the discussion.