Wiki (bookstack)
Wiki on a Self Host Wizard box: the bookstack piece, served at wiki.<apps domain>, oidc sign-in, memory limit 134 MB.
At a glance
| Field | Value |
|---|---|
| Address | https://wiki.<apps domain> |
| Sign-in | oidc: OpenID Connect through Authelia: the office sign-in carries over |
| Memory limit | 134 MB (ram_mb: measured peak × 1.3) |
| Database | mariadb |
| Needs | lldap, authelia, mariadb |
| Needed by | nothing |
| Containers | bookstack |
Image: bookstack | lscr.io/linuxserver/bookstack:v26.09.3-ls301@sha256:2ab643f9bce3e29b3347b595e369977eea3a40cef72d887fce635faf1cea3abc |
| Set-up script after start | scripts/post-up.sh, daily |
| Licence (from the README) | MIT |
| Upstream (from the README) | https://www.bookstackapp.com |
Turn it on
thx enable adds bookstack and everything it needs to the box's state; thx apply then installs it. Apps are applied only once site_domain is set.
sudo thx enable bookstack
sudo thx apply
Engineering notes (pieces/bookstack/README.md)
BookStack v26.09.3, MIT. Shelves → books → chapters → pages, WYSIWYG
or Markdown editor, revisions, search, exports. Image lscr.io/linuxserver/bookstack:v26.09.3-ls301
(nginx + php-fpm + memcached + queue worker + cron under s6), pinned by index digest
sha256:2ab643f9…3abc; the index has linux/arm64 (docker buildx imagetools inspect,
2026-11-25). We ship only compose + scripts and pull the upstream image unmodified.
How it is wired
- Login: OIDC through Authelia (
auth = "oidc"). BookStack supports OpenID Connect in its free, only edition, so no forward auth.AUTH_METHOD=oidcremoves the password form and self-registration; a person is created at their first SSO login. Redirect URIhttps://wiki.<apps_domain>/oidc/callback; BookStack authenticates to the token endpoint with HTTP Basic (client_secret_basic, it hard-codes league/oauth2-client'sHttpBasicAuthOptionProvider). Groups come from the ID token (thx's Authelia claims policy putsgroupsthere). - Login is automatic (
AUTH_AUTO_INITIATE=true, BookStack's own setting): its login page goes straight to Authelia instead of showing an "SSO" button. With an Authelia session the person lands inside with no click; without one, Authelia's form once and straight back. Upstream's auto-initiate page submits itself every time, so a failed sign-in (BookStack sends it back to /login) would loop. Thethxtheme (APP_THEME, copied byscripts/entry.shfromscripts/theme/) overrides only that page: it submits itself at most once a minute per tab, so a failed sign-in stays on the login page with BookStack's error. - Storage: MariaDB from the box (
db = "mariadb"), files (uploads, images, attachments, the generated nginx/php config) inTHX_DATAmounted at/config. APP_KEY: Laravel needs a 32-byte key; the thx secret
app_keyis 32 bytes written as 64 hex chars.scripts/entry.sh(the container entrypoint, run through/bin/shbecause scripts/ lands- turns it into
base64:…and execs the image's/init. It encrypts sessions and cookies only: changing it logs everyone out, it loses no data.
- turns it into
- Mail:
THX_SMTP_HOST:THX_SMTP_PORT, no auth, fromTHX_MAIL_FROM("Wiki"). TLS verification is off for this hop only: it never leaves the piece network, and the relay's certificate namesmail.<domain>, not the service name. Used for notifications (watched pages, comments). post_up (
scripts/post-up.sh→scripts/roles.php, run inside the container as the web user):- the Admin role gets external auth id
admins(LLDAP box admins are BookStack admins); - one role per company,
org-<org>← LLDAP grouporg-<org>; - a role "Member" that grants nothing becomes the role every new SSO user gets. BookStack adds that default role to everyone; left at the seeded Viewer (view all) every company would read every other's wiki;
- the seeded
admin@admin.com/passwordaccount gets a random password nobody knows. Roles are re-synced from the groups claim at every login (OIDC_REMOVE_FROM_GROUPS).
- the Admin role gets external auth id
How far org separation got
- A company role may create shelves and books and edit its own content, and share it. It has no
"view all": a book is private to its author until the author opens the book's Permissions and
gives the company's role (
org-<org>) view/create/update. Then colleagues see and edit it (pages inside inherit) and other companies still get 404 (tested). Same model as vikunja: private until shared, one click to share. We do not auto-share: guessing which company a person with two companies meant is worse than asking them. - The permissions screen lists every role, so a person sees the other companies' role names.
team-<org>-<team>groups are not mapped (a role per team would clutter that screen); a company admin can create roles with external auth idteam-…by hand and they sync at login.- Removing a company from
THX_ORGSleaves its role in place (its content keeps its permissions).
Test (./test.sh)
HEAVY_CLASS=check ~/.cache/run-heavy.sh 6G pieces/bookstack/test.sh. testkit/thxtest.py is the
lane's throwaway stack (copied from forgejo's, extended with MariaDB, a second acme user and cgroup
RAM sampling): LLDAP, Authelia with the client as thx generates it (claims policy included), Caddy
with a test CA (bind-mounted over the container's trust store, test-only), MariaDB, Mailpit as
stalwart. Proves: the container gets healthy; post_up prints changed, the second run nothing;
in headless Chrome alice (Authelia session) opens the wiki and is inside with no click, and ann (no
session) signs in at Authelia once and lands inside;
alice, ann (org-acme), bob (org-beta) and boss (admins + org-acme) log in via OIDC and get exactly
Member + their company role (boss: Admin); alice creates a book and a page, ann and bob get 404;
alice shares the book with org-acme through the Permissions form, ann reads the page, bob still
gets 404; the seeded admin's password no longer logs in; boss (Admin) sends the test e-mail from
Settings → Maintenance and it arrives from THX_MAIL_FROM; uploads live in THX_DATA; no OOM kill.
Measured
RAM, dev PC (amd64), whole test including the first start's migrations, sampled from the cgroup
every 0.25 s (page cache excluded): 103, 101 and 101 MiB over three runs (office3 lane,
2026-11-25; an earlier lane measured 101/93/97). ram_mb = 134 = 103 × 1.3, rounded up;
mem_limit: 134m; the final run under 134m passed with no OOM kill. The test is light (4 users, a
few pages); php-fpm may run up to 5 workers under load. Re-measure on the box under real use and
raise it from that measurement if it OOMs.
Known gaps
- PDF export uses the image's bundled renderer; not tested.
- The REST API needs the
access-apipermission, which none of the thx roles has; an admin can grant it per role.