Fix: make ClickHouse start in production - #8
Open
mpont91 wants to merge 1 commit into
Open
Conversation
Two problems stopped the container from ever coming up once CLICKHOUSE_PASSWORD is set, which docker-compose.prod.yaml requires. 001_init.sql created an unauthenticated IDE user. Setting a password takes access management away from the default user, so CREATE USER fails with ACCESS_DENIED and the failure aborts the whole init run: no tables, container exits. Moved to clickhouse/dev/, mounted only by the local compose, where it also belongs on its own merits. The users.d file was mounted read-only at the exact path the image's entrypoint writes when CLICKHOUSE_USER/CLICKHOUSE_PASSWORD are set. Renamed to network-access.xml; users.d loads every file regardless of name. Verified with a password set: container stays up, all 33 init files apply, 162 tables created, no intellij user.
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.
ClickHouse never comes up with
docker-compose.prod.yaml. Two separate causes, both triggered byCLICKHOUSE_PASSWORD, which that file makes mandatory.1. The IDE user aborts the init run.
001_init.sqlends with:Setting a password takes access management away from the
defaultuser, so this fails and takes the whole run with it:No tables are created and the container exits. Local development never hits it because
docker-compose.local.yamlsets no password, leavingdefaultunrestricted.Moved to
clickhouse/dev/999_dev_user.sql, mounted only by the local compose. An unauthenticated user has no business in a production schema anyway.2. The users.d mount collides with the entrypoint. The image writes this exact path when
CLICKHOUSE_USER/CLICKHOUSE_PASSWORDare set:cat <<EOT > /etc/clickhouse-server/users.d/default-user.xmland the compose file mounts a read-only file over it:
Renamed to
network-access.xml. Everything inusers.dis loaded regardless of filename, so it merges with the generated file instead of fighting it.Verified. Before: container exits, 0 tables. After, with a password set: container stays up, all 33 init files apply, 162 tables, no
intellijuser. Local behaviour unchanged.