fix(docs): remove QDB_CAIRO_ROOT from the Docker Compose example - #487
Open
nwoolmer wants to merge 1 commit into
Open
fix(docs): remove QDB_CAIRO_ROOT from the Docker Compose example#487nwoolmer wants to merge 1 commit into
nwoolmer wants to merge 1 commit into
Conversation
The "Custom data directory permissions" example set QDB_CAIRO_ROOT=/var/lib/questdb. That is unnecessary, because the Docker image already passes /var/lib/questdb as its root directory, and it is harmful, because an absolute cairo.root changes how every other directory is derived. With an absolute cairo.root, PropServerConfiguration creates conf, import, export, tmp and .checkpoint as siblings of the data directory rather than as children of the root directory. Following the example therefore places all of them in /var/lib, outside the mounted volume and in a directory the container user cannot write to. CHECKPOINT CREATE fails with: Could not create [dir=/var/lib/.checkpoint//var/lib/questdb/] Drop the variable from the example, add a caution explaining why it must not be set, and document the same behaviour on the cairo.root reference entry. Also rewrite the volume permissions warning, which described the default image behaviour inaccurately. The image starts as root, takes ownership of the data directory and drops privileges; pinning user: is what skips that step, so the host directory must already be writable by the pinned uid. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The "Custom data directory permissions" example on Configure QuestDB with Docker Compose sets
QDB_CAIRO_ROOT=/var/lib/questdb. This was reported by a customer on 9.4.3, whoseCHECKPOINT CREATEfailed with:The variable is both unnecessary and harmful:
docker-entrypoint.shalready passes-d /var/lib/questdbas the install root, so the data directory is/var/lib/questdbwith or without it.cairo.rootflipsPropServerConfigurationinto a different branch (PropServerConfiguration.java:971) in which every other directory is derived as a sibling of the data directory rather than a child of the root directory.Measured against the real config object, mirroring the container layout:
QDB_CAIRO_ROOT)/var/lib/questdb/db/var/lib/questdb/var/lib/questdb/.checkpoint/var/lib/.checkpoint/var/lib/questdb/conf/var/lib/conf/var/lib/questdb/import/var/lib/import/var/lib/questdb/export/var/lib/export/var/lib/questdb/tmp/var/lib/tmpEverything marked⚠️ lands outside the mounted volume, in root-owned
/var/lib, which the container user cannot write to. Anyone following this example has a database whose checkpoint, import, export and temp directories are all outside their volume.The doubled slash in the error is a second effect: with an absolute
cairo.root,getDbDirectory()returns the full path instead of"db", andDatabaseCheckpointAgent.java:204concatenates it as a relative segment.Changes
QDB_CAIRO_ROOTfrom the Compose example and add a caution explaining why it must not be set under Docker.cairo.rootreference entry, which previously only described the relative case.user:is what skips that step, so the host directory must already be writable by the pinned uid.user: "1000:1000"is kept — for a bind mount the kernel checks the numeric uid against the host directory's owner, and 1000 is the usual first non-root account on a Linux host.Follow-up (not in this PR)
Worth hardening core so this surfaces as a config error rather than a nonsense path: either have
DatabaseCheckpointAgentuse the leaf directory name rather thangetDbDirectory()verbatim (used as a relative segment in ~12 places there), or reject an absolutecairo.rootat boot.Testing
PropServerConfigurationwith and without an absolutecairo.root, against a writable mirror of the container layout — with a matched control.npm run buildfails in this environment inside thefetch-repoplugin (network fetch ofgithub-api.questdb.ioreturns non-JSON) before MDX compilation, unrelated to these changes.🤖 Generated with Claude Code