Inkling
All docs

Running a server

Inkling deployment guide (any Linux server)

A Linux server step by step: HTTPS, signup keys, mail, sign-in options, semantic search, updates.

Rendered from deploy/DEPLOY.md in the repository. Markdown source

Every image is multi-arch (x86-64 and ARM64), so the same setup works on ARM cloud VMs (for example free-tier Ampere instances) and on ordinary x86 servers. 한국어: DEPLOY.ko.md.

Just trying it on your own computer? git clone <repo-url> && cd inkling && ./deploy/local.sh writes a .env with generated secrets, starts the stack on a free port bound to 127.0.0.1, and prints a one-time link for the first administrator account (see "Local trial" at the end). The rest of this guide is for a server other people reach.

1. Prepare the server (Ubuntu 22.04)

# Install Docker
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER   # log in again afterwards

# Firewall / security list: allow inbound 80 and 443 (in the OCI console's Security List too!)

2. Code & environment

git clone <repo-url> /opt/inkling && cd /opt/inkling
cp .env.example .env
# Edit .env: set POSTGRES_PASSWORD to a strong value! (used inside the Docker network)
# Leave INKLING_DATA_NAME=inkling as it is (the compose project, volume and database names)

The clone is still needed for compose.yaml, the Caddy overlay and the deploy/*.sh scripts, but the app itself comes as a prebuilt image, ghcr.io/prove1352/inkling (linux/amd64 and linux/arm64), so the server never has to run the build (which needs more than 1 GB of memory).

Image or source build

Published image (default)Source build
Start / updatedocker compose pull app && docker compose up -d appdocker compose -f compose.yaml -f compose.build.yaml up -d --build app
VersionINKLING_VERSION in .env: a release as X.Y.Z (exact) or X.Y (newest patch), or empty (= latest)whatever is checked out
Image nameghcr.io/prove1352/inkling:<version>inkling:local (never pulled)

compose.yaml names the published image and keeps build: ., so docker compose up -d --build still builds from source exactly as before; the result is tagged with the published name, and a later docker compose pull would replace it with the release. When the image is missing locally (or a pull fails, e.g. offline), up falls back to building. If you deploy from source on purpose (a fork, local patches, an unreleased main), use compose.build.yaml so the two never mix. With HTTPS, list it last: -f compose.yaml -f deploy/compose.caddy.yaml -f compose.build.yaml. If you already keep a compose.override.yaml (read automatically when no -f is given), put its two lines under app: there instead:

services:
  app:
    image: inkling:local
    pull_policy: never

Language and time zone

For a Korean deployment, put this in .env:

DEFAULT_LOCALE=ko
TZ=Asia/Seoul

3-A. Plain HTTP (internal network / testing only)

docker compose up -d     # → http://<server-ip>:3000

⚠️ On any non-local (internet-facing) host, the Caddy overlay from 3-B is required. Running the base compose.yaml alone serves the app over plain HTTP on port 3000 (the DB port is bound to loopback only), so use it for local / internal testing only. A public server must sit behind Caddy (HTTPS); only then do Secure cookies apply and the app and DB host ports go away.

  1. DNS: domain (A record) → server IP. Any domain or subdomain works.
  2. In .env (copied from .env.example), set the two existing lines:
    DOMAIN=notes.example.com
    PUBLIC_URL=https://notes.example.com   # mail links, OAuth issuer; also read by the deploy scripts
    
    then start with the overlay:
    docker compose -f compose.yaml -f deploy/compose.caddy.yaml up -d
    
  3. Caddy issues the certificate automatically → https://<domain>. Cookies switch to Secure mode automatically (COOKIE_SECURE=1).

3-C. Accounts — issuing signup keys

Inkling accounts are created only with a signup key (if delegated login is on, people can also come in with an external account — see 3-D). With NODE_ENV=production (the compose default), a signup key is required even when SIGNUP_REQUIRE_KEY is empty. Open signup without a key is enabled only when .env explicitly sets SIGNUP_REQUIRE_KEY=0.

First admin. While the database has no account at all, the server prints a one-time setup link to its log when it starts (0.17, docs/adr/2160-*):

docker compose logs app | grep setup     # → https://notes.example.com/setup?code=XXXX-XXXX-…

Whoever opens it creates the first account, which is admin. The code lives only in the server's memory, works once, and stops working as soon as any account exists (however it was made); a restart with still no account prints a new one. It is not "requests from localhost": behind a proxy every request looks local. Anyone who can read the server log can already run the server, so the link proves the same thing a key from signup-key.sh (a psql INSERT) does. If your container logs are shipped somewhere other people read, create the first account right after the first start, or use the key instead:

./deploy/signup-key.sh new "me"     # the first person to sign up with this key becomes admin

While there is no admin at all, the first person to sign up or log in becomes an admin automatically (bootstrap of a fresh install). After that, admins grant and revoke the role to each other on the admin screen. The last admin cannot be demoted or removed.

Web admin page (recommended). When you log in with an admin account, "Admin" appears in the sidebar (/w/<workspace>/admin, with a number badge when password reset requests are pending). From there you issue and revoke keys (+ invite mail), manage users (password reset, email verification, admin role, forced removal), handle password reset requests, and manage banned IPs. Lists show the newest 5 at a time and are searchable.

When you need to make someone admin directly with SQL:

docker compose exec -T db psql \
  -c "UPDATE users SET is_admin=true WHERE email='someone@example.com'"

CLI (fallback). When the web UI is down or the admin account is locked out:

./deploy/signup-key.sh new "friend A"     # single use, never expires
./deploy/signup-key.sh new "study" 5 30   # 5 uses, expires in 30 days
./deploy/signup-key.sh list               # list issued keys
./deploy/signup-key.sh revoke <KEY>       # delete a key (accounts already created stay)
./deploy/reset-password.sh someone@example.com   # issue a temporary password + log that account out

The recipient signs up at https://<domain>/register?key=<KEY> (or enters the key on /register) and chooses an email, name and password.

Forgotten passwords.

Forced removal. [Remove] on a user row in the admin screen. The users row is deleted; sessions, workspace memberships, bookmarks, the user's own notifications and MCP connections are deleted with it, while pages, files, comments, snapshots, templates and workspaces remain with only the author column cleared (SET NULL). Signup keys that person used get one use back. If the person is the sole owner of any workspace, removal is refused with 409 SOLE_OWNER and the list of those workspaces — promote another member to owner first, then try again. The person's private pages go to the trash without an author, are visible to nobody (admins included) and are permanently deleted after 30 days. If they want, suggest an export before removal.

3-D. Delegated login (optional)

When DELEGATED_AUTH_URL is set, logging in with an id that Inkling doesn't know is verified by that external auth server. Sharing goes one way only, for login — Inkling account passwords are never sent out, and Inkling's own accounts (local accounts with a matching email) are always verified locally.

envMeaningDefault
DELEGATED_AUTH_URLOrigin of the external auth server (e.g. https://auth.example.com)none (off)
DELEGATED_AUTH_NAMEName shown on the login and admin screens"External account"
DELEGATED_EMAIL_DOMAINEmail domain for mirrored delegated accounts (<id>@<domain>, no real mail is sent)delegated.local

Keep the first value of DELEGATED_EMAIL_DOMAIN — changing it breaks the match with existing delegated accounts, and the same person ends up with a new account. Turning delegation on also turns on the signup-key requirement automatically.

Contract the external auth server must satisfy:

POST <DELEGATED_AUTH_URL>/api/auth/login
Content-Type: application/json
{"username": "<id>", "password": "<password>"}
External responseInkling's verdict
200 + {"access_token": "<non-empty string>"}Success → find-or-create <id>@<DELEGATED_EMAIL_DOMAIN> in Inkling's users, then issue an Inkling session. The token is discarded, never stored or forwarded.
200 + {"totp_required": true}401 TOTP_UNSUPPORTED (accounts with two-factor auth are not supported)
401401 INVALID_CREDENTIALS (same message as a failed local login)
429429 RATE_LIMITED
5xx · network error · 10-second timeout · anything else503 AUTH_UPSTREAM_UNAVAILABLE

3-E. Mail (optional)

Turned on by setting SMTP_HOST + MAIL_FROM (SMTP_PORT, SMTP_SECURE, SMTP_USER, SMTP_PASS, link address APP_URL). When off, the related buttons are hidden and only copy-and-paste remains.

3-F. Brute-force protection

Failures of login, password reset, signup keys, email verification tokens, reset requests, delegated login, MCP OAuth authorization/token exchange and public share links (non-existent tokens) are counted per IP. By default, 10 failures within 15 minutes ban that IP for 15 minutes, and each repeat ban grows to 1 hour → 6 hours → 24 hours (cap) (the level resets 7 days after the last ban). While banned, only the auth and token routes return 429 + Retry-After (the regular API for logged-in users is not blocked). IPv6 is counted per /64. Accounts are never locked; once an account passes 5 failures, only the delay before the next attempt grows: 1 s, 2 s, 4 s… up to 5 minutes. A success resets the counters.

docker compose exec -T db psql \
  -c "UPDATE ip_bans SET banned_until = now() WHERE banned_until > now()"
docker compose restart app   # to clear the in-memory ban list as well

3-G. OpenID Connect sign-in (optional)

Adds "Sign in with " to the login screen. Works with OpenID Connect providers such as Google Workspace, Microsoft Entra ID, Keycloak and Authentik. The password stays at the provider; Inkling receives a signed id_token and issues its usual session (docs/adr/1160-*). Password sign-in keeps working next to it.

  1. Register Inkling as a confidential web client (authorization code flow) at the provider with the redirect URI <PUBLIC_URL>/api/auth/oidc/callback, e.g. https://notes.example.com/api/auth/oidc/callback. PUBLIC_URL is required; the server does not start with OIDC configured and no PUBLIC_URL.
  2. Put the issuer, client id and secret in .env and restart:
envMeaningDefault
OIDC_ISSUERIssuer URL, exactly as the provider's discovery document states itnone (off)
OIDC_CLIENT_ID / OIDC_CLIENT_SECRETClient credentials. The secret is sent only to the token endpoint, never logged or returnednone
OIDC_NAMEButton label ("Sign in with ")SSO
OIDC_ALLOWED_DOMAINSComma-separated email domains allowed to sign in; needs email_verifiedempty (anyone the provider issues)
OIDC_AUTO_CREATE1 = first sign-in of someone new creates an account (no signup key)0
OIDC_LINK_EXISTING1 = connect to an existing local account with the same, provider-verified email (never admins)0
OIDC_REQUIRE_MFA1 = refuse sign-ins whose id_token shows no second factor (amr/acr)0
OIDC_ACR_VALUESacr values to request; a returned one in this list counts as a second factorempty
OIDC_TRUST_EMAIL1 = treat the email as verified when the provider sends no email_verified0
OIDC_SCOPESRequested scopesopenid email profile
OIDC_ID_TOKEN_ALGThe one accepted id_token algorithm: RS256, PS256 or ES256RS256

Issuer examples:

ProviderOIDC_ISSUERNotes
Google Workspacehttps://accounts.google.comRestrict with OIDC_ALLOWED_DOMAINS=<your domain>. Google sends no amr, so leave OIDC_REQUIRE_MFA=0 and enforce 2-Step Verification in the Admin console.
Microsoft Entra IDhttps://login.microsoftonline.com/<tenant-id>/v2.0Use the tenant id, not common/organizations. Turn on the optional email claim. Entra sends no email_verified: account creation needs OIDC_TRUST_EMAIL=1, and email linking stays off.
Keycloakhttps://<host>/realms/<realm>For OIDC_REQUIRE_MFA, configure ACR levels and set OIDC_ACR_VALUES, or add an amr mapper.
Authentikhttps://<host>/application/o/<slug>/Keep the trailing slash: it is part of the issuer.

How accounts are matched (docs/adr/1161-*): by the provider's issuer and subject, never by email alone. Someone who already has an Inkling account connects the provider in Settings › Account (the safe way). With OIDC_LINK_EXISTING=1 the first sign-in also connects to an account with the same email if the provider marks that email verified. People with no account get one only with OIDC_AUTO_CREATE=1; signup keys are not asked for, so set OIDC_ALLOWED_DOMAINS (the server warns at boot when it is empty). On an empty instance the first account becomes admin, as with any signup.

Two-step verification (docs/adr/1162-*): accounts created by the provider use the provider's second factor and count as verified for workspaces that require two-step verification. To make Inkling check it, set OIDC_REQUIRE_MFA=1. Accounts that also have Inkling's own two-step verification are asked for the code after the provider.

Problems show up on the login screen as a fixed message and in the server log as [oidc] callback refused: <CODE> (<reason>). OIDC_STATE_INVALID usually means the sign-in took longer than 10 minutes or was started in another tab or browser; OIDC_UNAVAILABLE means the discovery document, keys or token endpoint could not be reached (check the issuer and the container's outbound network).

3-H. Semantic search (optional)

Off unless both EMBEDDING_URL and EMBEDDING_MODEL are set (docs/adr/1740-*). When on, find_context also ranks sections by meaning, and the server sends the text of every section chunk (page title, heading path, chunk text) to that endpoint, once per change. With a hosted provider that is a third party; a local model server (Ollama, text-embeddings-inference) keeps notes on your network. Put the variables in .env (examples in .env.example) and restart:

envMeaningDefault
EMBEDDING_URLBase URL of an OpenAI-compatible API (https://api.openai.com/v1, Ollama http://host:11434/v1) or the full …/embeddings URLnone (off)
EMBEDDING_MODELModel name; changing it re-embeds everythingnone (off)
EMBEDDING_API_KEYSent as Authorization: Bearer …; never logged or shownnone
EMBEDDING_DIMENSIONSSent as dimensions (models that can shorten vectors)model default
EMBEDDING_BATCH_SIZEChunks per request (1–256)32
EMBEDDING_REQUESTS_PER_MINUTEIndexer request rate60
EMBEDDING_TIMEOUT_MSIndexer request timeout30000
EMBEDDING_QUERY_TIMEOUT_MSTimeout of the query embedding of one search; on timeout search answers lexically3000
EMBEDDING_MAX_CHARSCharacters of one chunk sent to the model4000
EMBEDDING_CACHE_MBIn-process vector cache for queries128
EMBEDDING_QUERY_PREFIXText put before every search query ("query: " for e5 models); taken as written; changing it re-embeds everythingempty
EMBEDDING_PASSAGE_PREFIXText put before every section sent for embedding ("passage: " for e5); changing it re-embeds everythingempty

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. Boot log, progress, memory and how to turn it off again: docs/OPERATIONS.md section 5.

3-H2. Uploads by AI agents

Agents attach files to pages with the MCP tool upload_file, and API tokens with POST /api/files (docs/adr/2044-, 2065-). Each workspace can follow the server default or turn it on or off (Workspace settings › Connected agents › File uploads; owners and admins). People's uploads in the browser and agents reading attachments are never affected. Put the variables in .env only to change the defaults; Admin › Status shows the values in use.

envMeaningDefault
AGENT_UPLOADSon = allowed unless a workspace turns it off; off = refused unless a workspace turns it on; never = refused everywhere, workspaces cannot turn it on. Any other value counts as off, with a warning at booton
AGENT_UPLOAD_MAX_MBLargest file an agent may upload, in MB (at most 64; higher values are cut with a warning). Above 8, MCP requests that call upload_file may be as large as the file in base64 plus 1 MB; other MCP requests keep 12 MB. Memory per upload in flight is about four times the file5
AGENT_UPLOAD_DAILY_MBBudget per account per 24 hours over the files that account's connections uploaded; 0 = no budget. Browser uploads do not count and have none200

3-I. One server process per database

The server refuses to start while another Inkling process uses the same database, because two processes overwrite each other's documents (docs/adr/1925-*). docker compose up -d stops the old container first, so normal updates are not affected. Put the variables in .env only if you need to change the default:

envMeaningDefault
SINGLE_INSTANCE0 (or false/off/no) turns the guard off, with a warning at boot. Only for a deliberate extra process against a live database, or behind a transaction-mode pooler; never for a second web serveron
SINGLE_INSTANCE_WAITSeconds a starting server waits for the other process to stop (a replaced container still saving documents) before it exits60

Log lines and what to do: docs/OPERATIONS.md section 9.

3-J. Push notifications and the web clipper (0.18)

Both work with the setup above and need no extra proxy route: /sw.js, /push-sw.js, /api/push/*, /api/clip and /clip are ordinary app paths behind the catch-all reverse_proxy. Push needs the site on HTTPS (3-B; browsers refuse push on plain http except localhost), and the proxy must keep the app's Cache-Control: no-cache on /sw.js and /push-sw.js. What the server needs is outbound HTTPS: to the browsers' push services on port 443 (fcm.googleapis.com, *.push.services.mozilla.com, *.push.apple.com, *.notify.windows.com) for push, and to any public web server on ports 80/443 for the clipper's "Article text" (and for CIMD documents when OAUTH_CIMD=1). A security list or firewall that blocks egress leaves push silent and saves every article clip as a link. The VAPID key is made on first use and kept in the database; set APP_SECRET_KEY in .env so it is stored sealed, and VAPID_SUBJECT=mailto:you@your-domain for iPhones. Variables and details: docs/OPERATIONS.md section 12.

4. Backups

The backup service in compose.yaml backs up the database and the data volume every day at 03:00 (verified, GFS retention, weekly restore test) — no crontab needed. Status, "Back up now" and downloads: Admin › Backups. Off-site copies (rclone), encryption, and restoring with ./deploy/restore.sh: docs/BACKUP.md.

./deploy/backup.sh            # back up now
./deploy/backup.sh list
./deploy/restore.sh --dry-run <set-id>

Older ./backups/nodian-db-*.dump files from the previous script can still be restored with docker compose exec -T -e PGOPTIONS="-c statement_timeout=0" db sh -c 'pg_restore -d "$POSTGRES_DB" --clean --no-owner' < <file> (PGOPTIONS keeps a role- or database-level statement_timeout from cutting a long restore; the backup scripts set the same for every psql / pg_dump / pg_restore they run).

5. Updating

Migrations run automatically, in one transaction, when the new app boots; the old version keeps the database until then. Take a backup first, then (add your -f files to every compose command):

cd /opt/inkling
./deploy/backup.sh                 # ends with "ok set=<id> ..."
git pull                           # compose files and deploy scripts
# optional: pin the release in .env as INKLING_VERSION=X.Y.Z (or X.Y)
docker compose pull app
docker compose up -d app
docker compose logs --tail 50 app  # migration result and "Server listening"

Source build instead: git pull && docker compose -f compose.yaml -f compose.build.yaml up -d --build app (or docker compose up -d --build app when the two lines are in compose.override.yaml).

Moving an existing source-built install to the published image: nothing is migrated by the switch itself, the database and volumes stay as they are. Check that the release you pull is not older than the code you were running (git describe --tags in the checkout; an install built from main after the latest release must wait for the next release or keep building from source, because an older image does not know the newer schema). Then follow the steps above. Every release is tested for an upgrade from each earlier release (.github/workflows/upgrade.yml). Downgrading is not supported: to go back, restore the backup taken before the upgrade (docs/BACKUP.md) and set INKLING_VERSION to the old release.

Upgrading to 0.19: the nodian → inkling names

Up to 0.18 the compose project, the volumes and the database role were named nodian. From 0.19 they follow INKLING_DATA_NAME in .env, which has no default: with the new compose.yaml and no such line, every compose command stops with "required variable INKLING_DATA_NAME is missing a value" before it creates or stops anything, so an upgraded server never comes up on new, empty volumes. On a server that ran 0.18 or older:

./deploy/backup.sh
printf '\nINKLING_DATA_NAME=nodian\n' >> .env   # keep the old names: the upgrade changes nothing else
git pull && docker compose pull app && docker compose up -d
# later, if you want the new names (copies the volumes; the old ones stay until you delete them):
./deploy/rename-from-nodian.sh --dry-run   # sizes, free disk, expected downtime
./deploy/rename-from-nodian.sh             # back at any point: ./deploy/rename-from-nodian.sh --rollback

Keeping nodian is supported. What the script does, the downtime, the way back and the special cases (local trials, COMPOSE_PROJECT_NAME, overrides, cron lines that name containers): docs/OPERATIONS.md "Upgrading to 0.19", docs/adr/2340-, 2341-.

On a server where Docker runs through sudo, run the script the same way: sudo ./deploy/rename-from-nodian.sh --dry-run. It writes .env in place (owner and mode kept) and keeps its state in ./backups/rename-nodian-to-inkling/ (root-owned then). If .env belongs to root, add the line with sudo sh -c "printf '\nINKLING_DATA_NAME=nodian\n' >> .env".

0.19 applies two migrations (0059_share_allow_download, a column with a constant default, and 0060_onboarding, a new table with one row per existing account). The v0.18.0 image started on a database with 0059 applied, so going back to 0.18.0 did not need a restore in a check on a near-empty database; with 0060 this was not checked again. Keep the backup from before the upgrade (docs/OPERATIONS.md "Upgrades"). New accounts see a short intro and a Getting started card; ONBOARDING=off in .env turns them off for everyone (docs/OPERATIONS.md section 13).

On a stop signal (SIGTERM) the app saves collaborative documents being edited to the DB before exiting, which takes up to ~25 seconds. compose's stop_grace_period: 30s waits for this, so don't cut it short with docker kill / docker compose kill. A new container started while the old one is still saving waits for it (SINGLE_INSTANCE_WAIT, section 3-I).

Local trial (deploy/local.sh)

For trying Inkling on your own computer, not for a server other people use.

git clone <repo-url> inkling && cd inkling
./deploy/local.sh            # or ./deploy/local.sh --build to build this checkout instead of pulling

What it does, once: writes .env (marked "made by deploy/local.sh") with a hex POSTGRES_PASSWORD and an APP_SECRET_KEY from openssl rand, PUBLIC_URL=http://localhost:<port>, COOKIE_SECURE=0, BACKUP_ENABLED=0, INKLING_PORT=127.0.0.1:<port> (the first free of 3000, 3987, 3001–3010, or INKLING_PORT=… from the environment), INKLING_DATA_NAME=inkling and COMPOSE_FILE=compose.yaml:compose.local.yaml with COMPOSE_PROJECT_NAME=inkling-local. Then it starts the stack, waits for /api/health and prints the first-admin setup link and the MCP address. It never touches a .env it did not write.

Without --build the script pulls the published image (ghcr.io/prove1352/inkling, the INKLING_VERSION tag, default latest). The setup link exists from 0.17 on: an image older than 0.17 (an INKLING_VERSION set to an earlier release) prints no link, and the script says so and points to ./deploy/signup-key.sh new "first admin" (open /register and paste the key). --build builds the checkout you cloned and has the setup link either way; the first build takes a few minutes. A later ./deploy/local.sh without --build keeps building from source once you chose it.

Needs bash, curl and Docker Compose v2.24 or newer (compose.local.yaml uses !override). On Windows, run it from WSL or Git Bash.

compose.local.yaml gives the trial its own compose project (its containers and volumes never mix with the main stack on the same machine), no host port for the database and no backup sidecar. Because .env names the files, plain docker compose logs -f app and ./deploy/signup-key.sh act on the trial. ./deploy/local.sh stop stops it; ./deploy/local.sh destroy deletes its containers and volumes (the .env stays; delete it to start over with new secrets).

Connecting an agent: open http://localhost:<port>/settings/connections, issue an agent connection token, and point the client at http://localhost:<port>/mcp with Authorization: Bearer <token> (for Claude Code: claude mcp add --transport http inkling http://localhost:<port>/mcp --header "Authorization: Bearer <token>").

Moving a trial to a real server is a fresh install plus an import: export the workspace as a zip and import it there (pages and attachments move; comments and version history stay behind).

Notes

Markdown sourceView on GitHubAll docs