Skip to content

Commit 35d2bfe

Browse files
authored
[bitnami/clickhouse-keeper] Release clickhouse-keeper-25.3.2-debian-12-r5 (#79967)
Signed-off-by: Bitnami Bot <bitnami.bot@broadcom.com>
1 parent 06c35ff commit 35d2bfe

File tree

7 files changed

+72
-24
lines changed

7 files changed

+72
-24
lines changed

bitnami/clickhouse-keeper/25/debian-12/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ ARG TARGETARCH
88

99
LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \
1010
org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \
11-
org.opencontainers.image.created="2025-04-07T15:08:18Z" \
11+
org.opencontainers.image.created="2025-04-08T07:39:54Z" \
1212
org.opencontainers.image.description="Application packaged by Broadcom, Inc." \
1313
org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/clickhouse-keeper/README.md" \
14-
org.opencontainers.image.ref.name="25.3.2-debian-12-r4" \
14+
org.opencontainers.image.ref.name="25.3.2-debian-12-r5" \
1515
org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/clickhouse-keeper" \
1616
org.opencontainers.image.title="clickhouse-keeper" \
1717
org.opencontainers.image.vendor="Broadcom, Inc." \

bitnami/clickhouse-keeper/25/debian-12/rootfs/opt/bitnami/scripts/clickhouse-keeper-env.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ unset clickhouse_keeper_env_vars
4646
export CLICKHOUSE_KEEPER_BASE_DIR="${BITNAMI_ROOT_DIR}/clickhouse-keeper"
4747
export CLICKHOUSE_KEEPER_VOLUME_DIR="/bitnami/clickhouse-keeper"
4848
export CLICKHOUSE_KEEPER_CONF_DIR="${CLICKHOUSE_KEEPER_BASE_DIR}/etc"
49+
export CLICKHOUSE_KEEPER_DEFAULT_CONF_DIR="${CLICKHOUSE_KEEPER_BASE_DIR}/etc.default"
50+
export CLICKHOUSE_KEEPER_MOUNTED_CONF_DIR="${CLICKHOUSE_KEEPER_VOLUME_DIR}/etc"
4951
export CLICKHOUSE_KEEPER_CONF_FILE="${CLICKHOUSE_KEEPER_CONF_DIR}/keeper_config.xml"
5052
export CLICKHOUSE_KEEPER_DATA_DIR="${CLICKHOUSE_KEEPER_VOLUME_DIR}/coordination"
5153
export CLICKHOUSE_KEEPER_COORD_LOGS_DIR="${CLICKHOUSE_KEEPER_DATA_DIR}/logs"

bitnami/clickhouse-keeper/25/debian-12/rootfs/opt/bitnami/scripts/clickhouse-keeper/entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ set -o pipefail
1818

1919
print_welcome_page
2020

21+
# We add the copy from default config in the entrypoint to not break users
22+
# bypassing the setup.sh logic. If the file already exists do not overwrite (in
23+
# case someone mounts a configuration file at /opt/bitnami/clickhouse-keeper/etc)
24+
debug "Copying files from $CLICKHOUSE_KEEPER_DEFAULT_CONF_DIR to $CLICKHOUSE_KEEPER_CONF_DIR"
25+
if [[ -w "$CLICKHOUSE_KEEPER_CONF_DIR" ]]; then
26+
cp -nr "$CLICKHOUSE_KEEPER_DEFAULT_CONF_DIR"/. "$CLICKHOUSE_KEEPER_CONF_DIR"
27+
else
28+
error "The folder $CLICKHOUSE_KEEPER_CONF_DIR is not writable. This is likely because a read-only filesystem is used, please ensure you mount a writable volume on this path."
29+
exit 1
30+
fi
31+
2132
if [[ "$1" = "/opt/bitnami/scripts/clickhouse-keeper/run.sh" ]]; then
2233
info "** Starting ClickHouse Keeper setup **"
2334
/opt/bitnami/scripts/clickhouse-keeper/setup.sh

bitnami/clickhouse-keeper/25/debian-12/rootfs/opt/bitnami/scripts/clickhouse-keeper/postunpack.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set -o pipefail
1919
ensure_user_exists "$CLICKHOUSE_DAEMON_USER" --group "$CLICKHOUSE_DAEMON_GROUP" --system
2020

2121
# Create directories
22-
for dir in "$CLICKHOUSE_KEEPER_VOLUME_DIR" "$CLICKHOUSE_KEEPER_DATA_DIR" "$CLICKHOUSE_KEEPER_COORD_LOGS_DIR" "$CLICKHOUSE_KEEPER_COORD_SNAPSHOTS_DIR" "$CLICKHOUSE_KEEPER_CONF_DIR" "$CLICKHOUSE_KEEPER_LOG_DIR" "$CLICKHOUSE_KEEPER_TMP_DIR"; do
22+
for dir in "$CLICKHOUSE_KEEPER_VOLUME_DIR" "$CLICKHOUSE_KEEPER_DATA_DIR" "$CLICKHOUSE_KEEPER_COORD_LOGS_DIR" "$CLICKHOUSE_KEEPER_COORD_SNAPSHOTS_DIR" "$CLICKHOUSE_KEEPER_CONF_DIR" "$CLICKHOUSE_KEEPER_DEFAULT_CONF_DIR" "$CLICKHOUSE_KEEPER_LOG_DIR" "$CLICKHOUSE_KEEPER_TMP_DIR"; do
2323
ensure_dir_exists "$dir"
2424
configure_permissions_ownership "$dir" -d "775" -f "664" -u "$CLICKHOUSE_DAEMON_USER" -g "root"
2525
done
@@ -69,6 +69,6 @@ xmlstarlet ed -L -d "/clickhouse/logger/errorlog" "$CLICKHOUSE_KEEPER_CONF_FILE"
6969
keeper_conf_set "/clickhouse/logger/console" "1"
7070
keeper_conf_set "/clickhouse/logger/level" "information"
7171

72-
# Move the original keeper_config.xml, so users can skip initialization logic by mounting
73-
# their own keeper_config.xml directly
74-
mv "$CLICKHOUSE_KEEPER_CONF_FILE" "${CLICKHOUSE_KEEPER_CONF_DIR}/keeper_config.xml.original"
72+
# Move all initially generated configuration files to the default directory
73+
# so users can skip initialization logic by mounting their own configuration directly
74+
mv "${CLICKHOUSE_KEEPER_CONF_DIR}"/* "$CLICKHOUSE_KEEPER_DEFAULT_CONF_DIR"/

bitnami/clickhouse-keeper/25/debian-12/rootfs/opt/bitnami/scripts/clickhouse-keeper/setup.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ set -o pipefail
1818
# Ensure 'daemon' user exists when running as 'root'
1919
am_i_root && ensure_user_exists "$CLICKHOUSE_DAEMON_USER" --group "$CLICKHOUSE_DAEMON_GROUP"
2020

21-
# ClickHouse Keeper initialization, skipped if custom keeper_config.xml was mounted
22-
if ! is_boolean_yes "$CLICKHOUSE_KEEPER_SKIP_SETUP" && [[ ! -f "$CLICKHOUSE_KEEPER_CONF_FILE" ]]; then
23-
# Ensure ClickHouse Keeper environment settings are valid
24-
keeper_validate
25-
# Ensure ClickHouse Keeper is initialized
26-
keeper_initialize
27-
fi
21+
# Ensure ClickHouse Keeper environment settings are valid
22+
keeper_validate
23+
# Ensure ClickHouse Keeper is initialized
24+
keeper_initialize

bitnami/clickhouse-keeper/25/debian-12/rootfs/opt/bitnami/scripts/libclickhousekeeper.sh

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,23 +92,59 @@ keeper_conf_set() {
9292
fi
9393
}
9494

95+
########################
96+
# Copy configuration from the mounted folder to the etc folder
97+
# In charts mounting directly in the configuration folder would not
98+
# allow the use of multiple ConfigMaps and Secrets
99+
# Globals:
100+
# CLICKHOUSE_KEEPER_*
101+
# Arguments:
102+
# None
103+
# Returns:
104+
# None
105+
#########################
106+
keeper_copy_mounted_configuration() {
107+
if ! is_mounted_dir_empty "$CLICKHOUSE_KEEPER_MOUNTED_CONF_DIR"; then
108+
info "Copying mounted configuration from $CLICKHOUSE_KEEPER_MOUNTED_CONF_DIR"
109+
# Copy first the files at the base of the mounted folder to go to ClickHouse
110+
# base etc folder
111+
find "$CLICKHOUSE_KEEPER_MOUNTED_CONF_DIR" -maxdepth 1 \( -type f -o -type l \) -exec cp -L -r {} "$CLICKHOUSE_KEEPER_CONF_DIR" \;
112+
113+
# The ClickHouse override directories (etc/conf.d, etc/config.d and etc/users.d) do not support subfolders. That means we cannot
114+
# copy directly with cp -RL because we need all override xml files to have at the root of these subfolders. In the Helm
115+
# chart we want to allow overrides from different ConfigMaps and Secrets so we need to use the find command.
116+
for dir in conf.d config.d users.d; do
117+
if [[ -d "${CLICKHOUSE_KEEPER_MOUNTED_CONF_DIR}/${dir}" ]]; then
118+
find "${CLICKHOUSE_KEEPER_MOUNTED_CONF_DIR}/${dir}" \( -type f -o -type l \) -exec cp -L -r {} "${CLICKHOUSE_KEEPER_CONF_DIR}/${dir}" \;
119+
fi
120+
done
121+
fi
122+
}
123+
95124
########################
96125
# Initialize ClickHouse Keeper
126+
# Globals:
127+
# CLICKHOUSE_KEEPER_*
97128
# Arguments:
98129
# None
99130
# Returns:
100131
# None
101132
#########################
102133
keeper_initialize() {
103-
info "No injected configuration files found, creating default config files"
104-
# Restore original keeper_config.xml
105-
cp "${CLICKHOUSE_KEEPER_CONF_DIR}/keeper_config.xml.original" "$CLICKHOUSE_KEEPER_CONF_FILE"
134+
# This fixes an issue where the trap would kill the entrypoint.sh, if a PID was left over from a previous run
135+
# Exec replaces the process without creating a new one, and when the container is restarted it may have the same PID
136+
rm -f "$CLICKHOUSE_KEEPER_PID_FILE"
106137

107-
# Logic based on the upstream ClickHouse Keeper container
108-
# For the container itself we keep the logic simple. In the helm chart we rely on the mounting of configuration files with overrides
109-
# ref: https://github.com/ClickHouse/ClickHouse/blob/master/docker/keeper/entrypoint.sh
110-
keeper_conf_set "/clickhouse/keeper_server/server_id" "$CLICKHOUSE_KEEPER_SERVER_ID"
111-
is_boolean_yes "${BITNAMI_DEBUG}" && keeper_conf_set "/clickhouse/logger/level" "debug"
138+
keeper_copy_mounted_configuration
139+
if is_boolean_yes "$CLICKHOUSE_KEEPER_SKIP_SETUP"; then
140+
info "Skipping ClickHouse Keeper setup"
141+
else
142+
# Logic based on the upstream ClickHouse Keeper container
143+
# For the container itself we keep the logic simple. In the helm chart we rely on the mounting of configuration files with overrides
144+
# ref: https://github.com/ClickHouse/ClickHouse/blob/master/docker/keeper/entrypoint.sh
145+
keeper_conf_set "/clickhouse/keeper_server/server_id" "$CLICKHOUSE_KEEPER_SERVER_ID"
146+
is_boolean_yes "${BITNAMI_DEBUG}" && keeper_conf_set "/clickhouse/logger/level" "debug"
147+
fi
112148

113149
# Avoid exit code of previous commands to affect the result of this function
114150
true

bitnami/clickhouse-keeper/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ ClickHouse Keeper can be configured via environment variables or using a configu
160160

161161
### Configuration overrides
162162

163-
The configuration can easily be setup by mounting your own configuration overrides at `/opt/bitnami/clickhouse-keeper/etc/keeper_config.xml`:
163+
The configuration can easily be setup by mounting your own configuration overrides on the directory `/bitnami/clickhouse-keeper/etc/config.d` or `/bitnami/clickhouse-keeper/etc/users.d`:
164164

165165
```console
166166
docker run --name clickhouse-keeper \
167-
--volume /path/to/override.xml:/opt/bitnami/clickhouse-keeper/etc/keeper_config.xml:ro \
167+
--volume /path/to/override.xml:/bitnami/clickhouse-keeper/etc/config.d/override.xml:ro \
168168
bitnami/clickhouse-keeper:latest
169169
```
170170

@@ -177,7 +177,7 @@ services:
177177
clickhouse-keeper:
178178
image: bitnami/clickhouse-keeper:latest
179179
volumes:
180-
- /path/to/override.xml:/opt/bitnami/clickhouse-keeper/etc/keeper_config.xml:ro
180+
- /path/to/override.xml:/bitnami/clickhouse-keeper/etc/config.d/override.xml:ro
181181
```
182182

183183
Check the [official ClickHouse Keeper configuration documentation](https://clickhouse.com/docs/guides/sre/keeper/clickhouse-keeper) for all the possible overrides and settings.
@@ -200,6 +200,8 @@ Check the [official ClickHouse Keeper configuration documentation](https://click
200200
| `CLICKHOUSE_KEEPER_BASE_DIR` | ClickHouse Keeper installation directory. | `${BITNAMI_ROOT_DIR}/clickhouse-keeper` |
201201
| `CLICKHOUSE_KEEPER_VOLUME_DIR` | ClickHouse Keeper volume directory. | `/bitnami/clickhouse-keeper` |
202202
| `CLICKHOUSE_KEEPER_CONF_DIR` | ClickHouse Keeper configuration directory. | `${CLICKHOUSE_KEEPER_BASE_DIR}/etc` |
203+
| `CLICKHOUSE_KEEPER_DEFAULT_CONF_DIR` | ClickHouse Keeper default configuration directory. | `${CLICKHOUSE_KEEPER_BASE_DIR}/etc.default` |
204+
| `CLICKHOUSE_KEEPER_MOUNTED_CONF_DIR` | ClickHouse Keeper mounted configuration directory. | `${CLICKHOUSE_KEEPER_VOLUME_DIR}/etc` |
203205
| `CLICKHOUSE_KEEPER_CONF_FILE` | ClickHouse Keeper configuration file. | `${CLICKHOUSE_KEEPER_CONF_DIR}/keeper_config.xml` |
204206
| `CLICKHOUSE_KEEPER_DATA_DIR` | ClickHouse Keeper data directory. | `${CLICKHOUSE_KEEPER_VOLUME_DIR}/coordination` |
205207
| `CLICKHOUSE_KEEPER_COORD_LOGS_DIR` | ClickHouse Keeper coordination logs directory. | `${CLICKHOUSE_KEEPER_DATA_DIR}/logs` |

0 commit comments

Comments
 (0)