Troubleshoot a self-hosted deployment
Diagnose startup, migration, storage, email, publishing, domain, proxy, and search failures without destroying recoverable state.
- 13 min read
- Updated
On this page
Start with the failed user outcome and the first relevant error. Preserve the
current .env, database, storage, and logs before recreating services. Do not
delete volumes or run a clean reset as a troubleshooting shortcut.
Run from the deployment directory. In a guided-installer directory, omit
-f docker-compose.prod.yml:
docker compose -f docker-compose.prod.yml ps
docker compose -f docker-compose.prod.yml logs migrate
docker compose -f docker-compose.prod.yml logs --since=15m server worker app
docker compose -f docker-compose.prod.yml config --services
Do not post docker compose config or .env; rendered configuration can contain
secrets. When asking for help, include the Nibleaf tag and digest, Compose
version, affected service, redacted error, expected behavior, and exact time.
The following health contract applies to images containing the updated health routes; older pinned releases may have a different response or lack the detailed route. Check the deployed image revision before configuring monitoring.
- API readiness: use
http://127.0.0.1:4311/healthinside theservercontainer. Compose and Coolify use the HTTP status:200after API/queue initialization,503while starting or shutting down. The public JSON contains onlystatusand the existingrevision; it exposes no storage or provider detail. - Process liveness: if your platform separates liveness from readiness, use a TCP check on the API listener. Do not restart a live API just because an explicitly required storage check is temporarily unavailable.
- Other services: retain
/healthon app port4310, admin port4315, and the private worker operations port4312. The app wrapper and release verifier still use/api/app/healthand the app's/healthrevision contract. Keep the worker port private: its existing body contains queue/email diagnostics. Source Compose binds it to loopback; production/Coolify keep it on their internal network.
For API storage and analytics diagnostics, set INTERNAL_API_SECRET in the API
container environment and request /health/details with the
x-nibleaf-internal header. Reuse the existing internal secret where configured;
do not replace an existing key to diagnose health. Source, production, and
Coolify templates forward this secret. Missing, wrong, or unset secrets return
401; detailed responses use Cache-Control: private, no-store.
docker compose -f docker-compose.prod.yml exec -T server sh -c \
'curl -sS -H "x-nibleaf-internal: $INTERNAL_API_SECRET" http://127.0.0.1:4311/health/details'
The detailed route uses the same readiness HTTP status, so the example omits
curl -f to show diagnostics during 503 responses. Never place the secret in a
URL, browser code, public probe, or support transcript. A proxy or ingress can
make the detailed route reachable; it fails closed without the matching secret
header. The dashboard's standard proxy preserves /api: /api/health/details
is forwarded to that same API path, while the detailed handler is registered at
API-root /health/details, so the dashboard doesn't expose it. A custom ingress
that maps the API root does. Keep the worker operations listener private.
STORAGE_REQUIRED_FOR_HEALTH=false is the default: failed bucket checks are
diagnostic and do not block an initialized API. With true, a successful bucket
check is also required for 200; object-only credentials may lack the necessary
bucket-level permission. CORS never gates readiness. Set the option in the
container environment; an older pinned Compose file may need a reviewed override
to forward it without editing its checksummed release asset.
Network and provider 5xx failures retry with backoff capped at 30 seconds,
including outages longer than the initial startup window. Continuing failures
use debug logs between warnings on every tenth attempt. Rejected credentials
or permissions stop the affected bootstrap operation with a warning: fix the
credentials/permissions and restart the API, or provision CORS externally and set
STORAGE_AUTO_CORS=false. Detailed health exposes storage.ready, storage.cors,
and storage.requiredForHealth; cors: null means automatic CORS is disabled.
These checks do not prove that browser uploads work through the public storage endpoint.
| Symptom | Likely cause | Next check |
|---|---|---|
| Compose exits before creating services | A required environment value is empty. | Read the interpolation error and compare .env with the template from the same release. |
| App waits for the server | Server health is failing or migrate did not complete. | Read migrate, then the first server error. |
| Production refuses authentication secret | The value is empty, weak, or a known demo default. | For a new install, generate an independent value. For an existing install, restore the correct existing secret; do not overwrite keys to repair an env-loading problem. |
| Image pull is denied or missing | The tag does not exist or registry access failed. | Confirm the tag on the release page and run docker compose pull directly. |
Pull reports no matching manifest, or a container exits with exec format error | The host is not linux/amd64. The published image supports only that architecture. | Run uname -m. Anything other than x86_64 needs an amd64 host. |
The installer stops with Unsupported architecture | The host is not linux/amd64. | Use an amd64 host. Do not work around the check. |
The installer stops with Existing installation | The directory or Docker already holds a Nibleaf installation. | Do not remove it to get past the check. Use the upgrade guide. |
Do not skip migrations by removing dependencies from the Compose file.
server and worker do not become ready, app waits for the API, and the logs show:
Unknown recurring configuration in analytics; complete the migration using the retained staged v5 image
v0.2.1 started on schedules from v0.1.2, usually because the version was changed without the staged migration. Your data is intact. Do not delete the Dragonfly volume, remove jobs, or re-run the installer. Follow If you skip the staged step.
The browser uses STORAGE_PUBLIC_ENDPOINT, not the internal Docker hostname.
Confirm DNS, TLS, bucket CORS, credentials, path-style mode, and the signed host.
Open the browser network error and compare its origin with APP_URL and
STORAGE_CORS_ALLOWED_ORIGINS.
An internal storage health check can pass while the public upload path fails.
Check the worker log, sender verification, Postmark message stream or SMTP URL,
recipient spam folder, and provider activity. Passwordless sign-in requires
delivery of a one-time code. In development, or when delivery is optional, the
worker can log development mail instead. Required production delivery fails
when neither Postmark nor SMTP is configured, and the worker health check returns
503 until one is. EMAIL_DELIVERY_REQUIRED defaults to true. Set it to false only
when Google sign-in is configured, because nobody can receive an email code without a
provider.
Check worker health and queue connectivity, then read the deployment error and worker log at the publish time. The public site should continue serving the previous ready version. Correct the cause and publish forward; do not modify the database status manually.
Check whether WORKER_QUEUES is empty or includes the required export or git
queue. Then inspect worker health and the durable run or operation record in the
dashboard. For PDF-only failures, verify EXPORT_CHROMIUM_PATH inside the worker.
For Git failures, preserve the operation and conflict record; retry through the
documented reconciliation flow instead of force-pushing the authoring branch.
Changing GIT_CREDENTIAL_ENCRYPTION_KEY cannot repair a decryption error and
will make existing credentials unreadable. Restore the correct key or follow a
controlled disconnect/reconnect rotation.
Confirm DNS, certificate name, primary-domain status, original Host forwarding,
and the configured base/CNAME targets. Test the app directly with the intended
host header only from a trusted operator environment. A proxy that replaces all
customer hosts with its internal upstream name prevents project resolution.
See Readers see “Too many requests” for how to set INTERNAL_API_SECRET and count TRUSTED_PROXY_HOPS.
Draft changes do not enter public search until a deployment is ready. Confirm the page is published and indexable, search its exact title, then a distinctive body phrase. For Arabic, test normalized spelling variants and consult Arabic and RTL.
For security-sensitive behavior, stop public troubleshooting and use the
private reporting path in the repository's SECURITY.md.
The docs site can remain healthy while analytics is unavailable. Inspect the
analytics field on API and worker /health; keep it separate from core alarms.
For unavailable, check network/DNS, credentials, database name and ClickHouse
logs. Restore connectivity and let the worker retry; do not restart databases or
clear queues. Watch oldest pending jobs and failed-job replay so outages do not
silently become missing history.
For schema_outdated, check that a worker is running, analytics is enabled and
CLICKHOUSE_MIGRATE_ON_BOOT=true. Check writer CREATE/ALTER permissions. Run the
explicit clickhouse-migrate command with the same Postgres and ClickHouse
database settings if automatic migrations are disabled. A successful ping alone
does not establish schema currency.
For stuck migrations, inspect worker migration logs, pg_stat_activity and
pg_locks (advisory locks), and ClickHouse system.processes and
system.mutations. Lock holders may legitimately be another worker or the CLI.
Do not clear migration-version records or kill locks to bypass a running DDL
operation. Confirm the owning process and query have stopped before retrying.
For disk pressure, inspect system.parts by database/table and both the data and
log volumes. Bundled configuration disables new noisy system logs and rotates
text logs; old system tables are not automatically removed. Review them with an
operator before targeted cleanup. Copy backups off-host, then review retention;
TTL merges need free space and are asynchronous. Never delete ClickHouse data
files, run broad OPTIMIZE FINAL on a full host, or erase queues to make health green.
If health is ok but no new events arrive, check ANALYTICS_HASH_SALT before
network debugging. With ClickHouse analytics enabled and no salt, events are
dropped even though schema health is healthy. Restore the existing deployment
secret; never replace it to fix a missing environment variable. Schema health
results can be up to ten seconds old; the worker migration flag is immediate.
Check the exact Compose file list and deployed image. .env supplies Compose
interpolation; it is not automatically the container environment. The pinned
v0.2.1 production file passes no ClickHouse/search controls, queue allowlist,
export tuning, or MCP write limits. Use a reviewed override and a matching
image, then recreate the affected service. Do not print the full environment
or rendered configuration into a support ticket. See the
release wiring reference.
Check the site’s AI opt-in, provider selection, encryption-key availability on API and worker, Qdrant connectivity, and the READY index for the current publication. Saving a workspace connection does not select it. A selected workspace provider never falls back to the instance key. OpenAI/ChatGPT OAuth for model credentials is unavailable; MCP OAuth is a different connection.
A catalog verification does not check provider credit or run inference. Use a fictional question after enabling the connection. Do not replace an encryption key to fix an unreadable credential; restore the existing keyring.
Chat reports stable in-stream codes: conversation_limit means start a new
chat; quota_exhausted is the daily answer quota; budget_exhausted is the
project token budget; rate_limited is the caller’s short-term limit.
unavailable can mean provider/index configuration or unavailable quota storage.
Check the safe API request ID and startup budget warning. The current search
overlay’s 60000-token cap differs from the schema default of 150000 and can
refuse a large turn before a provider call.
If history is empty while chat works, check analytics mode, the analytics
worker queue, ClickHouse schema/health, ANALYTICS_HASH_SALT, the transcript
setting and consent. API and worker must resolve the same conversation transport
key. Do not change that key while sealed queue jobs are pending. A healthy
ClickHouse schema does not prove a turn was captured.
For MCP failures, use the MCP error guide. If an audit-settle error follows a write, re-read the target before retrying; the draft may already have changed. A publish preview is project-wide.
Symptom: readers, link checkers or search engines get 429 Too Many Requests, even though each person reads only a few pages.
Cause: the API limits public requests per visitor address (RATE_LIMIT_PUBLIC_PER_MIN, 300 a minute by default). A published page is rendered by the app container, which calls the API on the reader's behalf. The API trusts the reader's address that the app forwards only when INTERNAL_API_SECRET is set to the same value on the app and API services. Without it, every reader shares the app container's address and one 300-a-minute allowance.
Fix:
- Generate a secret, for example with
openssl rand -hex 32. - Set
INTERNAL_API_SECRETto that same value for the app and API services, then recreate them. - Set
TRUSTED_PROXY_HOPSto the number of addresses that appear after the client's address inX-Forwarded-Foron a normal request, private addresses included. Each proxy records the address it received the request from, so your CDN/edge, load-balancer and reverse-proxy addresses show up one hop later. Set the same value on the app and API services; the default is0. Configure your ingress to remove untrusted forwarding headers, and inspect the actual chain each service receives before choosing the value. - Raise
RATE_LIMIT_PUBLIC_PER_MINonly if real readers still hit the limit.
The production and Coolify Compose files (docker-compose.prod.yml and
docker-compose.coolify.yml) pass both settings to the app and API services.
The source docker-compose.yml passes INTERNAL_API_SECRET but not
TRUSTED_PROXY_HOPS, so add an override file next to it. docker compose reads docker-compose.override.yml automatically; if you
run with -f docker-compose.yml, also add -f docker-compose.override.yml:
# docker-compose.override.yml, next to the source docker-compose.yml
services:
server:
environment:
TRUSTED_PROXY_HOPS: ${TRUSTED_PROXY_HOPS:-0}
app:
environment:
TRUSTED_PROXY_HOPS: ${TRUSTED_PROXY_HOPS:-0}
Worked examples: the addresses below are illustrative. 9.9.9.9 is a
client-supplied forged entry, 203.0.113.7 is the real client, 198.51.100.x
are public CDN or load-balancer addresses, and 172.17.0.1 is a private
reverse proxy. A private nginx in front of Nibleaf records the client's address,
so with nginx alone the header is 9.9.9.9, 203.0.113.7 and nothing follows the
client: use 0.
| Header received | Addresses after the client | TRUSTED_PROXY_HOPS | Selected client address |
|---|---|---|---|
9.9.9.9, 203.0.113.7 | None; private nginx only | 0 | 203.0.113.7 |
9.9.9.9, 203.0.113.7 | None, but the value is set too high | 1 | 9.9.9.9 — forged |
9.9.9.9, 203.0.113.7, 198.51.100.9 | One: the CDN/edge | 1 | 203.0.113.7 |
9.9.9.9, 203.0.113.7, 198.51.100.9, 198.51.100.10 | Two: the CDN/edge and the load balancer | 2 | 203.0.113.7 |
9.9.9.9, 203.0.113.7, 198.51.100.9, 172.17.0.1 | Two: Cloudflare, then host nginx (private), behind Traefik | 2 | 203.0.113.7 |
9.9.9.9, 203.0.113.7, 198.51.100.9, 172.17.0.1 | Two, but only the public one counted | 1 | 198.51.100.9 — every reader shares Cloudflare's address |
Both parsers first remove the configured number of trailing header entries,
always keeping at least one, then scan right to left past private addresses and
take the first public one. That is why private addresses must be counted when a
public address comes before them. If every address after the client is private
and the reader's own address is public, counting them or not gives the same
result. When readers have private addresses (an internal network or VPN),
count the private addresses after the client too. Verify the headers actually
received by each service; a diagram's proxy count alone is insufficient. A
value that is too high can discard the real client and select an attacker’s
forged entry, letting them change their rate-limit identity. Do not tune this value merely to make 429 disappear.
Verify: confirm the selected address with the actual header chain, including
a deliberately forged leftmost entry, then open a few pages from two different
networks. Neither should see 429.