steid

@jamesgill /

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