| 1 | # Steid |
| 2 | |
| 3 | A personal gitforge, in Rust. It hosts your repositories, and it is meant to become the |
| 4 | place your work as a whole lives — code, writing, projects — under one identity you |
| 5 | control. |
| 6 | |
| 7 | Steid is **portfolio-first**. Gitea and Forgejo are GitHub scaled down; their unit is the |
| 8 | repository and the profile is a directory listing bolted to the side. Steid inverts that: |
| 9 | the profile page at `/{handle}` is the product, and git repositories are one kind of |
| 10 | thing that appears on it. That framing wins every tie-break in the design. |
| 11 | |
| 12 | It runs as a single binary with a SQLite database, shells out to `git` for everything |
| 13 | git-shaped, and is small enough to host on the cheapest VPS you can find. |
| 14 | |
| 15 | ## What works today |
| 16 | |
| 17 | Honestly and only: |
| 18 | |
| 19 | - **Identity and sessions.** One user. The instance is claimed on first run with a setup |
| 20 | token, then you sign in with a password. There is no registration — see |
| 21 | [limitations](#current-limitations). |
| 22 | - **The profile page** at `/{handle}`, listing what you have. |
| 23 | - **Repositories.** Created through the browser, or imported by cloning a URL. Stored as |
| 24 | bare repos on disk and records in SQLite. Public or private, renameable, pinnable, |
| 25 | archivable, deletable, with a default branch you choose. |
| 26 | - **Clone and push over HTTPS**, through `git http-backend`, authenticated with personal |
| 27 | access tokens over HTTP Basic. Private repositories require a token to clone; public |
| 28 | ones are anonymous. |
| 29 | - **Personal access tokens** — issue with an expiry (30 days, 90, a year, or never), see |
| 30 | when each was last used, revoke, at `/{handle}/settings/tokens`. |
| 31 | - **Browsing** — file tree with a per-file **last-commit column**, file contents with |
| 32 | syntax highlighting, commit log, a commit and its **highlighted diff**, a three-dot |
| 33 | comparison of two revisions, blame, branches and tags, and the README rendered on the |
| 34 | repository page with `#12` and bare shas linked to the issue and commit they name. |
| 35 | - **A file's own history** at `/{handle}/repos/{name}/log/{rev}/-/{path}`, which |
| 36 | **follows renames**, so a file's past does not stop where its name changed. |
| 37 | - **Markdown files render as documents**, with `?view=source` for the text; headings get |
| 38 | ids, so a link to `notes.md#usage` lands on the section it names. Submodule rows link |
| 39 | to their upstream at the sha they are pinned to, and symlink rows say where they point. |
| 40 | - **Code search** over a revision, at `/{handle}/repos/{name}/search`. |
| 41 | - **Archive download** — `zip` and `tar.gz` of any revision, and of every tag. |
| 42 | - **Issues** — open, comment, edit, close and reopen, with labels from a palette of |
| 43 | eight colours, and filtering by label and state. |
| 44 | - **Pull requests** — branch to branch inside one repository, with a Conversation, the |
| 45 | commits and the changed files under their own tabs, the same labels the issues wear, |
| 46 | and a merge box that says whether the branches actually merge before it offers a |
| 47 | button. Merge as a merge commit, a fast-forward or a squash, optionally deleting the |
| 48 | source branch afterwards; a merge fires the same webhooks a push does, and |
| 49 | `Closes #4` in the title or body closes issue 4 and says so on it. |
| 50 | - **Webhooks** — a signed JSON POST per push, with a delivery log you can page through, |
| 51 | redeliver an attempt from, and switch a hook off in. |
| 52 | - **Atom feeds** — a repository's commits and its issues, and the owner's push activity |
| 53 | across repositories, linked from the pages they belong to and autodiscovered. |
| 54 | - **Every long list pages**, with `?page=N`, clamped to the nearest page that exists |
| 55 | rather than refused. |
| 56 | - **A JSON API** — `/api/me`, `/api/users/{handle}`, `/api/users/{handle}/repos`. Not a |
| 57 | separate product; every use case gets a second surface where that makes sense, which is |
| 58 | what keeps the use-case layer honest. |
| 59 | |
| 60 | Writing (markdown posts), multi-user, organizations, code review and SSH transport are |
| 61 | **not built yet**. The plan for them is in [`plans/ROADMAP.md`](plans/ROADMAP.md). |
| 62 | |
| 63 | ## Requirements |
| 64 | |
| 65 | - Linux, x86_64 or aarch64, with systemd. The releases are built against glibc 2.31, so |
| 66 | Debian 11 and Ubuntu 20.04 or newer. |
| 67 | - **`git` on `PATH`.** Not optional: Steid runs `git init --bare` to create a repository |
| 68 | and `git http-backend` to serve every clone and push. One `apt-get install git`. |
| 69 | **git 2.38 or newer to merge a pull request from the web** — that is when `git |
| 70 | merge-tree --write-tree` arrived, which is how a merge is computed without a working |
| 71 | tree; everything else works on any git, and where it is older the merge box says so |
| 72 | instead of offering a button. Debian 12 and Ubuntu 22.04 and newer are fine. |
| 73 | - **A TLS-terminating reverse proxy, and a domain name for it.** Also not optional. |
| 74 | Steid speaks plain HTTP — the web framework it is built on (Topcoat 0.5) has no TLS |
| 75 | support at all: no rustls, no ACME, no HTTPS listener. And because git authenticates |
| 76 | with HTTP Basic, an instance served over plain HTTP leaks your access token to every |
| 77 | hop on the network, on every push. The installer sets Caddy up for you. |
| 78 | - About 100 MB of disk before any repositories, plus whatever you push. |
| 79 | |
| 80 | ## Install |
| 81 | |
| 82 | ### One command |
| 83 | |
| 84 | ```sh |
| 85 | curl -fsSL https://releases.steid.dev/install.sh | sh -s -- --domain git.example.com |
| 86 | ``` |
| 87 | |
| 88 | Point the domain's DNS at the machine first, and make sure ports 80 and 443 are open — |
| 89 | Caddy needs both to obtain a certificate. |
| 90 | |
| 91 | Releases live at `https://releases.steid.dev` — the tarball for your architecture and |
| 92 | its SHA-256 under `/v<version>/`, and this script at the root. `jpgill.dev` mirrors the |
| 93 | same files at the path it has served since 0.4.0, so older links still work. Installing |
| 94 | from your own mirror is one variable: `STEID_RELEASE_BASE_URL=https://…` with the same |
| 95 | `/v<version>/steid-<version>-<target>.tar.gz` layout under it. |
| 96 | |
| 97 | That does the following, and nothing else: |
| 98 | |
| 99 | 1. installs `git`, `curl` and `ca-certificates` |
| 100 | 2. downloads the release tarball for your architecture and **verifies its SHA-256** |
| 101 | 3. unpacks it to `/opt/steid` — the binary with its `assets/` directory beside it |
| 102 | 4. creates a `steid` system user and `/var/lib/steid` for state, owned by it |
| 103 | 5. writes `/etc/steid/steid.env`, and a systemd unit that listens on `127.0.0.1:3000` |
| 104 | 6. installs Caddy and writes a Caddyfile that terminates TLS for your domain and proxies |
| 105 | to that loopback port |
| 106 | 7. starts both |
| 107 | |
| 108 | Re-run it with a newer `--version` to upgrade. It is idempotent: it replaces the binary |
| 109 | and assets, leaves `/var/lib/steid` alone, and will not overwrite `/etc/steid/steid.env` |
| 110 | once it exists — with one exception, `--operator-token`, which is the only setting a |
| 111 | later run rewrites and only when you pass it. |
| 112 | |
| 113 | Options: `--version`, `--port`, `--flavour musl|gnu` (`gnu` is what is built), |
| 114 | `--owner-email`/`--owner-handle` (below), `--operator-token` (see |
| 115 | [Operator surface](#operator-surface)), and `--no-caddy` if you are bringing your own |
| 116 | proxy. `sh install.sh --help` lists them. |
| 117 | |
| 118 | ### Scripted install: come up already owned |
| 119 | |
| 120 | A fresh instance has no owner, and until someone claims it the setup page is open to |
| 121 | whoever reaches it first. That is fine when you are watching the install; it is not fine |
| 122 | when a machine builds itself at three in the morning. Give the installer an owner and |
| 123 | there is no window at all: |
| 124 | |
| 125 | ```sh |
| 126 | sh install.sh --domain git.example.com \ |
| 127 | --owner-email you@example.com --owner-handle you |
| 128 | ``` |
| 129 | |
| 130 | It writes `STEID_OWNER_EMAIL` and `STEID_OWNER_HANDLE` into `/etc/steid/steid.env`, and |
| 131 | the first boot that finds the instance unclaimed creates that owner before serving a |
| 132 | single request. No setup token is printed, and `/auth/setup` is closed because there is |
| 133 | nothing left to claim. |
| 134 | |
| 135 | **That owner has no password**, because there was nobody to choose one: Steid hashes 32 |
| 136 | random bytes it generates at boot and throws away, so every sign-in attempt is refused |
| 137 | like any other wrong password. The way in is a one-time link minted on the machine: |
| 138 | |
| 139 | ```sh |
| 140 | /opt/steid/steid reset-password you |
| 141 | ``` |
| 142 | |
| 143 | Both flags or neither — half of an owner is a refusal from the installer, and from Steid |
| 144 | itself at startup, rather than an instance that quietly comes up unclaimed. A handle that |
| 145 | is reserved or malformed, or a bad email address, also stops the boot with one line |
| 146 | saying which. They are written only when `/etc/steid/steid.env` is first created, and |
| 147 | Steid ignores them once an owner exists, so they can stay in the file for the life of the |
| 148 | instance. |
| 149 | |
| 150 | **On piping a URL into a shell.** It is a real trust decision, and "it's convenient" is |
| 151 | not an answer to it. Download and read it first if you would rather: |
| 152 | |
| 153 | ```sh |
| 154 | curl -fsSL https://releases.steid.dev/install.sh -o install.sh |
| 155 | less install.sh |
| 156 | sudo sh install.sh --domain git.example.com |
| 157 | ``` |
| 158 | |
| 159 | Or do it by hand — the manual path below is the same steps, written out. |
| 160 | |
| 161 | ### Manually |
| 162 | |
| 163 | Every command as root, on Debian or Ubuntu. Adjust paths and package manager to taste; |
| 164 | nothing here is specific to a distribution except `apt-get`. |
| 165 | |
| 166 | ```sh |
| 167 | |
| 168 | apt-get update |
| 169 | apt-get install -y git curl ca-certificates |
| 170 | |
| 171 | |
| 172 | VERSION=0.7.0 |
| 173 | TARGET=x86_64-unknown-linux-gnu |
| 174 | BASE=https://releases.steid.dev |
| 175 | curl -fsSLO "$BASE/v$VERSION/steid-$VERSION-$TARGET.tar.gz" |
| 176 | curl -fsSLO "$BASE/v$VERSION/steid-$VERSION-$TARGET.tar.gz.sha256" |
| 177 | sha256sum -c "steid-$VERSION-$TARGET.tar.gz.sha256" |
| 178 | tar -xzf "steid-$VERSION-$TARGET.tar.gz" |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | mkdir -p /opt/steid |
| 185 | cp "steid-$VERSION-$TARGET/steid" /opt/steid/steid |
| 186 | cp -r "steid-$VERSION-$TARGET/assets" /opt/steid/assets |
| 187 | chmod 755 /opt/steid/steid |
| 188 | |
| 189 | |
| 190 | useradd --system --home-dir /var/lib/steid --shell /usr/sbin/nologin steid |
| 191 | mkdir -p /var/lib/steid/repos |
| 192 | chown -R steid:steid /var/lib/steid |
| 193 | chmod 750 /var/lib/steid |
| 194 | |
| 195 | |
| 196 | mkdir -p /etc/steid |
| 197 | cat > /etc/steid/steid.env <<'EOF' |
| 198 | STEID_DATABASE_URL=sqlite:/var/lib/steid/steid.db?mode=rwc |
| 199 | STEID_DATA_DIR=/var/lib/steid/repos |
| 200 | HOST=127.0.0.1 |
| 201 | PORT=3000 |
| 202 | EOF |
| 203 | chmod 640 /etc/steid/steid.env |
| 204 | chown root:steid /etc/steid/steid.env |
| 205 | |
| 206 | |
| 207 | cp deploy/steid.service /etc/systemd/system/steid.service |
| 208 | systemctl daemon-reload |
| 209 | systemctl enable --now steid |
| 210 | |
| 211 | |
| 212 | |
| 213 | apt-get install -y caddy |
| 214 | cp deploy/Caddyfile /etc/caddy/Caddyfile |
| 215 | $EDITOR /etc/caddy/Caddyfile |
| 216 | systemctl reload caddy |
| 217 | ``` |
| 218 | |
| 219 | There is **no migration step**. Steid runs its migrations itself on every boot. |
| 220 | |
| 221 | ## First run: claiming the instance |
| 222 | |
| 223 | A fresh instance has no owner. On startup it prints a setup token to its log: |
| 224 | |
| 225 | ``` |
| 226 | This steid has no owner yet. Claim it at /auth/setup with: |
| 227 | |
| 228 | <token> |
| 229 | ``` |
| 230 | |
| 231 | Two things about that token that will bite you otherwise: |
| 232 | |
| 233 | - It is printed **only while the instance is unclaimed**. Once you have claimed it, it is |
| 234 | never shown again — because it no longer exists. |
| 235 | - It lives **in memory only**. Every restart mints a new one, and the one in an older log |
| 236 | line is dead. |
| 237 | |
| 238 | So read it from the current run's journal: |
| 239 | |
| 240 | ```sh |
| 241 | journalctl -u steid --no-pager | tail -n 30 |
| 242 | ``` |
| 243 | |
| 244 | Then open `https://git.example.com/auth/setup`, paste it in, and choose your handle and |
| 245 | password. After that, `/auth/login`. |
| 246 | |
| 247 | **Passwords must be at least 12 characters.** That is the only rule — no required digit |
| 248 | or symbol, because length is the part that measurably helps and composition rules mostly |
| 249 | make people write theirs down. The same rule applies to a password reset and to changing |
| 250 | one in settings; accounts created before it keep working until their owner changes them. |
| 251 | |
| 252 | ### Or have no claim at all |
| 253 | |
| 254 | An unattended install can skip this section entirely: `install.sh --owner-email … |
| 255 | --owner-handle …` creates the owner at first boot, so there is no token, no setup page |
| 256 | and no window. See [Scripted install](#scripted-install-come-up-already-owned). |
| 257 | |
| 258 | ### Or set the token yourself |
| 259 | |
| 260 | If reading a log line during the first minute of a scripted install is awkward, set the |
| 261 | token instead and skip the race: |
| 262 | |
| 263 | ```sh |
| 264 | STEID_SETUP_TOKEN=$(head -c 32 /dev/urandom | base64) |
| 265 | ``` |
| 266 | |
| 267 | It is only consulted while the instance is unclaimed, it is never printed, and Steid |
| 268 | **refuses to start** if it is weak — at least 32 characters, no whitespace, and at least |
| 269 | eight distinct characters, so `abababab…` is rejected rather than accepted. |
| 270 | |
| 271 | ## Using it |
| 272 | |
| 273 | 1. Create a repository at `/{handle}/repos/new`. Public or private. |
| 274 | 2. Issue a personal access token at `/{handle}/settings/tokens`. It is shown once. |
| 275 | 3. Push: |
| 276 | |
| 277 | ```sh |
| 278 | git remote add origin https://git.example.com/me/repos/my-project.git |
| 279 | git push -u origin main |
| 280 | ``` |
| 281 | |
| 282 | Git will ask for a username and password. The token goes in the **password** field; the |
| 283 | username is ignored (a token pasted as the username with an empty password also works, |
| 284 | because people do that). |
| 285 | |
| 286 | You only type it once. Git's credential helper stores it and answers every later push — |
| 287 | which is the whole reason pushing to GitHub feels like it needs no credentials. Use the |
| 288 | one that keeps secrets in your operating system's keystore: |
| 289 | |
| 290 | ```sh |
| 291 | git config --global credential.helper osxkeychain |
| 292 | git config --global credential.helper manager |
| 293 | git config --global credential.helper libsecret |
| 294 | ``` |
| 295 | |
| 296 | **Not `credential.helper store`.** It writes the token in clear text to |
| 297 | `~/.git-credentials`, and a token is a password that never expires. Steid keeps only a |
| 298 | hash of it precisely so that a stolen database contains nothing anyone can present; |
| 299 | storing the plaintext on your laptop hands back what that was protecting. |
| 300 | |
| 301 | **Do not put the token in the remote URL** (`https://user:token@host/...`) either. It |
| 302 | goes into `.git/config` in clear text and shows up in `git remote -v`, in shell history, |
| 303 | and in any log that records the URL. |
| 304 | |
| 305 | Cloning a public repository needs no credentials at all. |
| 306 | |
| 307 | ## Configuration |
| 308 | |
| 309 | Environment variables, read from `/etc/steid/steid.env` by the systemd unit. |
| 310 | |
| 311 | |
| 312 | |
| 313 | | `STEID_DATABASE_URL` | `sqlite:steid.db?mode=rwc` | SQLite connection string. The directory must be writable, not just the file — SQLite writes `-wal` and `-shm` siblings. | |
| 314 | | `STEID_DATA_DIR` | `./data` | Where bare repositories live, as `{data_dir}/{handle}/{name}.git`. | |
| 315 | | `STEID_INSECURE_COOKIES` | unset (false) | **Never set this in production.** It strips `Secure` from the session cookie so it survives plain-HTTP localhost, and exists only for local development. | |
| 316 | | `HOST` | `127.0.0.1` in the shipped unit | Bind address. Read by the framework, so deliberately *not* `STEID_`-prefixed. Keep it on loopback; the proxy is the way in. | |
| 317 | | `PORT` | `3000` | Likewise not `STEID_`-prefixed. | |
| 318 | | `STEID_TRUSTED_PROXY` | unset (false) | Whether to believe `X-Forwarded-For` / `X-Real-IP` when telling one rate-limited caller from another. `install.sh` sets it `true`, because that install puts Caddy in front. Leave it off for anything serving Steid straight to the internet — see [Operator surface](#operator-surface). | |
| 319 | | `STEID_OPERATOR_TOKEN` | unset | A bearer token for the operator surface. Unset means that surface does not exist. | |
| 320 | | `STEID_OWNER_EMAIL` | unset | With `STEID_OWNER_HANDLE`, the owner to create at first boot — see [Scripted install](#scripted-install-come-up-already-owned). Set one without the other and Steid refuses to start. | |
| 321 | | `STEID_OWNER_HANDLE` | unset | The handle for that owner. Reserved or malformed, and Steid refuses to start rather than serving unclaimed. | |
| 322 | |
| 323 | Restart after editing: `systemctl restart steid`. |
| 324 | |
| 325 | ## Operator surface |
| 326 | |
| 327 | Two JSON routes for driving an instance without a browser — a control plane provisioning |
| 328 | a machine, a monitoring poll, a scripted install. No session, no cookie, no HTML. |
| 329 | Authenticated by `STEID_OPERATOR_TOKEN` as a bearer token, compared in constant time. |
| 330 | **With no token configured the surface does not exist**: those calls answer as if |
| 331 | unauthenticated, and nothing advertises that a token could be set. |
| 332 | |
| 333 | Set it at install time so the instance never serves with the surface off: |
| 334 | |
| 335 | ```sh |
| 336 | sh install.sh --domain git.example.com \ |
| 337 | --operator-token "$(openssl rand -hex 32)" |
| 338 | ``` |
| 339 | |
| 340 | The installer writes it into `/etc/steid/steid.env` before Steid is started, and never |
| 341 | prints it. This is the one line a later run will rewrite — pass the flag again to rotate |
| 342 | the token; omit it and the existing line is left alone like every other setting in that |
| 343 | file. Editing the line by hand works just as well; restart afterwards. |
| 344 | |
| 345 | ### `GET /api/instance` |
| 346 | |
| 347 | Unauthenticated, it answers the one fact that is safe to tell anybody — and the one a |
| 348 | provisioner needs, so it can wait for a machine to finish booting before handing its owner |
| 349 | a claim link: |
| 350 | |
| 351 | ```sh |
| 352 | $ curl -s https://steid.example.com/api/instance |
| 353 | {"claimed":false} |
| 354 | ``` |
| 355 | |
| 356 | With the operator token it adds what the machine is and how big it has become: |
| 357 | |
| 358 | ```sh |
| 359 | $ curl -s -H "Authorization: Bearer $STEID_OPERATOR_TOKEN" \ |
| 360 | https://steid.example.com/api/instance |
| 361 | {"claimed":true,"version":"0.7.0","git_version":"2.47","merge_supported":true, |
| 362 | "repositories":3,"users":1,"uptime_seconds":8421, |
| 363 | "disk":{"data_dir_bytes":12884901888,"filesystem_total_bytes":21474836480, |
| 364 | "filesystem_free_bytes":8589934592}} |
| 365 | ``` |
| 366 | |
| 367 | A wrong or missing token is not an error — it is the public answer. `git_version` is |
| 368 | absent where git could not be run at all, which is the same case that leaves |
| 369 | `merge_supported` false. |
| 370 | |
| 371 | `disk` is the data directory walked — everything under it, whatever it is — plus the |
| 372 | total and the free space of the filesystem it sits on, so "12 GB of 20 used" is |
| 373 | arithmetic rather than a second call. Free is what is free to the `steid` user, not |
| 374 | counting the reserve a filesystem keeps for root. The walk is cached for a minute, so |
| 375 | polling this every few seconds costs one walk a minute; the whole group is absent where |
| 376 | the directory could not be read, rather than reported as zero. **It is never on the |
| 377 | unauthenticated answer**, which stays `{"claimed": …}` and nothing else. |
| 378 | |
| 379 | The unauthenticated form is rate limited to 60 calls a minute per caller (600 across |
| 380 | everyone), which is about one poll a second. The authenticated form is not: a caller |
| 381 | holding the token has already proved it is the control plane. |
| 382 | |
| 383 | ### `POST /api/setup` |
| 384 | |
| 385 | The claim form, headless. Same rules as the page at `/auth/setup`: the setup token is |
| 386 | checked before anything is written, a claimed instance cannot be claimed again, and the |
| 387 | password must be at least 12 characters. |
| 388 | |
| 389 | ```sh |
| 390 | $ curl -s -X POST https://steid.example.com/api/setup \ |
| 391 | -H 'content-type: application/json' \ |
| 392 | -d '{"setup_token":"…","email":"you@example.com","handle":"you","password":"…"}' |
| 393 | {"handle":"you"} |
| 394 | ``` |
| 395 | |
| 396 | 201 on success, and **no session** — a control plane is not signing in, so sign in through |
| 397 | the browser afterwards like anyone else. A password short of the minimum is refused like |
| 398 | everything else here — the same opaque `404`, with the reason in the server log — because |
| 399 | a response that named the password would tell a stranger guessing tokens that they had |
| 400 | guessed one. Every failure is the same `404` with the same |
| 401 | body, whether the token was wrong or the instance was already claimed: telling those two |
| 402 | apart would say whether there is still something worth guessing. It shares the sign-in |
| 403 | rate limit — 10 attempts a minute per caller, 60 across everyone — because it is the same |
| 404 | secret being attacked. |
| 405 | |
| 406 | Pair it with `STEID_SETUP_TOKEN` (see [Or set the token yourself](#or-set-the-token-yourself)) |
| 407 | so the whole install is scriptable: the token goes into the environment, the machine boots, |
| 408 | `GET /api/instance` says `{"claimed":false}`, and one POST claims it. |
| 409 | |
| 410 | ### `STEID_TRUSTED_PROXY` |
| 411 | |
| 412 | The rate limiters have to tell one caller from another, and the web framework Steid is |
| 413 | built on (Topcoat 0.5) discards the peer address when it accepts a connection — a handler |
| 414 | sees request headers and nothing else. So the only thing available is |
| 415 | `X-Forwarded-For`. |
| 416 | |
| 417 | Behind a proxy that is sound: the proxy *appends* the address it accepted the connection |
| 418 | from, so the rightmost entry is the one the client cannot forge. Exposed directly, nothing |
| 419 | appends anything, and a caller can invent a fresh header per request to buy itself a fresh |
| 420 | budget every time. |
| 421 | |
| 422 | `STEID_TRUSTED_PROXY` says which situation you are in, and defaults to the safe answer. |
| 423 | Left off, no header is read at all and every caller shares one window — a forged header |
| 424 | buys nothing, at the cost of one flood exhausting the shared budget for a minute. Turn it |
| 425 | on only when something in front of Steid is appending the header; `install.sh` does, |
| 426 | because it installs Caddy. |
| 427 | |
| 428 | ## Backup and restore |
| 429 | |
| 430 | The entire backup surface is **two paths**: |
| 431 | |
| 432 | - `/var/lib/steid/steid.db` — the SQLite database (users, repositories, tokens, sessions) |
| 433 | - `/var/lib/steid/repos` — the bare git repositories |
| 434 | |
| 435 | Which is to say: back up `/var/lib/steid`. `rsync` is enough. |
| 436 | |
| 437 | ```sh |
| 438 | systemctl stop steid |
| 439 | rsync -a /var/lib/steid/ backup-host:/backups/steid/ |
| 440 | systemctl start steid |
| 441 | ``` |
| 442 | |
| 443 | Stopping first is the honest version: SQLite in WAL mode leaves `-wal` and `-shm` files, |
| 444 | and copying them while a write is in flight can capture a torn state. If you would rather |
| 445 | not stop the service, snapshot the database properly and copy the repositories live — |
| 446 | they are only written during a push: |
| 447 | |
| 448 | ```sh |
| 449 | sqlite3 /var/lib/steid/steid.db ".backup '/tmp/steid-backup.db'" |
| 450 | rsync -a /tmp/steid-backup.db /var/lib/steid/repos backup-host:/backups/steid/ |
| 451 | ``` |
| 452 | |
| 453 | To restore: install Steid as above, stop it, drop both paths back into `/var/lib/steid`, |
| 454 | `chown -R steid:steid /var/lib/steid`, start it. Migrations run on boot, so a database |
| 455 | from an older version is brought forward automatically. |
| 456 | |
| 457 | ### `steid backup` and `steid restore` |
| 458 | |
| 459 | Steid can also do both itself, into one file: |
| 460 | |
| 461 | ```sh |
| 462 | steid backup /var/backups/steid |
| 463 | steid restore /var/backups/steid-0.7.0-20260926T101500Z.tar.gz |
| 464 | ``` |
| 465 | |
| 466 | The archive holds a manifest, a consistent copy of the database (SQLite's own |
| 467 | `VACUUM INTO`, so the service may keep running) and the whole data directory. `install.sh |
| 468 | --backups daily` runs the first of these on a timer. |
| 469 | |
| 470 | **`steid restore` refuses an instance that already holds a user or a repository**, so |
| 471 | pointing it at the wrong machine cannot replace somebody's site with somebody else's. |
| 472 | That refusal is the default and is not going away. |
| 473 | |
| 474 | ```sh |
| 475 | systemctl stop steid |
| 476 | steid restore --replace /var/backups/steid-0.7.0-20260926T101500Z.tar.gz |
| 477 | systemctl start steid |
| 478 | ``` |
| 479 | |
| 480 | `--replace` is the explicit consent to do it anyway: it replaces everything this instance |
| 481 | holds — database and data directory — with the archive's, whoever is in it. **Stop Steid |
| 482 | first**; nothing checks, because the data directory is being moved out from under a |
| 483 | process that serves out of it. |
| 484 | |
| 485 | Nothing is deleted. The archive is extracted beside the live tree and swapped in only |
| 486 | once the whole extraction has succeeded, and what was there is moved to |
| 487 | `/var/lib/steid/repos/.replaced-<timestamp>/` — repositories and a copy of the old |
| 488 | database together. It is as large as the instance was and **nothing will ever remove |
| 489 | it**; the restore prints the path, and deleting it once you have checked the restore is |
| 490 | yours to do. |
| 491 | |
| 492 | ## Building from source |
| 493 | |
| 494 | ```sh |
| 495 | cargo install topcoat-cli --version 0.5.0 --locked |
| 496 | topcoat asset bundle --release |
| 497 | ``` |
| 498 | |
| 499 | **`cargo build --release` on its own is not enough.** It produces a binary that will not |
| 500 | boot: `AssetBundle::load()` walks up from the executable looking for |
| 501 | `assets/manifest.toml`, and `build.rs` does not write one. `topcoat asset bundle` runs |
| 502 | `cargo build` itself and then writes the bundle to `target/assets`. The binary at |
| 503 | `target/release/steid` needs that directory beside it. |
| 504 | |
| 505 | Requires rustc ≥ 1.95 — Topcoat 0.5 demands it, and on an older toolchain `cargo add |
| 506 | topcoat` silently resolves to an empty `v0.0.0` placeholder instead of failing. |
| 507 | |
| 508 | For development, `topcoat dev` does the bundling for you, and a local `.env` with |
| 509 | `STEID_INSECURE_COOKIES=true` is needed for the session cookie to survive plain-HTTP |
| 510 | localhost. |
| 511 | |
| 512 | ### Cutting a release |
| 513 | |
| 514 | ```sh |
| 515 | ./release.sh --target x86_64-unknown-linux-gnu |
| 516 | ``` |
| 517 | |
| 518 | Produces `dist/steid-<version>-<target>.tar.gz` and a `.sha256` beside it. The tarball |
| 519 | extracts to a self-contained directory: the binary, `assets/`, and this README. Building |
| 520 | a Linux artefact on macOS needs a container (the script uses Docker) or a cross |
| 521 | toolchain; `--native` builds for the host instead, which is useful for checking the |
| 522 | artefact layout and not for releasing. |
| 523 | |
| 524 | A container image also exists — see [`Dockerfile`](Dockerfile) — but the supported |
| 525 | artefact is the plain binary. |
| 526 | |
| 527 | ## Current limitations |
| 528 | |
| 529 | Deliberately blunt. Steid is early. |
| 530 | |
| 531 | - **Single user.** One account, claimed on first run. No registration, no invites, no |
| 532 | organizations yet. Issues exist, but only the owner may open or comment on one, which |
| 533 | is the same assumption showing. |
| 534 | - **No TLS of its own.** A reverse proxy is mandatory, not recommended — see |
| 535 | [requirements](#requirements). |
| 536 | - **No encryption at rest.** The database and repositories are plain files. Anyone with |
| 537 | the disk has everything. Token *values* are hashed, and passwords are Argon2, but |
| 538 | repository contents are not encrypted. |
| 539 | - **Rate limiting covers `/auth/login`, `/auth/setup` and token authentication on the |
| 540 | git routes** — 10 attempts a minute per client for the first two, 60 for the third, |
| 541 | each with a global backstop. An anonymous clone of a public repository is not limited |
| 542 | at all, and neither is an archive download, which is the most expensive thing a |
| 543 | stranger can ask for. |
| 544 | - **Rate limiting keys on forwarded headers, because Topcoat 0.5 does not expose the |
| 545 | peer address at all.** Behind a reverse proxy — the supported deployment — that works. |
| 546 | Exposed directly to the internet with no proxy, a caller can vary the header and get a |
| 547 | fresh budget each time, leaving only the global cap. Run it behind the proxy. |
| 548 | - **Nothing sweeps expired tokens and nothing warns before one expires.** A token that |
| 549 | has expired authenticates exactly like one that never existed, and the tokens page is |
| 550 | where you find out. |
| 551 | - **No CI/CD**, no code review, no SSH transport, no federation. Pull requests exist but |
| 552 | are bare: no assignees, reviewers or milestones, and only the owner may open or merge |
| 553 | one — the single-user assumption again. |
| 554 | - **No writing yet** — posts and markdown are the next milestone, and they are the point |
| 555 | of the whole thing. |
| 556 | - **Light mode is half-checked.** The repository landing page, a tree and a blob were |
| 557 | looked at and were fine; the profile, the settings pages and the log were not. Either |
| 558 | way there is no way for a visitor to choose — the layout is hardcoded dark. |
| 559 | - **Not battle-tested.** It has not run under load, has not been audited, and has been |
| 560 | deployed by approximately one person. Do not put anything irreplaceable in it that is |
| 561 | not also somewhere else. |
| 562 | |
| 563 | More, in unflattering detail, in [`plans/current.md`](plans/current.md). |
| 564 | |
| 565 | ## Project layout |
| 566 | |
| 567 | `plans/` is the source of truth for intent, not the code: |
| 568 | |
| 569 | |
| 570 | |
| 571 | | [`plans/ROADMAP.md`](plans/ROADMAP.md) | vision, stack, the milestone ladder | |
| 572 | | [`plans/current.md`](plans/current.md) | the active milestone, and every known gap | |
| 573 | | [`plans/progress.md`](plans/progress.md) | what shipped, and the decisions worth not rediscovering | |
| 574 | | [`plans/architecture.md`](plans/architecture.md) | layer rules and conventions | |
| 575 | | [`plans/decisions/`](plans/decisions/) | ADRs | |
| 576 | |
| 577 | The code is a single crate in three layers — `domain`, `application`, `infrastructure` — |
| 578 | with dependencies pointing inward. Every use case takes an `Actor` and authorizes before |
| 579 | any side effect. |
| 580 | |
| 581 | ## Licence |
| 582 | |
| 583 | Copyright (C) 2026 James Gill. |
| 584 | |
| 585 | Steid is free software under the **GNU Affero General Public License v3.0** — see |
| 586 | [LICENSE](LICENSE). You may use, modify and redistribute it, including commercially. |
| 587 | |
| 588 | The reason for AGPL rather than a permissive licence is section 13: if you modify Steid |
| 589 | and offer it to others **over a network**, you must make your modified source available |
| 590 | to those users. Running an unmodified copy — which is what self-hosting is — carries no |
| 591 | such obligation. In other words: host it for yourself freely, fork it privately for |
| 592 | yourself freely, but a modified public service has to share what it changed. |
| 593 | |
| 594 | Worth being straightforward about what this does *not* do: it does not stop anyone |
| 595 | running Steid as a commercial hosted service. AGPL is a copyleft licence, not a |
| 596 | non-compete. |
| 597 | |