diff --git a/bitnami/clickhouse-keeper/25/debian-12/Dockerfile b/bitnami/clickhouse-keeper/25/debian-12/Dockerfile index 5f722a23fa4b..fef950c22d73 100644 --- a/bitnami/clickhouse-keeper/25/debian-12/Dockerfile +++ b/bitnami/clickhouse-keeper/25/debian-12/Dockerfile @@ -8,10 +8,10 @@ ARG TARGETARCH LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2025-04-09T13:00:58Z" \ + org.opencontainers.image.created="2025-04-10T11:04:40Z" \ org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/clickhouse-keeper/README.md" \ - org.opencontainers.image.ref.name="25.3.2-debian-12-r6" \ + org.opencontainers.image.ref.name="25.3.2-debian-12-r7" \ org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/clickhouse-keeper" \ org.opencontainers.image.title="clickhouse-keeper" \ org.opencontainers.image.vendor="Broadcom, Inc." \ diff --git a/bitnami/clickhouse-keeper/25/debian-12/rootfs/opt/bitnami/scripts/clickhouse-keeper/setup.sh b/bitnami/clickhouse-keeper/25/debian-12/rootfs/opt/bitnami/scripts/clickhouse-keeper/setup.sh index f58b43abff44..ea855fc3a1b0 100755 --- a/bitnami/clickhouse-keeper/25/debian-12/rootfs/opt/bitnami/scripts/clickhouse-keeper/setup.sh +++ b/bitnami/clickhouse-keeper/25/debian-12/rootfs/opt/bitnami/scripts/clickhouse-keeper/setup.sh @@ -18,6 +18,16 @@ set -o pipefail # Ensure 'daemon' user exists when running as 'root' am_i_root && ensure_user_exists "$CLICKHOUSE_DAEMON_USER" --group "$CLICKHOUSE_DAEMON_GROUP" +if ! is_positive_int "$CLICKHOUSE_KEEPER_SERVER_ID"; then + # The ID might have a string prefix (e.g. it's set on K8s using valueFrom:fieldRef:fieldPath: metadata.name) + if [[ "$CLICKHOUSE_KEEPER_SERVER_ID" =~ ^([a-zA-Z0-9-]+)-([0-9]+)$ ]]; then + export CLICKHOUSE_KEEPER_SERVER_ID=${BASH_REMATCH[2]} + else + error "The environment variable CLICKHOUSE_KEEPER_SERVER_ID must be a positive integer" + exit 1 + fi +fi + # Ensure ClickHouse Keeper environment settings are valid keeper_validate # Ensure ClickHouse Keeper is initialized diff --git a/bitnami/clickhouse-keeper/25/debian-12/rootfs/opt/bitnami/scripts/libclickhousekeeper.sh b/bitnami/clickhouse-keeper/25/debian-12/rootfs/opt/bitnami/scripts/libclickhousekeeper.sh index 4d68dd903a65..afb240297999 100644 --- a/bitnami/clickhouse-keeper/25/debian-12/rootfs/opt/bitnami/scripts/libclickhousekeeper.sh +++ b/bitnami/clickhouse-keeper/25/debian-12/rootfs/opt/bitnami/scripts/libclickhousekeeper.sh @@ -110,11 +110,12 @@ keeper_copy_mounted_configuration() { # base etc folder find "$CLICKHOUSE_KEEPER_MOUNTED_CONF_DIR" -maxdepth 1 \( -type f -o -type l \) -exec cp -L -r {} "$CLICKHOUSE_KEEPER_CONF_DIR" \; - # The ClickHouse override directories (etc/conf.d, etc/config.d and etc/users.d) do not support subfolders. That means we cannot + # The ClickHouse override directories (etc/conf.d, etc/keeper_config.d and etc/users.d) do not support subfolders. That means we cannot # copy directly with cp -RL because we need all override xml files to have at the root of these subfolders. In the Helm # chart we want to allow overrides from different ConfigMaps and Secrets so we need to use the find command. - for dir in conf.d config.d users.d; do + for dir in conf.d keeper_config.d users.d; do if [[ -d "${CLICKHOUSE_KEEPER_MOUNTED_CONF_DIR}/${dir}" ]]; then + mkdir -p "${CLICKHOUSE_KEEPER_CONF_DIR}/${dir}" find "${CLICKHOUSE_KEEPER_MOUNTED_CONF_DIR}/${dir}" \( -type f -o -type l \) -exec cp -L -r {} "${CLICKHOUSE_KEEPER_CONF_DIR}/${dir}" \; fi done @@ -143,6 +144,7 @@ keeper_initialize() { # For the container itself we keep the logic simple. In the helm chart we rely on the mounting of configuration files with overrides # ref: https://github.com/ClickHouse/ClickHouse/blob/master/docker/keeper/entrypoint.sh keeper_conf_set "/clickhouse/keeper_server/server_id" "$CLICKHOUSE_KEEPER_SERVER_ID" + keeper_conf_set "/clickhouse/keeper_server/raft_configuration/server/id" "$CLICKHOUSE_KEEPER_SERVER_ID" is_boolean_yes "${BITNAMI_DEBUG}" && keeper_conf_set "/clickhouse/logger/level" "debug" fi