Keg docs

Self-host

Open source apps, run on your own node from a list. Experimental: turn it on with keg settings experimental on self-host (or Settings › Experimental), then open Self-host in the Mac app or the console (Containers mode), or use keg selfhost.

keg selfhost ls                      # what can be installed, and what is
keg selfhost install vaultwarden     # install it; again, to update it
keg selfhost install affine --set DB_PASSWORD=…   # with a setting of your own
keg selfhost rm vaultwarden          # remove it; its volumes stay
keg selfhost rm vaultwarden --delete-data

An installed app is a Compose project named after its id, so it is on the Compose page too. It opens at http://ID.keg.localhost (with the port names answer on, where that is not 80). Its recipe and its settings are in <node's root>/selfhost/ID/: compose.yaml and .env, the second readable by the node alone, since it holds the app's secrets.

Installed apps start again when the node does.

What is not there yet: backing an app's data up, and reaching it from another device.

A recipe

A recipe is one YAML file: a Compose file, with an x-keg block that says what the app is. Everything outside x-keg is ordinary Compose, so a recipe can be tried with any Compose (KEG_PORT=8080 KEG_URL=http://localhost:8080 docker compose up).

x-keg:
  recipe: 1                 # the form of recipe; 1 is the only one
  id: notes                 # 1 to 40 of a-z, 0-9 and '-': the project, the folder, the name
  name: Notes
  says: Notes of your own.  # one line, for the list
  category: Notes
  licence: MIT
  website: https://example.com
  version: "1"              # the recipe's own; a different one is offered as an update
  open: { service: web, path: / }   # the service whose page is opened
  needs_https: false        # true if it works fully only at an https address
  data: [data]              # the volumes that hold what a person made
  settings:
    - name: SECRET_KEY      # capitals, digits, '_'
      label: Its signing key
      kind: secret          # secret or text
      generate: true        # the node makes 32 characters if none is given
    - name: TITLE
      default: My notes
  after: |
    Said once it is installed.
services:
  web:
    image: example/notes:1
    environment:
      KEY: "${SECRET_KEY}"
      URL: "${KEG_URL}"
    volumes:
      - data:/data
    ports:
      - "${KEG_PORT}:8080"
volumes:
  data: {}

The node gives every recipe two variables: KEG_PORT, a free port on the node for the app's page, and KEG_URL, the address the app is opened at.

A recipe is refused, with the rule it breaks, unless:

A registry

A registry is a JSON file at an https:// address, with its recipes beside it:

{
  "keg_registry": 1,
  "name": "Example's apps",
  "apps": [
    { "id": "notes", "recipe": "notes.yaml", "sha256": "…" }
  ]
}

recipe is a path beside the index (letters, digits, -, _, . and /): a registry never sends a node to another server. sha256, if given, is checked. At most 200 apps. A recipe that breaks a rule is left out and said (keg selfhost registry ls), and the rest are listed.

keg selfhost registry add https://example.com/apps/index.json   # or to read it again
keg selfhost registry ls
keg selfhost registry rm https://example.com/apps/index.json

To publish one, keep the recipes in a folder, each file named for its id, and make the index from them:

Scripts/selfhost-registry.py out/ --name "Example's apps" --recipes my-recipes/

Put out/ on any https server. Without --recipes it is made from Keg's own, so the list Keg comes with can also be published and added to between releases.

A registry is fetched from public addresses only, and not at all on a node that reaches the outside through a proxy; a recipe can still be installed there from its file.

Keg's own registry is compiled into it (crates/kegd/src/selfhost/recipes/), so its list is there without a network. An id that Keg's own list has is Keg's: a registry cannot replace it.

A registry's apps are shown with what they run and keep before anything is installed, and marked as not Keg's own. Installing one runs its images on your node: add registries, and install recipes, of people you trust.

Keg's documentation. Something wrong or missing? Say so.