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:
| Service | System role | Durable state or access |
|---|---|---|
| Web | Serves the Karakeep UI and API | Reads and writes the database and assets through the data directory |
| Workers | Runs crawl, inference, search, feed, webhook, backup, and maintenance jobs | Shares the data directory and reaches Meilisearch and Chrome |
| Meilisearch | Stores and serves the search index | Uses its own persistent data store |
| Chrome | Runs browser sessions for pages that need JavaScript or screenshots | Holds 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 group | Operational purpose |
|---|---|
NEXTAUTH_URL, NEXTAUTH_SECRET | Set the public address and protect session tokens |
DATA_DIR, ASSETS_DIR | Choose where the database and local assets live |
MEILI_ADDR, MEILI_MASTER_KEY | Connect Karakeep to the search service and protect it in production |
BROWSER_WEB_URL or BROWSER_WEBSOCKET_URL | Connect browser-based crawling to Chrome or another browser service |
WORKERS_ENABLED_WORKERS, WORKERS_DISABLED_WORKERS | Select background worker roles |
OPENAI_API_KEY or OLLAMA_BASE_URL | Enable external or local inference |
| S3 asset settings | Move asset storage from the local filesystem to S3-compatible storage |
REDIS_URL | Provide 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:7700andchrome:9222as service endpoints. - Keep
DATA_DIRaligned 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-latestnow 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
| Trigger | Consequence | Guard |
|---|---|---|
NEXTAUTH_SECRET is missing | The server configuration cannot produce the signing secret and startup fails | Set a strong persistent secret in the runtime secret store |
NEXTAUTH_URL does not match the public address | Auth redirects and callback URLs point to the wrong host | Set it to the externally reachable Karakeep URL |
| Web and workers do not share the persistent data location | Jobs and requests can see different database or asset state | Mount the same data store and use the same DATA_DIR |
| Workers start before database migration | Worker startup can fail or jobs can run against an old schema | Preserve the migration dependency or run migration first |
| Search is enabled without a reachable Meilisearch or matching key | Search requests or indexing jobs fail | Check MEILI_ADDR, MEILI_MASTER_KEY, service DNS, and persistent index storage |
| Browser crawling has no reachable browser endpoint | Browser features such as JavaScript execution and screenshots are unavailable | Configure the Karakeep Chrome image or a remote browser through BROWSER_WEB_URL or BROWSER_WEBSOCKET_URL |
| Chrome's published version or architecture manifest is missing | Browser-based jobs cannot start on the target platform | Publish both required architecture images and verify the promoted manifest |
| Chrome sandbox is enabled on a host that blocks user namespaces | Chrome exits instead of serving the browser endpoint | Allow the needed user namespaces and container policy, or leave the optional sandbox disabled |
| OTLP event export is enabled without an endpoint | Configuration validation stops startup | Set OTEL_EXPORTER_OTLP_LOGS_ENDPOINT or disable export |
| A monitoring scrape omits the bearer token | Protected metrics endpoints return an authentication error | Use the same explicit PROMETHEUS_AUTH_TOKEN in Karakeep and the scraper |
| Persistent claims are too small for assets or the search index | Writes fail after storage fills | Size the data and Meilisearch volumes for the workload |
| A workflow action reference is not present in actions.lock | The CI action-lock job fails before other checks run | Run the lock update tool and keep the generated lock file committed |
| The CI runner does not support the pinned Playwright Chromium install | The test job fails before browser tests run | Use Ubuntu 24.04 while Playwright 1.59 cannot install Chromium on Ubuntu 26.04 |
| The CI runner cannot enable Docker's containerd image store | E2E image loading or reuse fails before the E2E suite | Keep the runner Docker setup compatible with the E2E Compose workflow |
| The Chrome image values cannot be read from chrome.yml | The E2E test job stops before it can select or build the browser image | Keep the image, browser version, and revision entries present and valid |
| The CI changed-path base cannot be fetched or checkout depth is too shallow | The job builds Chrome instead of reusing it, or cannot select the intended comparison base | Keep the fetch depth and event-specific base SHA logic valid |
| An E2E image job is not included in the wait list | Tests can start before a required image is ready | Keep the background job IDs and final wait list synchronized |
| Android release tag does not match the workflow pattern | No Android build or AAB artifact starts | Use the android/v<version>-<build> tag form |
| An iOS release tag does not match the workflow pattern | No iOS build or IPA artifact starts | Use the ios/v<version>-<build> tag form |
EXPO_TOKEN is not available to a mobile release job | The EAS build cannot authenticate | Add the token to the CI secret store before creating the release tag |
| The Android build lacks its JDK or Android SDK runner setup | The local Android build cannot produce the AAB | Keep the JDK 17 and Android SDK setup steps available |
| The iOS release runner does not provide the required Xcode environment | The local iOS build cannot produce the IPA | Keep the xcode-27 runner available for the workflow |
| Generated OpenAPI files are out of date | The CI OpenAPI job rejects the change | Run the OpenAPI generation command and commit the generated result |
Key files
| File | Why to read it |
|---|---|
| docker/docker-compose.yml | Shows the standard production service graph and persistent volumes |
| docker/docker-compose.build.yml | Shows the production-like service graph used with a locally built image |
| docker/docker-compose.dev.yml | Shows local development services and migration ordering |
docker/Dockerfile | Shows the available production image modes and runtime health check |
docker/root/etc/s6-overlay/scripts/drop-privileges | Shows the shared runtime privilege boundary |
docker/chrome/Dockerfile | Shows the supported browser architectures and exposed browser endpoint |
| docker/…/entrypoint.sh | Shows how the browser endpoint becomes reachable to Karakeep |
| docker/…/README.md | Shows browser image security, testing, and release rules |
| .github/…/ci.yml | Shows validation, runner requirements, E2E image selection, and generated contract checks before delivery |
| .github/…/actions.lock | Shows the pinned GitHub Actions and their commit identities that CI verifies |
| .github/…/docker.yml | Shows how runtime images are built, tagged, and published for both supported architectures |
| .github/…/chrome.yml | Shows the browser image build and publication path |
| .github/…/android.yml | Shows the tag-driven Android release build and artifact delivery path |
| .github/…/ios.yml | Shows the tag-driven iOS release build and artifact delivery path |
| kubernetes/kustomization.yaml | Shows how Kubernetes resources receive configuration, secrets, and image versions |
| kubernetes/web-deployment.yaml | Shows the public application pod and its data dependency |
| kubernetes/meilisearch-deployment.yaml | Shows the search service and its persistent index store |
| kubernetes/data-pvc.yaml | Shows the sample claim for application data |
| packages/…/config.ts | Defines runtime inputs, derived settings, and startup validation |
| apps/…/index.ts | Shows worker selection, queue startup, and shutdown coordination |
| packages/…/metrics.ts | Shows the protected API metrics hook |
| apps/…/server.ts | Shows worker health and metrics hooks |
| packages/…/tracing.ts | Shows trace export and service identity behavior |
| packages/…/eventLogger.ts | Shows event log export behavior |