Skip to content

Commit

Permalink
[bitnami][clickhouse] Fix ClickHouse bug on custom init/start script (#…
Browse files Browse the repository at this point in the history
…72646)

[bitnami][clickhouse] Correct ClickHouse behavior when user adds custom init/start script

Signed-off-by: Tin Trung Ngo <trungtinth1011@gmail.com>
  • Loading branch information
Trungtin1011 authored Oct 3, 2024
1 parent 08502b1 commit aaeb3f9
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ clickhouse_copy_mounted_configuration() {
info "Copying mounted configuration from $CLICKHOUSE_MOUNTED_CONF_DIR"
# Copy first the files at the base of the mounted folder to go to ClickHouse
# base etc folder
find "$CLICKHOUSE_MOUNTED_CONF_DIR" -maxdepth 1 \( -type f -o -type l \) -exec cp -L {} "$CLICKHOUSE_CONF_DIR" \;
find "$CLICKHOUSE_MOUNTED_CONF_DIR" -maxdepth 1 \( -type f -o -type l \) -exec cp -L -r {} "$CLICKHOUSE_CONF_DIR" \;

# The ClickHouse override directories (etc/conf.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
if [[ -d "${CLICKHOUSE_MOUNTED_CONF_DIR}/conf.d" ]]; then
find "${CLICKHOUSE_MOUNTED_CONF_DIR}/conf.d" \( -type f -o -type l \) -exec cp -L {} "${CLICKHOUSE_CONF_DIR}/conf.d" \;
find "${CLICKHOUSE_MOUNTED_CONF_DIR}/conf.d" \( -type f -o -type l \) -exec cp -L -r {} "${CLICKHOUSE_CONF_DIR}/conf.d" \;
fi
if [[ -d "${CLICKHOUSE_MOUNTED_CONF_DIR}/users.d" ]]; then
find "${CLICKHOUSE_MOUNTED_CONF_DIR}/users.d" \( -type f -o -type l \) -exec cp -L {} "${CLICKHOUSE_CONF_DIR}/users.d" \;
find "${CLICKHOUSE_MOUNTED_CONF_DIR}/users.d" \( -type f -o -type l \) -exec cp -L -r {} "${CLICKHOUSE_CONF_DIR}/users.d" \;
fi
fi
else
Expand Down Expand Up @@ -233,7 +233,7 @@ clickhouse_start_bg() {
is_clickhouse_running && return
# This function is meant to be called for internal operations like the init scripts
local -r cmd=("${CLICKHOUSE_BASE_DIR}/bin/clickhouse-server")
local -r args=("--config-file=${CLICKHOUSE_CONF_FILE}" "--pid-file=${CLICKHOUSE_PID_FILE}" "--" "--listen_host=127.0.0.1")
local -r args=("--config-file=${CLICKHOUSE_CONF_FILE}" "--pid-file=${CLICKHOUSE_PID_FILE}" "--" "--listen_host=0.0.0.0")
if am_i_root; then
run_as_user "$CLICKHOUSE_DAEMON_USER" "${cmd[@]}" "${args[@]}" >"$log_file" 2>&1 &
else
Expand Down

0 comments on commit aaeb3f9

Please sign in to comment.