Introducing a new way to review your PRs.

Read the announcement

karakeep-app / karakeep

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

View on GitHub

21 documents · Updated Nov 23, 2026

docs / deployment-and-runtime-operations

Deployment and runtime operations

Karakeep runs as a web application with background work, durable data, search, and browser automation. Local Docker Compose and Kubernetes provide the main runtime shapes. Production images can run the web application and workers together or as separate services.

Runtime composition

The runtime has one public service and several supporting services. The web service handles user traffic and API calls. Workers process work outside the request path. Meilisearch serves search indexes, and Chrome provides a controlled browser session for pages that need browser automation.

The main runtime relationships are:

ServiceSystem roleDurable state or access
WebServes the Karakeep UI and APIReads and writes the database and assets through the data directory
WorkersRuns crawl, inference, search, feed, webhook, backup, and maintenance jobsShares the data directory and reaches Meilisearch and Chrome
MeilisearchStores and serves the search indexUses its own persistent data store
ChromeRuns browser sessions for pages that need JavaScript or screenshotsHolds no Karakeep data

The standard production Compose file exposes only the web service. It connects web to Meilisearch and Chrome by their Compose service names. The development file adds workers and a one-shot preparation step. The build Compose file keeps the production service graph while building the all-in-one image locally. References: docker/docker-compose.yml• L1-44, docker/docker-compose.build.yml• L1-34, docker/docker-compose.dev.yml• L1-115

Container modes

The application image supports two deployment shapes. The all-in-one image starts web, workers, and the database migration service under one container supervisor. Separate web and worker images use the same built application but let an operator scale or restart each role on its own.

The separate worker image assumes that database migration has already finished. This makes migration order an operational dependency when web and workers run as different containers. The image also provides CLI and MCP server targets for workloads that need those entry points rather than the main service. References: docker/Dockerfile#L231-L282, docker/root/etc/s6-overlay/s6-rc.d/init-db-migration/run#L1-L6

The web, worker, and migration processes use a shared startup wrapper that enables no_new_privs and drops Linux capabilities when the container permits it. This limits the effect of tools that those processes start. The wrapper keeps only the capabilities needed for data access and, when required, binding to a privileged port. References: docker/root/etc/s6-overlay/s6-rc.d/svc-web/run#L1-L5, docker/root/etc/s6-overlay/s6-rc.d/svc-workers/run#L1-L5, docker/root/etc/s6-overlay/scripts/drop-privileges#L1-L73

The startup sequence for the all-in-one image is:

flowchart TD
    A[Container starts] --> B[Database migration]
    B --> C[Web service]
    B --> D[Worker service]
    C --> E[Health endpoint]
    D --> F[Worker health and metrics]

The supervisor starts migration before the web and worker services. Docker reports the image as healthy when the web health endpoint responds successfully. References: docker/Dockerfile#L231-L247, docker/root/etc/s6-overlay/s6-rc.d/init-db-migration/run#L1-L6, docker/root/etc/s6-overlay/s6-rc.d/svc-web/run#L1-L5, docker/root/etc/s6-overlay/s6-rc.d/svc-workers/run#L1-L5

Local development

Local development uses Docker Compose to give the web app and workers a live view of the source tree. The development stack mounts the repository and keeps dependency data in named volumes. It enables file polling so source changes are seen from inside the container.

The prep service is not a long-running application service. It creates the data directory, installs the locked dependency set, and runs database migrations. Web and workers wait for that service to complete. Chrome and Meilisearch provide the same network dependencies used by production. References: docker/docker-compose.dev.yml• L3-43, docker/docker-compose.dev.yml• L64-115

Browser runtime

The Chrome image provides the browser endpoint used by browser-based crawling. It prefers Google Chrome on amd64 and uses Debian Chromium on arm64 because Google does not publish a Linux Chrome build for that architecture. The image exposes the DevTools endpoint on port 9222 and runs without a GPU while keeping WebGL available through SwiftShader. References: docker/chrome/Dockerfile#L3-L12, docker/chrome/Dockerfile#L25-L57, docker/…/README.md• L1-11, docker/…/entrypoint.sh• L15-28

The container runs Chrome as an unprivileged user and removes setuid and setgid binaries. Chrome's own sandbox is off by default because common container security profiles block the user namespaces it needs. Operators can enable it only when the host and container security policy allow those namespaces. References: docker/chrome/Dockerfile#L48-L57, docker/…/README.md• L13-33, docker/…/entrypoint.sh• L9-19

The container keeps Chrome's DevTools listener on localhost and forwards the service port to it. This gives Karakeep a network endpoint without changing Chrome's local binding. Extra browser flags can pass through the container command. References: docker/…/entrypoint.sh• L1-28

The browser image is tested through the end-to-end crawler path. Its checks cover browser control, page navigation, JavaScript, request routing, the CDP redirect guard, screenshots, and PDFs. Image publication requires native amd64 and arm64 build jobs. References: docker/…/README.md• L35-47, .github/…/chrome.yml• L38-72

Production image delivery

Production images are built from one multi-stage Docker definition. The build produces targets for web, workers, the all-in-one service, CLI, and MCP. CI builds each target for amd64 and arm64, then publishes multi-platform image manifests to the GitHub Container Registry. The manifest job publishes both the current karakeep-app names and the older hoarder-app aliases for the web, workers, CLI, and all-in-one images. The MCP image uses only the karakeep-app name. References: .github/…/docker.yml• L10-52, .github/…/docker.yml• L54-121, docker/Dockerfile#L231-L282

Repository CI provides the source and contract checks used before runtime delivery. It runs for pull requests, pushes to main, and merge queues. The checks cover action-lock verification, lint, format, types, package tests, end-to-end tests with Chromium, and OpenAPI file generation. The test job uses Ubuntu 24.04 because Playwright 1.59 cannot install Chromium on Ubuntu 26.04, which ubuntu-latest now selects. It enables Docker's containerd image store, starts the web-image build and Chrome-image selection in parallel, and waits for both before end-to-end tests. It reads the Chrome image, browser version, and image revision from the Chrome workflow. It reuses the published browser image only when the relevant browser inputs are unchanged and the image is available; otherwise it builds the image. It also uploads Docker logs when end-to-end checks fail. The OpenAPI check fails when generated files are not current. References: .github/…/ci.yml• L3-32, .github/…/ci.yml• L34-71, .github/…/ci.yml• L72-210, .github/…/ci.yml• L211-237, .github/…/actions.lock• L1-120

The action lock records the exact action versions and commit identities used by repository workflows. The CI action-lock job verifies that workflow references still match this file before the other validation jobs provide delivery confidence. References: .github/…/actions.lock• L1-120, .github/…/ci.yml• L18-32

Image tags separate moving development images from release images. A push to main updates latest tags. A GitHub release publishes the release name and release tags. Operators can therefore pin a release or choose the moving stable tag in their deployment configuration. References: .github/…/docker.yml• L1-8, .github/…/docker.yml• L39-52, .github/…/docker.yml• L90-121

The Chrome image follows a separate versioned release path. The current workflow builds Google Chrome 157.0.8103.78 for amd64 and Debian Chromium for arm64. It publishes the immutable version tag with image revision r1, plus latest and release manifests. A new browser release uses a new version tag. A packaging-only change increments the image revision instead of changing the browser version. References: docker/…/README.md• L49-64, .github/…/chrome.yml• L20-24, .github/…/chrome.yml• L74-181

Mobile Android and iOS delivery use separate tag-driven paths. Android builds run on Ubuntu with JDK 17 and the Android SDK. iOS builds run on the xcode-27 runner. Each workflow creates a mobile artifact and submits it to its platform store. These workflows do not change server image tags or the Kubernetes version input. References: .github/…/android.yml• L1-54, .github/…/ios.yml• L1-43

Kubernetes resources

The Kubernetes deployment groups all resources in the karakeep namespace through Kustomize. The web, Chrome, and Meilisearch workloads each run as a single-replica Deployment. Services provide internal names for Chrome and Meilisearch. The web Service is a LoadBalancer by default, so a cluster can provide external access without an extra ingress layer.

PersistentVolumeClaims keep the application data and Meilisearch index separate. Both sample claims use ReadWriteOnce and request 1 GiB. Operators must review these storage settings for the expected asset volume and cluster storage class before production use. References: kubernetes/kustomization.yaml• L1-25, kubernetes/namespace.yaml• L1-4, kubernetes/web-deployment.yaml• L1-40, kubernetes/web-service.yaml• L1-12, kubernetes/chrome-deployment.yaml• L1-23, kubernetes/chrome-service.yaml• L1-12, kubernetes/meilisearch-deployment.yaml• L1-32, kubernetes/meilisearch-service.yaml• L1-11, kubernetes/data-pvc.yaml• L1-10, kubernetes/meilisearch-pvc.yaml• L1-10

Kustomize creates a ConfigMap from .env and a Secret from .secrets. It injects both into the web and Meilisearch pods. The configured Karakeep version also replaces the web image tag, so the version input is part of the deployment update path. References: kubernetes/kustomization.yaml• L6-43, kubernetes/web-deployment.yaml• L21-36, kubernetes/meilisearch-deployment.yaml• L18-28

An ingress is optional. The sample routes a chosen host to the web Service. If an ingress is used, the web Service should be changed to ClusterIP so external traffic enters through the ingress instead of through the LoadBalancer. References: kubernetes/ingress_sample.yaml• L1-17, docs/…/04-kubernetes.md• L52-70

Configuration inputs

Karakeep reads environment variables and turns them into runtime settings. The most important deployment inputs define the public URL, session signing secret, data location, service addresses, worker selection, logging, and optional external systems.

Input groupOperational purpose
NEXTAUTH_URL, NEXTAUTH_SECRETSet the public address and protect session tokens
DATA_DIR, ASSETS_DIRChoose where the database and local assets live
MEILI_ADDR, MEILI_MASTER_KEYConnect Karakeep to the search service and protect it in production
BROWSER_WEB_URL or BROWSER_WEBSOCKET_URLConnect browser-based crawling to Chrome or another browser service
WORKERS_ENABLED_WORKERS, WORKERS_DISABLED_WORKERSSelect background worker roles
OPENAI_API_KEY or OLLAMA_BASE_URLEnable external or local inference
S3 asset settingsMove asset storage from the local filesystem to S3-compatible storage
REDIS_URLProvide Redis when an enabled plugin or deployment feature needs it

DATA_DIR must point to the mounted persistent location. By default, local assets sit below that directory. If S3 is enabled, the bucket and credentials become an external storage dependency. A change between local and S3 storage needs a manual asset migration. References: packages/…/config.ts• L282-299, packages/…/config.ts• L455-456, packages/…/config.ts• L488-510, docs/…/01-environment-variables.md• L13-18, docs/…/01-environment-variables.md• L34-53

Optional features add their own dependencies. Email verification needs SMTP settings. Automatic tagging needs an inference provider. Semantic search and automatic embeddings need the matching model and vector settings. These choices affect worker load and external service cost, so they should be made with the background processing and search, inference, and plugins operating models in mind. References: packages/…/config.ts• L322-396, packages/…/config.ts• L548-585, docs/…/01-environment-variables.md• L85-127

Operational dependencies

The web service depends on the database and persistent asset storage for core operation. Background work depends on the shared database, the queue system, and the services selected by each worker. Search depends on Meilisearch. Browser crawling depends on the Karakeep Chrome image or a configured remote browser. Inference depends on the selected model provider.

The dependency flow is:

flowchart LR
    U[User or API client] --> W[Web service]
    W --> DB[(Database)]
    W --> A[(Assets)]
    W --> Q[Work queues]
    Q --> X[Workers]
    X --> DB
    X --> A
    X --> M[Meilisearch]
    X --> C[Chrome or remote browser]
    X --> I[Inference provider]

The web and worker processes must use compatible configuration and the same durable data set. A worker can start without every optional provider, but the related feature will be unavailable or its jobs can fail when that provider is required. References: docker/docker-compose.yml• L5-21, docker/docker-compose.dev.yml• L74-109, apps/…/index.ts• L43-126, packages/…/config.ts• L334-436

Observability hooks

Karakeep exposes health and metrics endpoints for runtime checks. The web API provides /api/health; the worker HTTP server provides /health and a protected /metrics endpoint. The API also exposes metrics through its own /api/metrics route. Metrics use Prometheus format and require the configured bearer token.

The main signals are:

  • Web health indicates that the public application process answers requests.
  • Worker health indicates that the worker process HTTP server answers requests.
  • Prometheus metrics cover default process data plus API, queue, worker, crawler, and crawl-latency signals.
  • OpenTelemetry traces can go to an OTLP endpoint, or to the console when tracing is enabled without an endpoint.
  • Event logs can stay local or export through OTLP when both the feature and its endpoint are configured.

The metrics token is generated at startup when PROMETHEUS_AUTH_TOKEN is not set. Set it explicitly when a monitoring system must keep the same credential across restarts. References: packages/…/health.ts• L1-16, packages/…/metrics.ts• L1-30, apps/…/server.ts• L10-18, apps/…/metrics.ts• L4-35, packages/…/config.ts• L189-190, packages/…/config.ts• L501-504

Tracing and event logs use the configured service name and append a role suffix for web or workers. This lets a telemetry system separate request work from background work while keeping both under the Karakeep service identity. Event log export fails configuration validation if export is enabled without an OTLP logs endpoint. References: packages/…/config.ts• L270-279, packages/…/config.ts• L534-546, packages/…/config.ts• L565-573, packages/…/tracing.ts• L38-76, packages/…/eventLogger.ts• L59-115

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the service names and internal URLs aligned across Compose and Kubernetes. Web and workers use meilisearch:7700 and chrome:9222 as service endpoints.
  • Keep DATA_DIR aligned with the container mount and the PVC or Docker volume. A path mismatch can make the process look healthy while writing data outside the intended persistent store.
  • Keep migration order aligned with the selected image mode. Separate workers must not start before the migration step completes.
  • Keep the image target, published tag, and Kubernetes version replacement aligned when adding or renaming a container image.
  • Keep the Chrome browser version, image revision, architecture builds, and promoted tags aligned when changing browser delivery.
  • Keep the Android release tag pattern, Expo and EAS credentials, and uploaded AAB name aligned when changing mobile release delivery.
  • Keep the iOS release tag pattern, Expo and EAS credentials, and uploaded IPA name aligned when changing mobile release delivery.
  • Keep metrics bearer-token handling aligned between the API route, worker route, and monitoring scrape configuration.
  • Keep optional provider settings and worker enablement aligned. Enabling inference, search, browser crawling, or S3 storage without its matching dependency changes feature behavior.
  • Keep reduced-privilege startup compatible with the selected ports and mounted data directory. A host policy that blocks capability changes can alter the warning path or prevent a privileged port from binding.
  • Keep generated OpenAPI files aligned with their source when API contracts change. CI rejects a change when regeneration produces a dirty working tree.
  • Keep workflow action references aligned with .github/…/actions.lock; CI verifies the lock file before other checks run.
  • Keep the CI runner version aligned with the Playwright Chromium version. The test job uses Ubuntu 24.04 because Playwright 1.59 does not install Chromium on Ubuntu 26.04, which ubuntu-latest now selects.
  • Keep the CI Chrome image values aligned with the Chrome workflow's image, browser version, and revision. E2E image reuse also depends on the changed-path check and the published tag being available.
  • Keep the CI base-commit selection and checkout depth aligned with the changed-path check. Pull requests, pushes, and merge queues compare different base values.
  • Keep the CI containerd image-store setup aligned with the E2E Compose build and cache assumptions. A change to either side can make image reuse or loading fail before tests run.
  • Keep the background E2E image job names aligned with the final wait step. A renamed or removed job can let tests start before required images are ready.

Important failure modes

TriggerConsequenceGuard
NEXTAUTH_SECRET is missingThe server configuration cannot produce the signing secret and startup failsSet a strong persistent secret in the runtime secret store
NEXTAUTH_URL does not match the public addressAuth redirects and callback URLs point to the wrong hostSet it to the externally reachable Karakeep URL
Web and workers do not share the persistent data locationJobs and requests can see different database or asset stateMount the same data store and use the same DATA_DIR
Workers start before database migrationWorker startup can fail or jobs can run against an old schemaPreserve the migration dependency or run migration first
Search is enabled without a reachable Meilisearch or matching keySearch requests or indexing jobs failCheck MEILI_ADDR, MEILI_MASTER_KEY, service DNS, and persistent index storage
Browser crawling has no reachable browser endpointBrowser features such as JavaScript execution and screenshots are unavailableConfigure the Karakeep Chrome image or a remote browser through BROWSER_WEB_URL or BROWSER_WEBSOCKET_URL
Chrome's published version or architecture manifest is missingBrowser-based jobs cannot start on the target platformPublish both required architecture images and verify the promoted manifest
Chrome sandbox is enabled on a host that blocks user namespacesChrome exits instead of serving the browser endpointAllow the needed user namespaces and container policy, or leave the optional sandbox disabled
OTLP event export is enabled without an endpointConfiguration validation stops startupSet OTEL_EXPORTER_OTLP_LOGS_ENDPOINT or disable export
A monitoring scrape omits the bearer tokenProtected metrics endpoints return an authentication errorUse the same explicit PROMETHEUS_AUTH_TOKEN in Karakeep and the scraper
Persistent claims are too small for assets or the search indexWrites fail after storage fillsSize the data and Meilisearch volumes for the workload
A workflow action reference is not present in actions.lockThe CI action-lock job fails before other checks runRun the lock update tool and keep the generated lock file committed
The CI runner does not support the pinned Playwright Chromium installThe test job fails before browser tests runUse Ubuntu 24.04 while Playwright 1.59 cannot install Chromium on Ubuntu 26.04
The CI runner cannot enable Docker's containerd image storeE2E image loading or reuse fails before the E2E suiteKeep the runner Docker setup compatible with the E2E Compose workflow
The Chrome image values cannot be read from chrome.ymlThe E2E test job stops before it can select or build the browser imageKeep the image, browser version, and revision entries present and valid
The CI changed-path base cannot be fetched or checkout depth is too shallowThe job builds Chrome instead of reusing it, or cannot select the intended comparison baseKeep the fetch depth and event-specific base SHA logic valid
An E2E image job is not included in the wait listTests can start before a required image is readyKeep the background job IDs and final wait list synchronized
Android release tag does not match the workflow patternNo Android build or AAB artifact startsUse the android/v<version>-<build> tag form
An iOS release tag does not match the workflow patternNo iOS build or IPA artifact startsUse the ios/v<version>-<build> tag form
EXPO_TOKEN is not available to a mobile release jobThe EAS build cannot authenticateAdd the token to the CI secret store before creating the release tag
The Android build lacks its JDK or Android SDK runner setupThe local Android build cannot produce the AABKeep the JDK 17 and Android SDK setup steps available
The iOS release runner does not provide the required Xcode environmentThe local iOS build cannot produce the IPAKeep the xcode-27 runner available for the workflow
Generated OpenAPI files are out of dateThe CI OpenAPI job rejects the changeRun the OpenAPI generation command and commit the generated result

Key files

FileWhy to read it
docker/docker-compose.ymlShows the standard production service graph and persistent volumes
docker/docker-compose.build.ymlShows the production-like service graph used with a locally built image
docker/docker-compose.dev.ymlShows local development services and migration ordering
docker/DockerfileShows the available production image modes and runtime health check
docker/root/etc/s6-overlay/scripts/drop-privilegesShows the shared runtime privilege boundary
docker/chrome/DockerfileShows the supported browser architectures and exposed browser endpoint
docker/…/entrypoint.shShows how the browser endpoint becomes reachable to Karakeep
docker/…/README.mdShows browser image security, testing, and release rules
.github/…/ci.ymlShows validation, runner requirements, E2E image selection, and generated contract checks before delivery
.github/…/actions.lockShows the pinned GitHub Actions and their commit identities that CI verifies
.github/…/docker.ymlShows how runtime images are built, tagged, and published for both supported architectures
.github/…/chrome.ymlShows the browser image build and publication path
.github/…/android.ymlShows the tag-driven Android release build and artifact delivery path
.github/…/ios.ymlShows the tag-driven iOS release build and artifact delivery path
kubernetes/kustomization.yamlShows how Kubernetes resources receive configuration, secrets, and image versions
kubernetes/web-deployment.yamlShows the public application pod and its data dependency
kubernetes/meilisearch-deployment.yamlShows the search service and its persistent index store
kubernetes/data-pvc.yamlShows the sample claim for application data
packages/…/config.tsDefines runtime inputs, derived settings, and startup validation
apps/…/index.tsShows worker selection, queue startup, and shutdown coordination
packages/…/metrics.tsShows the protected API metrics hook
apps/…/server.tsShows worker health and metrics hooks
packages/…/tracing.tsShows trace export and service identity behavior
packages/…/eventLogger.tsShows event log export behavior