diff --git a/clickhouse/config.xml b/clickhouse/config.xml index d26bfbb385..8798446895 100644 --- a/clickhouse/config.xml +++ b/clickhouse/config.xml @@ -1,10 +1,6 @@ - - - - + + warning true diff --git a/docker-compose.yml b/docker-compose.yml index c7457b3f9e..1c6c2ad0eb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -217,7 +217,7 @@ services: build: context: ./clickhouse args: - BASE_IMAGE: "${CLICKHOUSE_IMAGE:-}" + BASE_IMAGE: "altinity/clickhouse-server:23.8.11.29.altinitystable" ulimits: nofile: soft: 262144 diff --git a/install.sh b/install.sh index 53c80cdeff..f418a29fc1 100755 --- a/install.sh +++ b/install.sh @@ -20,6 +20,9 @@ source install/check-latest-commit.sh source install/check-minimum-requirements.sh # Let's go! Start impacting things. +# Upgrading clickhouse needs to come first before turning things off, since we need the old clickhouse image +# in order to determine whether or not the clickhouse version needs to be upgraded. +source install/upgrade-clickhouse.sh source install/turn-things-off.sh source install/update-docker-volume-permissions.sh source install/create-docker-volumes.sh diff --git a/install/detect-platform.sh b/install/detect-platform.sh index 32ef5ea1cd..7404008f41 100644 --- a/install/detect-platform.sh +++ b/install/detect-platform.sh @@ -20,10 +20,8 @@ fi export DOCKER_ARCH=$(docker info --format '{{.Architecture}}') if [[ "$DOCKER_ARCH" = "x86_64" ]]; then export DOCKER_PLATFORM="linux/amd64" - export CLICKHOUSE_IMAGE="altinity/clickhouse-server:21.8.13.1.altinitystable" elif [[ "$DOCKER_ARCH" = "aarch64" ]]; then export DOCKER_PLATFORM="linux/arm64" - export CLICKHOUSE_IMAGE="altinity/clickhouse-server:21.8.12.29.altinitydev.arm" else echo "FAIL: Unsupported docker architecture $DOCKER_ARCH." exit 1 diff --git a/install/upgrade-clickhouse.sh b/install/upgrade-clickhouse.sh new file mode 100644 index 0000000000..b0a8027b34 --- /dev/null +++ b/install/upgrade-clickhouse.sh @@ -0,0 +1,27 @@ +echo "${_group}Upgrading Clickhouse ..." + +# First check to see if user is upgrading by checking for existing clickhouse volume +if [[ -n "$(docker volume ls -q --filter name=sentry-clickhouse)" ]]; then + # Start clickhouse if it is not already running + $dc up -d clickhouse + + # Wait for clickhouse + RETRIES=30 + until $dc ps clickhouse | grep 'healthy' || [ $RETRIES -eq 0 ]; do + echo "Waiting for clickhouse server, $((RETRIES--)) remaining attempts..." + sleep 1 + done + + # In order to get to 23.8, we need to first upgrade go from 21.8 -> 22.8 -> 23.3 -> 23.8 + version=$($dc exec clickhouse clickhouse-client -q 'SELECT version()') + if [[ "$version" == "21.8.13.1.altinitystable" || "$version" == "21.8.12.29.altinitydev.arm" ]]; then + $dc down clickhouse + $dcb --build-arg BASE_IMAGE=altinity/clickhouse-server:22.8.15.25.altinitystable clickhouse + $dc up -d clickhouse + $dc down clickhouse + $dcb --build-arg BASE_IMAGE=altinity/clickhouse-server:23.3.19.33.altinitystable clickhouse + else + echo "Detected clickhouse version $version. Skipping upgrades!" + fi +fi +echo "${_endgroup}"