From 8161234c47278db6e9a4c31a00442039065dcaf9 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Mon, 5 Aug 2024 17:16:06 +0200 Subject: [PATCH] chore: migrate from docker-compose v1 to docker compose v2 (#1522) * chore: migrate from docker-compose v1 to docker compose v2 * fix: move --log-level option to docker command --- .ci/scripts/benchmarks.sh | 4 ++-- .ci/scripts/load-testing.sh | 4 ++-- .ci/scripts/pull_and_build.sh | 4 ++-- .ci/scripts/test.sh | 5 ++--- CONTRIBUTING.md | 2 +- packages/rum-core/test/run-apm-server.sh | 2 +- packages/rum/test/run-apm-server.sh | 4 ++-- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.ci/scripts/benchmarks.sh b/.ci/scripts/benchmarks.sh index ba898904d..b936b36dd 100755 --- a/.ci/scripts/benchmarks.sh +++ b/.ci/scripts/benchmarks.sh @@ -8,13 +8,13 @@ NODEJS_VERSION=14 USER_ID="${USER_ID}" \ NODEJS_VERSION="${NODEJS_VERSION}" \ -docker-compose -f ./dev-utils/docker-compose.yml down \ +docker compose -f ./dev-utils/docker-compose.yml down \ --remove-orphans \ --volumes || true USER_ID="${USER_ID}" \ NODEJS_VERSION="${NODEJS_VERSION}" \ -docker-compose -f ./dev-utils/docker-compose.yml up \ +docker compose -f ./dev-utils/docker-compose.yml up \ --build \ --abort-on-container-exit \ --exit-code-from node-benchmark \ diff --git a/.ci/scripts/load-testing.sh b/.ci/scripts/load-testing.sh index 7a3f6a5a2..cd1d6142e 100755 --- a/.ci/scripts/load-testing.sh +++ b/.ci/scripts/load-testing.sh @@ -10,14 +10,14 @@ NODEJS_VERSION=14 USER_ID="${USER_ID}" \ NODEJS_VERSION="${NODEJS_VERSION}" \ STACK_VERSION=${STACK_VERSION} \ -docker-compose -f ./dev-utils/docker-compose.yml down \ +docker compose -f ./dev-utils/docker-compose.yml down \ --remove-orphans \ --volumes || true USER_ID="${USER_ID}" \ NODEJS_VERSION="${NODEJS_VERSION}" \ STACK_VERSION=${STACK_VERSION} \ -docker-compose -f ./dev-utils/docker-compose.yml up \ +docker compose -f ./dev-utils/docker-compose.yml up \ --build \ --exit-code-from load-testing \ load-testing diff --git a/.ci/scripts/pull_and_build.sh b/.ci/scripts/pull_and_build.sh index 00bf46cb9..06bb6ff96 100755 --- a/.ci/scripts/pull_and_build.sh +++ b/.ci/scripts/pull_and_build.sh @@ -3,14 +3,14 @@ export NODEJS_VERSION=$(cat .nvmrc) export STACK_VERSION=${STACK_VERSION:-8.6.1} STACK_VERSION=${STACK_VERSION} \ -docker-compose -f ./dev-utils/docker-compose.yml --log-level INFO pull --quiet --ignore-pull-failures +docker --log-level INFO compose -f ./dev-utils/docker-compose.yml pull --quiet --ignore-pull-failures # We are building the images here even though the Docker images are already cached in Packer. # This is because there could be changes in the PR affecting the files copied to the Docker image, # which we want to test in the current build. NODEJS_VERSION="${NODEJS_VERSION}" \ STACK_VERSION=${STACK_VERSION} \ -docker-compose -f ./dev-utils/docker-compose.yml --log-level INFO build >docker-compose.log 2>docker-compose.err +docker --log-level INFO compose -f ./dev-utils/docker-compose.yml build >docker-compose.log 2>docker-compose.err if [ $? -gt 0 ] ; then echo "Docker compose failed, see the below log output" cat docker-compose.log && rm docker-compose.log diff --git a/.ci/scripts/test.sh b/.ci/scripts/test.sh index aff23508d..449ab58ce 100755 --- a/.ci/scripts/test.sh +++ b/.ci/scripts/test.sh @@ -28,9 +28,8 @@ do APM_SERVER_PORT=${APM_SERVER_PORT} \ APM_SERVER_URL=${APM_SERVER_URL} \ KIBANA_URL=${KIBANA_URL} \ - docker-compose \ + docker --log-level INFO compose \ -f ./dev-utils/docker-compose.yml \ - --log-level INFO \ up \ --quiet-pull \ --exit-code-from node-puppeteer \ @@ -42,5 +41,5 @@ do fi sleep 5; done -echo "Exit code from docker-compose ${status}" +echo "Exit code from docker compose ${status}" exit ${status} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ed564401e..8ce5ed340 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,7 +86,7 @@ $ npx lerna bootstrap Tests fall under unit, integration and end-to-end tests. Before running the test, we have to start the APM server manually since all the APM payload data are sent to the server. ```sh -NODEJS_VERSION= STACK_VERSION= docker-compose -f ./dev-utils/docker-compose.yml up -d apm-server +NODEJS_VERSION= STACK_VERSION= docker compose -f ./dev-utils/docker-compose.yml up -d apm-server # nodeVersion - corresponds to NodeJS version to be used when building the test images # version - corresponds to Elastic Stack versions ``` diff --git a/packages/rum-core/test/run-apm-server.sh b/packages/rum-core/test/run-apm-server.sh index 2722a26c8..473e4770a 100644 --- a/packages/rum-core/test/run-apm-server.sh +++ b/packages/rum-core/test/run-apm-server.sh @@ -1 +1 @@ -ELASTICSEARCH_PORT=9201 STACK_VERSION=6.4.0 APM_SERVER_PORT=8001 docker-compose up apm-server kibana +ELASTICSEARCH_PORT=9201 STACK_VERSION=6.4.0 APM_SERVER_PORT=8001 docker compose up apm-server kibana diff --git a/packages/rum/test/run-apm-server.sh b/packages/rum/test/run-apm-server.sh index 8a4a937f0..e5f5eb598 100644 --- a/packages/rum/test/run-apm-server.sh +++ b/packages/rum/test/run-apm-server.sh @@ -1,3 +1,3 @@ #docker run -p 127.0.0.1:8200:8201 elastic/apm-server:6.2.4 /bin/sh -c "apm-server -e -E output.elasticsearch.password=$(ELASTICSEARCH_PASSWORD) -E output.elasticsearch.username=$(ELASTICSEARCH_USERNAME) -E output.elasticsearch.hosts=['$(ELASTICSEARCH_SERVICE_HOST):$(ELASTICSEARCH_SERVICE_PORT)'] -E apm-server.expvar.enabled=true -E apm-server.frontend.enabled=true -E apm-server.frontend.rate_limit=100000 -E apm-server.host=0.0.0.0:8200 -E apm-server.read_timeout=1m -E apm-server.shutdown_timeout=2m -E apm-server.write_timeout=1m" -STACK_VERSION=6.2.4 APM_SERVER_PORT=8001 docker-compose up apm-server -#STACK_VERSION=6.2.4 docker-compose -f ./test/docker-compose.yml start apm-server \ No newline at end of file +STACK_VERSION=6.2.4 APM_SERVER_PORT=8001 docker compose up apm-server +#STACK_VERSION=6.2.4 docker compose -f ./test/docker compose.yml start apm-server