Add SilverBullet as a web editor for the Obsidian vault
Deploy with Docker Compose / deploy (push) Successful in 2m17s

Quartz renders the vault but has no write path, so editing a note meant
editing files on the Pi or pushing through git. SilverBullet serves the same
vault as an editable PWA at /sb/, behind the same nginx admin gate /notes/
uses. Quartz stays as the read view; its --serve watcher picks up SilverBullet's
writes, so /notes/ follows within seconds.

The vault is now the `notes` repo rather than `obsidian_vault`, and the
silverbullet-git sidecar commits and pushes what the editor writes while
pulling what Obsidian pushes from elsewhere. The vault's own deploy workflow
has been removed in that repo: it pulled from the old remote and restarted
quartz, and a second git process in the same clone would race the sidecar.

Notes on the configuration:

- Single-space mode, auto-detected because the mounted folder is not empty.
  SilverBullet writes no database or metadata into the vault, so the folder
  stays plain markdown that quartz and Obsidian still understand.
- /sb/ is the one proxied app whose prefix is NOT stripped. SB_URL_PREFIX=/sb
  tells the PWA its own base path and its service-worker scope is built from
  that; stripping the prefix serves a blank page with nothing in the log.
- SB_SPACE_IGNORE mirrors quartz's ignorePatterns and must be newline
  separated. A comma separated list is accepted silently and does nothing.
- No SB_USER is set, so the container is open to anything reaching it on
  app-network. The nginx auth_request gate is the only protection.
- The sidecar runs as uid 1000 to match the vault's ownership, and is a
  separate container rather than SilverBullet's own shell backend, which would
  hand anyone past the nginx gate command execution inside the container.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BCQFvkvorAw1xwhd5gL2qZ
This commit is contained in:
2026-09-21 15:33:28 +01:00
co-authored by Claude Opus 5
parent 5f78628c36
commit fdf76f75e9
11 changed files with 214 additions and 6 deletions
+7 -2
View File
@@ -55,6 +55,8 @@ backend icecast2 gitea hasura quartz python | |
| db (Postgres 16) | `${POSTGRES_HOST}` | 5432 | none | no |
| hasura | `${HASURA_HOST}` | `${HASURA_PORT}` | `/hasura/` (admin-gated) | no |
| quartz (notes) | `${QUARTZ_HOST}` | `${QUARTZ_PORT}` | `/notes/` (admin-gated) | no |
| silverbullet | `${SILVERBULLET_HOST}` | `${SILVERBULLET_PORT}` | `/sb/` (admin-gated) | no |
| silverbullet-git | n/a | n/a | none (timer loop) | no |
| python (FastAPI) | `${PYTHON_HOST}` | `${PYTHON_PORT}` | `/py/`, docs at `/py/docs` | no |
| icecast2 + liquidsoap | `${ICECAST_HOST}` | `${ICECAST_PORT}` | `/radio/` | **harbor port only** |
| gitea | `${GITEA_HOST}` | 3000, 2222 | `/gitea/` | **3000, 2222** |
@@ -71,11 +73,14 @@ in one step — never change one without the other.**
- **Canonical host.** `http://` → `https://`, and apex → `www`. The SPA, the
cookies and the CORS rules all assume `www.<DOMAIN>`.
- **Prefix stripping.** `/api`, `/radio`, `/gitea`, `/notes`, `/py` are stripped
— but `/sb/` deliberately is NOT: SilverBullet is told its own base path via
`SB_URL_PREFIX` and builds its service-worker scope from it, so stripping the
prefix serves a blank page with nothing in the log.
by a `rewrite ... break` before proxying; each upstream serves from `/`.
- **Per-request DNS.** Upstreams go through `set $upstream_* ...` variables with
`resolver 127.0.0.11`, so names resolve per request. nginx boots fine with a
backend down (502s until it appears) instead of refusing to start.
- **Admin gate.** `/hasura/` and `/notes/` are protected by an `auth_request`
- **Admin gate.** `/hasura/`, `/notes/` and `/sb/` are protected by an `auth_request`
subrequest to the backend's `/auth/validate-admin`; a failure redirects to the
SPA login. Neither service has any auth of its own at that path.
- **Uploads served directly.** `/uploads/` is an alias onto the shared `uploads`
@@ -207,7 +212,7 @@ of deleting the directory:
| `./gitea/config` | Gitea's live `app.ini` | Gitignored; generated from the template on first boot and then owned by Gitea |
| `./logs` | Backend logs | |
| `./icecast2/fallback_music` | Radio fallback MP3s | Synced by `sync-secrets.sh`, not git |
| `${OBSIDIAN_DIR}` | The Obsidian vault | Read-write to backend, **read-only** to quartz |
| `${OBSIDIAN_DIR}` | The Obsidian vault (a git clone of the notes repo) | Read-write to backend and silverbullet, **read-only** to quartz |
**Ephemeral:** anything else inside a container. Notably the Vue build, the
rendered nginx/icecast/quartz configs, and the Gitea runner's downloaded binary