From 5ea9f845c252307f964351267bdb7372e85179ac Mon Sep 17 00:00:00 2001 From: sylwiaszunejko Date: Fri, 14 Jul 2023 08:35:35 +0200 Subject: [PATCH 1/2] Switch from Docker Compose V1 to V2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per Docker: "From July 2023 Docker Compose V1 stopped receiving updates. It’s also no longer available in new releases of Docker Desktop." This patch replaces all uses of "docker-compose" command (Docker Compose V1) with "docker compose" command (Docker Compose V2). This change will also allow for using new functionality introduced in Docker Compose V2, such as "--wait" flag. --- .github/workflows/main.yml | 2 +- integration.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 853c4a11d..b258c6da8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: - name: Install Docker compose env: - DOCKER_COMPOSE_VERSION: 1.27.4 + DOCKER_COMPOSE_VERSION: 2.20.0 run: sudo curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose - run: ./integration.sh cassandra scylla diff --git a/integration.sh b/integration.sh index 749caa730..2517610cc 100755 --- a/integration.sh +++ b/integration.sh @@ -8,11 +8,11 @@ readonly SCYLLA_IMAGE=${SCYLLA_IMAGE} set -eu -o pipefail function scylla_up() { - local -r exec="docker-compose exec -T" + local -r exec="docker compose exec -T" echo "==> Running Scylla ${SCYLLA_IMAGE}" docker pull ${SCYLLA_IMAGE} - docker-compose up -d + docker compose up -d echo "==> Waiting for CQL port" for s in $(docker-compose ps --services); do @@ -27,7 +27,7 @@ function scylla_up() { function scylla_down() { echo "==> Stopping Scylla" - docker-compose down + docker compose down } function scylla_restart() { From 282d5879b2d64a17f515bb500d5bd7bbc2481676 Mon Sep 17 00:00:00 2001 From: sylwiaszunejko Date: Fri, 14 Jul 2023 08:56:48 +0200 Subject: [PATCH 2/2] Replace waiting for CQL port with healthchecks Manually checking the health of a container with use of "cqlsh" replaced with healthcheck in docker-compose.yml file. Healthcheck uses "cqlsh" as well so it checks if all nodes of the cluster are fully bootstrapped and their CQL port ready. When using "--wait" flag (introduced in Docker Compose V2)in "docker compose up", Docker waits for all healthchecks to be in "healthy" state. --- docker-compose.yml | 5 +++++ integration.sh | 12 +----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 033d0f80d..4b7230c6d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,6 +21,11 @@ services: - type: bind source: ./testdata/pki/cassandra.key target: /etc/scylla/db.key + healthcheck: + test: [ "CMD", "cqlsh", "-e", "select * from system.local" ] + interval: 5s + timeout: 5s + retries: 18 networks: public: driver: bridge diff --git a/integration.sh b/integration.sh index 2517610cc..5c29615e9 100755 --- a/integration.sh +++ b/integration.sh @@ -12,17 +12,7 @@ function scylla_up() { echo "==> Running Scylla ${SCYLLA_IMAGE}" docker pull ${SCYLLA_IMAGE} - docker compose up -d - - echo "==> Waiting for CQL port" - for s in $(docker-compose ps --services); do - until v=$(${exec} ${s} cqlsh -e "DESCRIBE SCHEMA"); do - echo ${v} - docker-compose logs --tail 10 ${s} - sleep 5 - done - done - echo "==> Waiting for CQL port done" + docker compose up -d --wait } function scylla_down() {