Inkling
All docs

Running a server

Operations: deployment checklist, performance, caches and database tuning

Deployment checklist, upgrades, the status summary, database tuning.

Rendered from docs/OPERATIONS.md in the repository. Markdown source

Companion to deploy/DEPLOY.md and docs/BACKUP.md. Design records: docs/adr/0750–0759. Known, accepted issues: KNOWN-ISSUES.md. 한국어: OPERATIONS.ko.md.

0. Deployment checklist

Before first deploy

Resource limits

Database timeouts

The app sets these on every pool connection: statement_timeout 15 s, idle_in_transaction_session_timeout 60 s, lock_timeout 10 s, and a 10 s connect_timeout. Do not set them at role or database level: the backup sidecar's pg_dump uses the same role. The backup scripts export PGOPTIONS with statement_timeout=0.

Shutdown and crashes

Monitoring

Reading the status summary

Admins see a server status summary at the top of Admin, and a one-line banner at the top of the app when something needs attention (docs/adr/1230-, 1233-). The same data is GET /api/admin/status (admin, browser session only; ?refresh=1 skips the 5-minute cache).

Card · rowWhat it meansWhat to do
Backups · Backup serviceThe sidecar's heartbeat (every 60 s). Red after 10 minutes of silence.docker compose ps backup, docker compose logs backup (BACKUP.md "Troubleshooting").
Backups · Last backupAmber when one scheduled run was missed (older than 2 × the schedule interval + 1 h), red when the last run failed or the newest set is over 7 days old.Admin › Backups shows the failure message; fix it, then Back up now.
Backups · Verification / Restore testRed when the last check failed; the restore test is amber when older than 2 × BACKUP_RESTORE_TEST_DAYS../deploy/backup.sh restore-test, BACKUP.md "What a backup set contains" (Restore test).
Backups · Off-site copy / EncryptionGrey when no BACKUP_RCLONE_REMOTE (still worth fixing: 3-2-1 rule). Encryption is amber only when unencrypted sets are copied off-site. The passphrase itself is never shown.BACKUP.md "Off-site copies with rclone", "Encryption".
Storage · Data diskFree space on the DATA_DIR volume. Amber below 2 × (database + uploads) or 10 %, red below 512 MB or 3 %.Free space or grow the disk before the database runs out (section "Incidents").
Storage · Backup diskAmber below 2 × the last set + BACKUP_MIN_FREE_MB, red when the next run would not fit. "Same disk as the data" means one disk holds both.Lower BACKUP_KEEP_*, move the backup volume, add an off-site copy.
Storage · Database / Uploads / Large pagesFacts. Large pages (≥ 1 MiB of state or ≥ 50k tokens, docs/adr/1103-*) are listed per workspace in its settings.Split long logs into subpages.
App · Restarts in 24 hFrom DATA_DIR/status/boots.json. Amber at any restart without a clean shutdown (OOM kill, crash, docker kill), or at 3 clean restarts in production; red at 3 unclean ones (crash loop). Deploys count as clean restarts.docker compose logs --tail 200 app; exit 137 = memory (section 2).
App · Errors logged in 24 hLog records at level error/fatal. Amber at 10 in 24 h, red at 50 in one hour. Only the count is kept.docker compose logs app | grep '"level":50'.
App · Database schemaApplied migrations vs. the ones this server ships. Red when they differ (e.g. a database restored from a newer release).Upgrade to the release that wrote the database (section "Upgrades").
App · Web pushDevices, failing devices and deliveries given up in 24 h (0.18). Grey with WEB_PUSH=off; amber at 20 given up in 24 h, or "Cannot send: VAPID key problem (…)".Section 12 "Web push": egress to the push services, APP_SECRET_KEY, the VAPID env pair.
App · Database automationsRules on, runs queued, runs failed in 24 h (0.18). Grey when there are no rules; amber when a due run has waited 15 minutes or more ("the automation queue is not keeping up").Section 12 "Database automations"; look for a rule in a loop or a slow webhook.
Security settingsAmber in production when APP_SECRET_KEY or PUBLIC_URL is missing, cookies are not Secure, anyone can sign up (SIGNUP_REQUIRE_KEY=0, or OIDC_AUTO_CREATE=1 without OIDC_ALLOWED_DOMAINS), or the database password is empty, equal to the user name, a common default or shorter than 12 characters (judged on the server; the value is never shown). Red when sealed secrets exist but APP_SECRET_KEY is gone.Section 0 "Before first deploy".
UpdatesGrey unless UPDATE_CHECK=github. Amber when a newer release exists, red when a release newer than this server has a "Security" section in its notes (docs/adr/1232-*).Section "Upgrades".

Upgrades

Releases are published as a multi-arch image, ghcr.io/prove1352/inkling:<X.Y.Z> (also X.Y and latest; docs/adr/1050-*). The procedure, with your -f files added to each compose command:

./deploy/backup.sh                 # 1. backup (ends with "ok set=<id> ...")
git pull                           # 2. compose files and deploy scripts of the new release
#    optional: INKLING_VERSION=X.Y.Z (or X.Y) in .env to pin the release (empty = latest)
docker compose pull app            # 3. fetch the image
docker compose up -d app           # 4. restart; migrations run in one transaction at boot
docker compose logs --tail 50 app  #    check the migration result and "Server listening"

Upgrading to 0.19: the nodian → inkling names

Up to 0.18 the compose project, the volumes, the database role and the database were all named nodian, the project's old name. From 0.19 they come from INKLING_DATA_NAME in .env (docs/adr/2340-*): inkling gives project inkling, volumes inkling_inkling-db, -data, -backups, -backup-ctl, role and database inkling; nodian gives exactly the names of 0.18. The variable has no default, so an install that upgrades without reading this does not come up on new, empty volumes: every compose command refuses before it creates or stops anything, and the running stack keeps running:

error while interpolating name: required variable INKLING_DATA_NAME is missing a value: set INKLING_DATA_NAME
in .env: nodian if this server ran Inkling 0.18 or older (keeps its data), inkling for a new install. ...

Two ways on, both supported:

  1. Keep the old names (no data moves): add INKLING_DATA_NAME=nodian to .env and upgrade as usual. Containers, volumes and backups stay what they were. Supported at least until 1.0; dropping it would be announced in the CHANGELOG one minor release ahead.
  2. Move to the new names, any time after step 1 (recommended order: the upgrade first, checked, then the rename, so a migration and a rename never happen in one go):
./deploy/backup.sh
printf '\nINKLING_DATA_NAME=nodian\n' >> .env       # 1. keep the old names for the upgrade
git pull                                         #    (or copy the new release's files)
docker compose pull app && docker compose up -d  #    or `up -d --build` for source builds
./deploy/rename-from-nodian.sh --dry-run         # 2. plan: volumes, sizes, free disk, downtime
./deploy/rename-from-nodian.sh                   #    the rename (asks once)

What deploy/rename-from-nodian.sh does (docs/adr/2341-*), with the compose files you use (an override is read as usual; otherwise COMPOSE="docker compose -f compose.yaml -f deploy/compose.caddy.yaml" ./deploy/…):

Downtime is the app stop, the dump, the copy and a boot: about a minute for a server with a 65 MB dump; --dry-run prints the estimate for yours. It needs free space for a copy of the volumes plus a dump, and warns below twice the volumes' size. Interrupted, or failed halfway: run it again and it continues. Back to the old names at any point, also after it finished: ./deploy/rename-from-nodian.sh --rollback (what was written under the new names since then is not in the old volumes). When all is well for a few days, delete the old volumes with the docker volume rm … line it printed.

Notes:

Client updates

Open tabs learn about a deploy from the X-Inkling-Build header on every /api response (the id the web build wrote to WEB_DIST/build.json; docs/adr/0990-*). What they do is set by:

EnvValuesDefaultEffect
UPDATE_MODEprompt, forcepromptprompt: a "A new version is available · Reload" banner on every screen. force: the tab reloads by itself once its document edits are acknowledged by the server, no request is in flight and the user has been idle 3 s; a freshly opened tab on an old bundle reloads at once; after 2 minutes without a safe moment, or right after an automatic reload, it shows the banner instead (docs/adr/0991-, 0992-).
UPDATE_CHECKgithub or emptyempty (off)Once a day (on the first admin visit), compare the server version with the latest GitHub release and show "Inkling X.Y.Z is available" in the Admin screen. Only the repository path is requested; nothing about the instance is sent (docs/adr/0994-*).
UPDATE_CHECK_REPOowner/namePROVE1352/inklingRepository for UPDATE_CHECK=github.
INKLING_BUILDbuild-time arg / envbuild-time hashDocker: docker build --build-arg INKLING_BUILD=$(git rev-parse --short HEAD) . tags the build. At runtime it is only a fallback when WEB_DIST has no build.json.

Backup and restore

Accounts

Incidents

1. PostgreSQL tuning

All settings are passed as -c arguments by the db service in compose.yaml and can be overridden in .env. Defaults are small so the stack still fits a 1 GB host.

variabledefaultexample for a 4-core / 24 GB ARM VM shared with other services
PG_MEM_LIMIT512m2g
PG_SHARED_BUFFERS128MB512MB (≈25% of the container limit)
PG_EFFECTIVE_CACHE_SIZE384MB1536MB (shared_buffers + page cache the container may keep)
PG_WORK_MEM4MB16MB (per sort/hash node; 10 app connections)
PG_MAINTENANCE_WORK_MEM64MB128MB
PG_RANDOM_PAGE_COST1.11.1 (block volumes are SSD-backed)
PG_EFFECTIVE_IO_CONCURRENCY100100
PG_SHM_SIZE128m256m
PG_PRELOAD_LIBRARIES(empty)pg_stat_statements while investigating

Notes

Query statistics (opt-in)

# .env
PG_PRELOAD_LIBRARIES=pg_stat_statements
docker compose up -d db
docker compose exec db psql -c 'CREATE EXTENSION IF NOT EXISTS pg_stat_statements'

Top statements by total time:

SELECT calls, round(total_exec_time::numeric, 1) AS total_ms, round(mean_exec_time::numeric, 2) AS mean_ms,
       rows / greatest(calls, 1) AS rows_per_call, left(regexp_replace(query, '\s+', ' ', 'g'), 120) AS query
FROM pg_stat_statements ORDER BY total_exec_time DESC LIMIT 20;
-- reset: SELECT pg_stat_statements_reset();

Is the working set in memory?

-- Buffer cache hit ratio per database (aim for > 0.99 once warm)
SELECT datname, blks_hit, blks_read,
       round(blks_hit::numeric / nullif(blks_hit + blks_read, 0), 4) AS hit_ratio
FROM pg_stat_database WHERE datname = current_database();

-- Per table (heap + index)
SELECT relname,
       round(heap_blks_hit::numeric / nullif(heap_blks_hit + heap_blks_read, 0), 4) AS heap_hit,
       round(idx_blks_hit::numeric / nullif(idx_blks_hit + idx_blks_read, 0), 4)   AS idx_hit
FROM pg_statio_user_tables ORDER BY heap_blks_read + idx_blks_read DESC LIMIT 15;

-- Database size vs shared_buffers
SELECT pg_size_pretty(pg_database_size(current_database())) AS db_size, current_setting('shared_buffers');

HOT updates (fillfactor)

Migration 0024 sets fillfactor = 85 on pages and 90 on page_docs so the frequent updated_at bumps can be HOT updates (no index writes). Existing heap pages stay packed until rewritten. Check and, optionally, rewrite once during a quiet moment (takes an exclusive lock for a few seconds on small tables):

SELECT relname, n_tup_upd, n_tup_hot_upd,
       round(n_tup_hot_upd::numeric / nullif(n_tup_upd, 0), 3) AS hot_ratio
FROM pg_stat_user_tables WHERE relname IN ('pages', 'page_docs');

VACUUM (FULL, ANALYZE) pages;   -- optional one-time rewrite

Measured on a 5k-page seed: 0.1% HOT before, 91% after fillfactor = 85 + rewrite.

Never drizzle-kit push against production

Push diffs the live database against schema.ts and drops anything not declared there. It already removed the hand-written trigram and "perf" indexes once; since migration 0024 they are declared in the schema and recreated with IF NOT EXISTS. Always use generated migrations (pnpm db:generate, applied at boot).

2. Node process

3. In-process caches and maps (single instance)

wherecontentboundexpiry / invalidation
linkPreview.tsURL → preview card1,000 LRU6 h (10 min for failures)
routes/query.tsquery-block results per user200 LRU60 s; key includes workspace version + index epoch
routes/public.tspublic page HTML / allowed file ids200 entries + 32 MB / 500 + 8 MB10 min; key includes pages.updated_at; checked after the token/scope gate
docIndexer.tspending index passes / change signatures200 pending / 2,000 signatures8–30 s debounce / 10 min TTL; flushed at shutdown
snapshotStore.tslast auto-snapshot time per page5,000 LRUonly used to skip the 10-min throttle check
webhooks.tsdelivery queue, per-workspace counters5,000 jobs (200 per workspace)lost on restart (by design)
guard.tslogin failure counters / IP bans20,000 per map / bans until expiryswept every 5 min; reset on restart
collab.tsper-IP socket counts and upgrade timestampsswept above 1,024 IPs10 s window
hocuspocus.documentsopen Yjs documentsopen documentsunloaded when the last client leaves
context/contextCache.tsfind_context results per person (ADR 1550), single queries and merged bundles (ADR 1721)1,000 LRU + 32 MB (shared)5 min; key includes access version, page marker and section index epoch of every searched workspace; a bundle key also the query list, a digest of the extra ranked lists and, with semantic search on, each workspace's vector epoch (ADR 1723)
context/semantic.tssemantic search only (off by default): chunk vectors per workspace, query vectors (ADR 1741)EMBEDDING_CACHE_MB (128 MB) for all workspaces; a workspace that does not fit is scored in SQL / 256 query vectorsloaded on the first query, updated after indexer writes / 10 min
context/embeddings.ts, semanticIndexer.tsendpoint health and backoff, refused chunks (ADR 1742)one state / 10,000 refused chunk hashesbackoff 5 s → 10 min; refused chunks until restart
connectionUsage.tsusage numbers per connection and per (workspace, connection) (ADR 1552)5,000 + 20,000 LRUlost on restart (by design)
context/changeWait.tschanges_since calls waiting (ADR 1551)256 per process, 4 per connection25 s each; released at shutdown
slack/config.tsSlack settings per workspace for the notification consumer (ADR 1802)10,000 workspaces60 s; dropped when the settings are saved or removed
routes/forms.tspublic form answers per form in the last hour (ADR 1822)5,000 forms, oldest forgotten firstsliding hour; lost on restart

No cache holds sessions, memberships or page visibility; those are read from the database on every request. The find_context cache holds answers, not rights: its key carries the workspace access version and the person's permission inputs, so a membership, lock, block or visibility change makes the next call search again. The only long-lived authorisation — an open collaboration socket — is revoked on member removal, a page becoming private, force delete and password change/session revocation (liveConnections.ts, ADR 0754).

4. HTTP caching

curl -sI --compressed -H "cookie: inkling_sid=…" https://<host>/api/workspaces/<id>/pages | grep -i 'etag\|cache-control\|content-encoding'
curl -s -o /dev/null -w '%{http_code}\n' -H 'If-None-Match: <etag from above>' -H "cookie: inkling_sid=…" https://<host>/api/workspaces/<id>/pages   # 304

5. Semantic search (optional)

Off unless both EMBEDDING_URL and EMBEDDING_MODEL are set (docs/adr/1740-*). When on, the server sends the text of every section chunk (page title, heading path, chunk text) to that endpoint, once per change, and find_context also ranks sections by meaning. With a hosted provider that is a third party: use a local model server if notes must not leave the machine. Turned off, nothing of it runs: no request, no timer, no query.

VariableDefaultMeaning
EMBEDDING_URL—Base URL of an OpenAI-compatible API (https://api.openai.com/v1, Ollama http://host:11434/v1, text-embeddings-inference http://tei:8080/v1) or the full …/embeddings URL
EMBEDDING_MODEL—Model name; stored with every vector, so changing it re-embeds everything
EMBEDDING_API_KEYnoneSent as Authorization: Bearer …; never logged or shown
EMBEDDING_DIMENSIONSmodel defaultSent as dimensions (models that can shorten vectors, e.g. text-embedding-3-*)
EMBEDDING_BATCH_SIZE32Chunks per request (1–256)
EMBEDDING_REQUESTS_PER_MINUTE60Indexer request rate; one request in flight
EMBEDDING_TIMEOUT_MS30000Indexer request timeout
EMBEDDING_QUERY_TIMEOUT_MS3000Timeout of the one query embedding per search; on timeout search answers lexically
EMBEDDING_MAX_CHARS4000Characters of one chunk sent to the model
EMBEDDING_CACHE_MB128In-process vector cache for queries; a workspace that does not fit is scored in SQL (slower)
EMBEDDING_QUERY_PREFIXemptyRole prefix put before every search query (0.20, docs/adr/2404-*)
EMBEDDING_PASSAGE_PREFIXemptyRole prefix put before every section sent for embedding (0.20)

EMBEDDING_QUERY_PREFIX / EMBEDDING_PASSAGE_PREFIX are for models trained with role prefixes (e5: EMBEDDING_QUERY_PREFIX="query: ", EMBEDDING_PASSAGE_PREFIX="passage: "; quote them in .env so the space is kept). Vectors are stored under the model name plus a short hash of the prefixes, so setting, changing or removing a prefix re-embeds every section and the clean-up deletes the old vectors, exactly as after a model change. The admin status keeps showing the model. multilingual-e5-small with these prefixes was measured on 0.20 and not adopted: page@1 went up on some question sets and down on others, while answers took 1.7 to 7.5 times the tokens (docs/PERFORMANCE.md, "Rejected / no effect").

compose.yaml passes all twelve through, so setting them in .env is enough (examples in .env.example). A half-filled set (URL without model or the reverse) stays off and logs one warning at boot. Multilingual models work best for mixed Korean/English notes (e.g. bge-m3, multilingual-e5-large, text-embedding-3-small).

Docker: inside the container localhost is the container. For Ollama on the Docker host use http://host.docker.internal:11434/v1 (Docker Desktop) or the host's LAN address, and make Ollama listen on it (OLLAMA_HOST=0.0.0.0). A redirecting EMBEDDING_URL (e.g. http → https) is refused and reported as "connection failed"; configure the final URL.

6. Slack app (per workspace)

Each Inkling workspace can connect its own Slack app (docs/adr/1800-*). There is no central Inkling app and no Slack setting in .env; a workspace owner creates the app in their Slack workspace and pastes its credentials.

  1. Set PUBLIC_URL (needed for link unfurls and for the /inkling link URL) and APP_SECRET_KEY (otherwise the token and secret are stored unencrypted; the settings page warns).
  2. In Inkling: Workspace settings → Slack (owners). Copy the manifest (JSON).
  3. https://api.slack.com/apps → Create New App → From an app manifest → choose the Slack workspace → paste the manifest → Create. If Slack rejects a field, create the app by hand with the values listed on the page: slash command /inkling with the command URL, Event Subscriptions request URL with the bot events link_shared, app_uninstalled, tokens_revoked, App unfurl domain = your PUBLIC_URL host, bot scopes chat:write chat:write.public commands links:read links:write users:read users:read.email.
  4. Install to Workspace. Copy OAuth & Permissions → Bot User OAuth Token (xoxb-…) and Basic Information → Signing Secret.
  5. Back in Inkling: paste both, enter the channel ID (channel details → bottom, C…), choose the updates, Save (Inkling calls auth.test). For a private channel, /invite @<app name> there first.
  6. Press Test. not_in_channel = invite the bot; invalid_auth = wrong token.
  7. Members: type /inkling help. If their Slack email differs from their Inkling email, /inkling link.

Slack checks the Event Subscriptions URL when the app is created from the manifest, before the token and secret are saved in Inkling; Inkling answers that first check for a live workspace without a saved app. If Slack still shows the URL as unverified, open Event Subscriptions after step 5 and press Retry.

7. Public forms

A form view can get a public link (/f/<token>, API /api/public/forms/<token>; docs/adr/1821-, 1822-). It is the only route where a visitor without an account writes data.

9. Single instance, boot re-index and saving (0.15.1)

Single instance (docs/adr/1925-*)

Boot re-index of stale pages (docs/adr/1924-*)

Saving documents (docs/adr/1921-*)

Vault sync revisions (docs/adr/1920-*)

10. MCP and AI agents (0.16)

Tool profiles and the /mcp query string (docs/adr/2000-*)

Uploads by AI agents (docs/adr/2044-, 2045-, 2065-*)

VariableDefaultMeaning
AGENT_UPLOADSonon: agents may upload unless a workspace turns it off. off: only workspaces that turn it on. never: off everywhere; the workspace setting is shown disabled with the reason. Any other value boots with a warning and counts as off
AGENT_UPLOAD_MAX_MB5Largest file an MCP connection, agent token or API token may upload, at most 64 (a larger value is cut to 64 with a warning; 0 or a non-number keeps 5 with a warning)
AGENT_UPLOAD_DAILY_MB200Per account per rolling 24 hours, over the files its connections uploaded (files.uploaded_via); 0 = no budget. People's uploads in the browser have no budget and are never counted

Suggest-only after suspicious content (docs/adr/2040-* .. 2043-*)

Agent connection tokens (docs/adr/2060-* .. 2063-*)

PDF text (docs/adr/2047-, 2048-)

Local trial (docs/adr/2161-*)

Zip imports (docs/adr/2162-, 2163-)

Versions: AI steps (docs/adr/2180-*)

Mermaid diagrams (docs/adr/2104-, 2191-)

12. Offline copies, web push, automations, the web clipper and CIMD (0.18)

Offline copies (docs/adr/2200-* .. 2204-*)

Web push (docs/adr/2220-* .. 2223-*)

VariableDefaultMeaning
WEB_PUSHonoff switches push off server-wide: nothing is queued, queued deliveries are dropped, the routes answer unavailable
VAPID_PUBLIC_KEY, VAPID_PRIVATE_KEYempty (a key made on first use, kept in push_vapid_keys)both or neither; base64url raw keys as printed by npx web-push generate-vapid-keys
VAPID_SUBJECTPUBLIC_URL when https, else mailto:webpush@inkling.invalidthe VAPID sub claim
WEB_PUSH_ALLOWED_HOSTSemptymore push service hosts, comma-separated, host or *.suffix
PUSH_TEST_ALLOW_LOOPBACKofftests only; ignored with NODE_ENV=production

Database automations and buttons (docs/adr/2240-* .. 2244-*)

Web clipper (docs/adr/2260-* .. 2263-*)

OAuth Client ID Metadata Documents (docs/adr/2280-* .. 2282-*)

VariableDefaultMeaning
OAUTH_CIMDoff1 = accept OAuth clients whose client_id is an https URL of a metadata document
OAUTH_CIMD_ALLOWED_HOSTSempty (any public host)comma or space separated hosts, exact or *.suffix; e.g. claude.ai
OAUTH_CIMD_TEST_ALLOW_LOOPBACKofftests only: documents on http://127.0.0.1; ignored with NODE_ENV=production

Workspace groups and archive (docs/adr/2300-* .. 2305-*)

13. Public page downloads, start-up notices and onboarding (0.19)

Public page downloads (docs/adr/2360-* .. 2363-*)

Start-up and screen notices (docs/adr/2324-*)

Onboarding (docs/adr/2380-* .. 2383-*)

VariableDefaultMeaning
ONBOARDINGonoff (or 0, false, no): no intro, no Getting started card, no sample page, for everyone. Use it when your organisation has its own guide. Accounts first seen while it is off count as existing accounts if you turn it on later.
ONBOARDING_EXISTING_USERSoffonce: accounts that existed before onboarding (and accounts first seen while ONBOARDING=off) also see the intro once, on their next app load. Only the intro: their checklist stays off and no sample page is made. Stored per person (introSeenAt): restarts with the variable still set do not repeat it; unsetting it later changes nothing. ONBOARDING=off wins.

Both are read per request and passed through by compose.yaml; recreate the app container after changing them (docker compose up -d app). The routes are for browser sessions only; agents and tokens never see onboarding.

After setting ONBOARDING_EXISTING_USERS=once in .env and recreating the container, check that it arrived: docker compose exec app printenv ONBOARDING_EXISTING_USERS prints once (an empty line means unset). How many accounts it will reach: existing accounts that have not closed the intro, minus guests, who never get it ("guest" is the rule of audienceOf in apps/server/src/onboarding/state.ts):

SELECT count(*) FROM user_onboarding o JOIN users u ON u.id = o.user_id
 WHERE (o.state->>'legacy' = 'true' OR o.state->>'off' = 'true') AND o.state->'introSeenAt' IS NULL
   AND NOT (NOT u.is_admin
     AND NOT EXISTS (SELECT 1 FROM workspace_members m JOIN workspaces w ON w.id = m.workspace_id
                      WHERE m.user_id = u.id AND w.deleted_at IS NULL AND m.role <> 'owner')
     AND EXISTS (SELECT 1 FROM page_grants g JOIN pages p ON p.id = g.page_id
                  WHERE g.user_id = u.id AND NOT EXISTS (SELECT 1 FROM workspace_members m2
                                                          WHERE m2.workspace_id = p.workspace_id AND m2.user_id = u.id)));

An account counts as having seen it only once it closes the intro (Skip, Esc or the last scene); closing the tab while it plays shows it again on the next app load (KNOWN-ISSUES ONBOARD-6).

Onboarding state lives in user_onboarding (one row per account, deleted with the account). To show the intro again to one person, the simplest way is theirs: Settings › About › Watch the intro again. By SQL, UPDATE user_onboarding SET state = state - 'introSeenAt' WHERE user_id = '…'; plays it again on their next app load for an account made after the upgrade (or for any account while ONBOARDING_EXISTING_USERS=once is set). Removing legacy as well (state - 'introSeenAt' - 'legacy') makes an older account count as new: the checklist comes back too, and if the account is the server's first account and an admin, its next load also makes the sample page. The first admin of a new server gets a sample page in their private pages on their first app load; nobody else gets one unless they press the card's button.

14. Columns and tabs of older releases (0.20)

Upgrading to 0.20

One migration and no required setting: the usual procedure (Upgrades, above). Migration 0061 adds three columns to pages for charts on public links (section 15); a 0.19 database goes from 61 to 62 applied migrations. Every existing link keeps charts off, so public pages look as before until a manager (a workspace owner or admin) turns them on. Afterwards, ask people to reload tabs they left open: a tab still running 0.19 or older can read pages with columns but not edit them (below). Going back to 0.19.1 should need no restore (0.19 does not read the three new columns; starting it on a database with 0061 was not tried), but 0.19's editor deletes a group of columns with its content when it opens such a page (it has no guard); do not go back once columns are in use. A link that showed charts and is published again while 0.19 runs keeps its chart setting (KNOWN-ISSUES SHARE-9).

Older tabs and the document schema (docs/adr/2425-*)

16. PDF preview (0.21)

Upgrading to 0.21

No migration (a 0.20 database stays at 62 applied migrations), no new setting and no header change: the usual procedure (Upgrades, above). The server code is the same as 0.20; the release changes the web app only. Ask people to reload tabs they left open: a tab still running 0.20 shows PDFs as a file name line until it is reloaded.

PDF preview (docs/adr/2480-* .. 2483-*)

17. Limits and restricted mode (0.22)

Upgrading to 0.22

One migration, 0062_limits_accounts, additive only: two tables (signup_events, user_consents) and four columns (users.expires_at, workspaces.storage_bytes, workspaces.storage_checked_at, workspaces.over_storage, all null or with a constant default). A 0.21 database goes from 62 to 63 applied migrations. Every new setting below is optional. With none of them set the server behaves as 0.21.1, except for the changes that 0.22 makes on every server (CHANGELOG, "What changes on every server"): every account can delete itself, a sole owner who is the only member can leave a workspace (it is deleted at once), an owner can delete a deleted workspace for good, the hourly housekeeping deletes ip_bans rows whose ban ended more than 30 days ago, the request rate limit counts an IPv6 client by its /64, the deletion preview answers browser sessions only, account deletion finds the copied names by the account's id only, and the OAuth token exchange is one transaction.

compose.yaml passes all twenty-two 0.22 variables to the app as ${VAR:-}, and .env.example has a commented example of each, so setting one in .env is enough. An empty value means the same as an unset one, for every one of them. LEGAL_DIR is a path inside the container, so the folder has to be mounted as well (the demo overlay, deploy/demo/compose.demo.yaml, shows how).

Limits and restricted mode (docs/adr/2500-* .. 2521-*)

Restricted mode is a set of settings for two kinds of servers: an install whose operator wants to cap disk use and the number of people, and a demo server that strangers can sign up to. Setting up a demo server, in order, is in DEMO.md; this section is the reference.

VariableFormatDefaultMeaningError when it applies
LOGIN_ID_MODEemail or usernameemailusername: sign-up takes an ID and a nickname instead of an email address. An ID is 3–30 characters of a-z 0-9 . _ -, starting with a letter or digit, stored lower-cased in the email column; reserved names (admin, root, support, inkling and others) are refused400 LOGIN_ID_INVALID, 409 LOGIN_ID_TAKEN
SIGNUP_MAX_USERSwhole number ≥ 1noneAccounts on the server in total (all users rows, admins included), counted again inside the sign-up transaction. The first admin made with the setup code is not refused403 SIGNUP_FULL
SIGNUP_PER_IP_PER_DAYwhole number ≥ 1noneSign-ups from one address (an IPv4 address or an IPv6 /56) in 24 hours. While it is set, one address also gets at most 10 "this email or ID is taken" answers in 24 hours (below)429 SIGNUP_IP_LIMIT
ACCOUNT_LIFETIME_DAYSwhole number ≥ 1noneAccounts that sign up while it is set are deleted this many days after sign-up. Admins and accounts made before it was set never expire—
ACCOUNT_LIFETIME_DRY_RUN1 or 001: the hourly job logs the accounts it would delete and deletes nothing—
LIMIT_WORKSPACES_PER_USERwhole number ≥ 1noneWorkspaces a person owns: the one made at sign-up and deleted ones that can still be restored count403 LIMIT_WORKSPACES
LIMIT_MEMBERS_PER_WORKSPACEwhole number ≥ 1noneMembers of a workspace, owners included; page guests are not members and do not count403 LIMIT_MEMBERS
LIMIT_PAGES_PER_WORKSPACEwhole number ≥ 1nonePages of a workspace: documents, database rows, folders and canvases, the trash included403 LIMIT_PAGES
LIMIT_FILE_MBnumber > 0, at most 25 (decimals allowed)none (25 MB)Size of one uploaded file. Connections and tokens get min(AGENT_UPLOAD_MAX_MB, LIMIT_FILE_MB)413 LIMIT_FILE
LIMIT_WORKSPACE_STORAGE_MBnumber > 0 (decimals allowed)noneStorage of a workspace (below). One page body may hold at most a quarter of it413 LIMIT_STORAGE
LIMIT_VERSIONS_PER_PAGEwhole number 1–50none (50)Versions kept per page. It can only lower the budget of 50; the shares that AI steps may take shrink with it (40 % per connection, 60 % for all connections)—
DISABLED_FEATUREScomma-separated namesemptyFeatures turned off on the whole server (below)404 FEATURE_DISABLED
WORKSPACE_RESTORE_DAYSwhole number ≥ 130Days an owner can restore a deleted workspace; housekeeping deletes it for good after that—
LEGAL_DIRpath of a foldernoneTerms, privacy policy and sign-up consent (below)400 CONSENT_REQUIRED at sign-up, 403 CONSENT_REQUIRED on other requests
INSTANCE_LABELup to 20 characters, no control charactersnoneA label every screen shows, for example Demo—
LIMIT_TRASH_DAYSwhole number ≥ 7noneUpper bound of page trash retention: pages stay in the trash min(the workspace's "Keep trash for", this value) days, and MCP list_trash gives the same date. The stored workspace value is not rewritten; Workspace settings show the bound and do not take a larger value400 LIMIT_TRASH_DAYS when a workspace asks for more
INSTANCE_NOTICEup to 500 characters of plain text (not HTML); line breaks allowednoneAn operator notice under the title of the sign-in, sign-up, consent and setup-waiting screens and as a strip above every app screen, which nobody can close. Shown as text, without links. For servers that send no mail: changes, interruptions, incidents—
INSTANCE_CONTACTan email address (you@example.org or mailto:you@example.org) or an https:// URL; at most 300 characters, no spacesnoneA "Contact" link to the operator after the terms links under the sign-in, sign-up and consent screens, at the foot of the sidebar and in Settings › About. An address opens the mail app (mailto:), a URL opens in a new tab. Shown even without LEGAL_DIR—
SIGNUP_PER_HOURwhole number ≥ 1noneAccounts the whole server makes in one hour, counted again under one lock inside the sign-up transaction. The setup-code sign-up does not count and is not refused429 SIGNUP_RATE_LIMIT
OAUTH_UNUSED_CLIENT_HOURSwhole number ≥ 1noneSelf-registered OAuth clients that were never used are deleted by the hourly housekeeping this many hours after registering (below)—
OAUTH_UNUSED_CLIENT_MAXwhole number ≥ 1noneMost never-used self-registered OAuth clients kept: a new registration first deletes the oldest, never one younger than 15 minutes (below)503 temporarily_unavailable on /oauth/register when only younger ones are left
LIMIT_WORKSPACES_TOTALwhole number ≥ 1noneWorkspaces on the whole server, deleted ones that can still be restored included, counted under one server-wide lock. Sign-up makes a personal workspace, so it is refused at the limit too (the setup code is not)403 LIMIT_WORKSPACES_TOTAL; 403 SIGNUP_FULL at sign-up
LIMIT_INSTANCE_STORAGE_MBnumber > 0 (decimals allowed)noneStorage fuse of the whole server: the database size plus the files under the data folder, measured at most once a minute. At it the server only reads, signs in, exports and deletes (below)503 INSTANCE_FULL; 503 temporarily_unavailable on /oauth/register

When the server refuses to start

The log names the variable and the reason. The server does not start when:

It starts with a warning when ACCOUNT_LIFETIME_DRY_RUN=1 is set without ACCOUNT_LIFETIME_DAYS, when SIGNUP_PER_IP_PER_DAY is set with TRUST_PROXY=false, and when a file of LEGAL_DIR still has template placeholders. The start log has one line for the limits that are on, one for the features that are off and, with ACCOUNT_LIFETIME_DAYS, one saying how many existing accounts it leaves alone.

Features turned off (DISABLED_FEATURES)

The routes stay registered and answer 404 FEATURE_DISABLED before sign-in is checked. What was set up before stops working but is not deleted, and the routes that remove it stay open, so an owner can still clean up. The app hides the menus of a feature that is off.

NameTurned offStill works
public-linksPublishing and changing public links, /api/public/*; /s/:token serves the plain app shellUnpublishing
public-formsTurning on and reading a form link, the public form and its answersRemoving a form link
webhooksListing, adding, changing, testing webhooks, their secret and deliveries; nothing is sent (queued deliveries wait)Deleting a webhook
slackSlack settings, test, the link flow, /inkling commands and events; nothing is postedRemoving the Slack settings and links
link-previewLink preview cards (GET /api/link-preview)—
web-clipperSaving from the web (POST /api/clip) and its lookup—
icalThe iCal feed URL in Settings, and /ical/:file answers 404Revoking the feed
notion-importAn import that asks for Notion is refused; a zip that looks like a Notion export is imported as plain MarkdownMarkdown, zip and folder imports
web-pushSubscribing, push settings, test, and sending (queued pushes wait)Unsubscribing a device
password-resetForgot password, reset with a code, and the admin's temporary password, reset code, send credentials and reset request queueChanging your own password while signed in
email-invitesMailing a signup key from Admin; page invitations are not mailed (the link is shown instead)Copying keys and links
automations-webhooksButton blocks and automation actions that call a webhook (the action is skipped, the rule stays on)Every other automation action
oauth-cimdOAuth Client ID Metadata Documents, also with OAUTH_CIMD=1Dynamic client registration
embedsFrames from other sites: the app's CSP keeps only frame-src 'self'Page embeds of this server's pages
member-direct-addAdding an existing account to a workspace without an invite link, and the candidate listInvite links

Not in the list, because they are already off until configured: experimental features (EXPERIMENTAL_FEATURES), semantic search, OpenID Connect and mail. MCP stays on.

Storage and read-only workspaces

Instance storage fuse

LIMIT_INSTANCE_STORAGE_MB (docs/adr/2532-) stops writes on a server that strangers could fill, such as a demo. It is weaker than a filesystem with a size limit (KNOWN-ISSUES LIMITS-27); give a demo one of its own as well (below). Since 0.22.1 it counts the disk blocks files take, and the workspaces count their search indexes, so 100 full workspaces of the demo preset fit under its 3,000 MB (docs/adr/2545-, 2548-*). Dead space and Postgres index entries are still counted by the fuse and by no workspace (LIMITS-50).

A tripped fuse usually needs the operator. Deleting rows does not make the database file smaller: Postgres keeps the space for reuse inside each table. Measured for 0.22.0 (ADR 2532): 60 × 5 MB took the database from 11.4 MB to 322.6 MB; deleting every row left 322.6 MB; with half the rows deleted, VACUUM left 326.2 MB, still tripped; VACUUM FULL of the table brought it to 167.0 MB and released the fuse. So members deleting pages will usually not release it. In the 0.22.1 rehearsal (demo preset, local Docker) a tripped fuse was released this way: VACUUM FULL took the database from 219 MB to 13.7 MB, and writes worked again after one more refused write. To release it:

  1. Find the largest tables (with their TOAST data and indexes). Usually page_docs and page_snapshots lead.
  2. Have what should go deleted: workspaces deleted for good, trashes emptied, accounts that should go deleted.
  3. Run VACUUM FULL on those tables, one at a time. It locks the table while it runs and needs free disk about the size of the table's live data.
  4. Or raise LIMIT_INSTANCE_STORAGE_MB and restart. Until one of these is done, the server only reads and deletes.
# a demo (deploy/demo/demo.sh); on a main instance: docker compose exec db psql -c "…"
deploy/demo/demo.sh exec db psql -c "SELECT relname, pg_size_pretty(pg_total_relation_size(oid)) FROM pg_class WHERE relkind = 'r' AND relnamespace = 'public'::regnamespace ORDER BY pg_total_relation_size(oid) DESC LIMIT 10"
deploy/demo/demo.sh exec db psql -c 'VACUUM FULL page_snapshots'

What the fuse cannot bound. It does not see the WAL (up to max_wal_size, 1 GB by default, more while a backup or a long transaction holds it), the backup sets, container logs (3 × 10 MB per service), what grows in the minute between two measurements, or what still grows after it trips (sessions, audit rows of the writes that stay open). Rewrites bloat the database too: rewriting one 5 MB value 40 times in 8 seconds grew it by 207.5 MB, and one client address can send 4 MB a second over the collaboration socket (about 240 MB a minute), so a few addresses writing at full rate for a minute or two can trip a 3,000 MB fuse on a demo holding 2,000 MB of counted data. Only that server stops, but it stays stopped until the operator acts.

Disk budget for a fuse of L MB: live data L plus a minute of growth, 2 GB for the WAL (the 0.22.1 rehearsal measured 880 MB after about 200 MB of database writes), each daily backup set at most L (content that does not compress), and the logs. With the demo preset (3,000 MB, 7 daily sets) that is 3 + 2 + 7 × 3 = 26 GB in the worst case; DEMO.md sizes the demo's filesystem at 30 GB. Put a demo's Docker volumes on a separate filesystem with a size limit, so that whatever the fuse misses cannot fill the disk the main instance uses.

Sign-up limits and TRUST_PROXY

Unused OAuth clients

POST /oauth/register needs no account, and every call stores a client row (up to about 20 KB). Two settings bound these rows on a server open to strangers (docs/adr/2536-*). Both are off by default; without them nothing is deleted.

Account lifetime

Account deletion

Admin status

Upgrading from 0.22.0 to 0.22.1

No migration and no new setting for the app (docs/adr/2540-* .. 2551-*; CHANGELOG, 0.22.1).

Memory of large pages

This applies to every server, with or without limits (docs/adr/2550-, 2551-).

Markdown sourceView on GitHubAll docs