From da6a4528f1b4d24798083e0769be9ec37c660287 Mon Sep 17 00:00:00 2001 From: "Mikhail f. Shiryaev" Date: Wed, 4 Oct 2023 11:24:36 +0200 Subject: [PATCH] Make clickhouse-server package providing clickhouse-keeper --- packages/clickhouse-keeper.yaml | 4 ++-- packages/clickhouse-server.postinstall | 21 +++++++++++++++++++++ packages/clickhouse-server.yaml | 20 ++++++++++++++------ 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/packages/clickhouse-keeper.yaml b/packages/clickhouse-keeper.yaml index 0fbb0fde00a..9dad5382c08 100644 --- a/packages/clickhouse-keeper.yaml +++ b/packages/clickhouse-keeper.yaml @@ -31,10 +31,10 @@ contents: - src: root/etc/clickhouse-keeper/keeper_config.xml dst: /etc/clickhouse-keeper/keeper_config.xml type: config|noreplace -- src: root/usr/bin/clickhouse-keeper - dst: /usr/bin/clickhouse-keeper - src: clickhouse-keeper.service dst: /lib/systemd/system/clickhouse-keeper.service +- src: root/usr/bin/clickhouse-keeper + dst: /usr/bin/clickhouse-keeper - src: clickhouse-keeper dst: /usr/bin/clickhouse-keeper-client type: symlink diff --git a/packages/clickhouse-server.postinstall b/packages/clickhouse-server.postinstall index f5d473f7c9b..d3b49db758f 100644 --- a/packages/clickhouse-server.postinstall +++ b/packages/clickhouse-server.postinstall @@ -13,6 +13,11 @@ CLICKHOUSE_BINDIR=${CLICKHOUSE_BINDIR:-/usr/bin} CLICKHOUSE_GENERIC_PROGRAM=${CLICKHOUSE_GENERIC_PROGRAM:-clickhouse} CLICKHOUSE_PIDDIR=/var/run/$PROGRAM +# Provide clickhouse-keeper +KEEPER_CONFDIR=${KEEPER_CONFDIR:-/etc/clickhouse-keeper} +KEEPER_DATADIR=${KEEPER_DATADIR:-/var/lib/clickhouse} +KEEPER_LOGDIR=${KEEPER_LOGDIR:-/var/log/clickhouse-keeper} + [ -f /usr/share/debconf/confmodule ] && . /usr/share/debconf/confmodule [ -f /etc/default/clickhouse ] && . /etc/default/clickhouse @@ -54,4 +59,20 @@ if [ "$1" = configure ] || [ -n "$not_deb_os" ]; then fi done fi + + # Setup clickhouse-keeper directories + chown -R "${CLICKHOUSE_USER}:${CLICKHOUSE_GROUP}" "${KEEPER_CONFDIR}" + chmod 0755 "${KEEPER_CONFDIR}" + + if ! [ -d "${KEEPER_DATADIR}" ]; then + mkdir -p "${KEEPER_DATADIR}" + chown -R "${CLICKHOUSE_USER}:${CLICKHOUSE_GROUP}" "${KEEPER_DATADIR}" + chmod 0700 "${KEEPER_DATADIR}" + fi + + if ! [ -d "${KEEPER_LOGDIR}" ]; then + mkdir -p "${KEEPER_LOGDIR}" + chown -R "${CLICKHOUSE_USER}:${CLICKHOUSE_GROUP}" "${KEEPER_LOGDIR}" + chmod 0770 "${KEEPER_LOGDIR}" + fi fi diff --git a/packages/clickhouse-server.yaml b/packages/clickhouse-server.yaml index 17c3fe7f694..5e2bc7c7412 100644 --- a/packages/clickhouse-server.yaml +++ b/packages/clickhouse-server.yaml @@ -22,12 +22,11 @@ deb: Source: clickhouse # Package specific content -conflicts: -- clickhouse-keeper replaces: - clickhouse-server-common - clickhouse-server-base provides: +- clickhouse-keeper - clickhouse-server-common recommends: - libcap2-bin @@ -53,16 +52,25 @@ contents: dst: /lib/systemd/system/clickhouse-server.service - src: root/usr/bin/clickhouse-copier dst: /usr/bin/clickhouse-copier +- src: root/usr/bin/clickhouse-report + dst: /usr/bin/clickhouse-report +- src: root/usr/bin/clickhouse-server + dst: /usr/bin/clickhouse-server +# clickhouse-keeper part +- src: root/etc/clickhouse-keeper/keeper_config.xml + dst: /etc/clickhouse-keeper/keeper_config.xml + type: config|noreplace +- src: clickhouse-keeper.service + dst: /lib/systemd/system/clickhouse-keeper.service - src: clickhouse dst: /usr/bin/clickhouse-keeper type: symlink - src: clickhouse dst: /usr/bin/clickhouse-keeper-client type: symlink -- src: root/usr/bin/clickhouse-report - dst: /usr/bin/clickhouse-report -- src: root/usr/bin/clickhouse-server - dst: /usr/bin/clickhouse-server +- src: clickhouse + dst: /usr/bin/clickhouse-keeper-converter + type: symlink # docs - src: ../AUTHORS dst: /usr/share/doc/clickhouse-server/AUTHORS