From 436bd7789328d0b3d11ab6da09839e70bd7e534c Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Thu, 11 Apr 2024 04:48:20 +0000 Subject: [PATCH] [build][docs]: update `docker-compose` to `docker compose` Following: https://github.blog/changelog/2024-04-10-github-hosted-runner-images-deprecation-notice-docker-compose-v1/ - Docker Compose v1 has been deprecated Signed-off-by: Viet Nguyen Duc --- .github/ISSUE_TEMPLATE/bug_report.yml | 4 ++-- Makefile | 9 +++++---- README.md | 16 ++++++++-------- docker-compose-v2-tracing.yml | 4 ++-- docker-compose-v2.yml | 4 ++-- docker-compose-v3-basicauth.yml | 4 ++-- docker-compose-v3-beta-channel.yml | 4 ++-- docker-compose-v3-dev-channel.yml | 4 ++-- docker-compose-v3-dev.yml | 4 ++-- docker-compose-v3-dynamic-grid.yml | 4 ++-- docker-compose-v3-full-grid-dev.yml | 4 ++-- docker-compose-v3-full-grid-tracing.yml | 4 ++-- docker-compose-v3-full-grid.yml | 6 +++--- docker-compose-v3-tracing.yml | 4 ++-- docker-compose-v3-video-upload.yml | 4 ++-- docker-compose-v3-video.yml | 4 ++-- docker-compose-v3.yml | 4 ++-- tests/docker-compose-v3-test-node-docker.yaml | 2 ++ tests/docker-compose-v3-test-parallel.yml | 4 ++-- tests/docker-compose-v3-test-video.yml | 4 ++-- tests/test.py | 4 ++-- 21 files changed, 52 insertions(+), 49 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 70fe8aa9a..84f17f840 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -25,7 +25,7 @@ body: description: | What command do you use to start Selenium Grid with Docker (or Kubernetes)? placeholder: | - Please share the script or docker-compose file used. This will be automatically + Please share the script or docker compose file used. This will be automatically formatted into code, so no need for backticks. If Kubernetes used, please share the YAML file, or chart values used to deploy the cluster. Be sure to include an SSCCE (Short, Self Contained, Correct @@ -64,6 +64,6 @@ body: attributes: label: Selenium Grid chart version (chart version) description: What version of Selenium Grid chart are you using? - placeholder: 0.26.2? + placeholder: 0.29.1? validations: required: false diff --git a/Makefile b/Makefile index a06115088..36ef28d9f 100644 --- a/Makefile +++ b/Makefile @@ -398,13 +398,13 @@ test_parallel: hub chrome firefox edge echo NODE=$$node >> .env ; \ echo UID=$$(id -u) >> .env ; \ echo BINDING_VERSION=$(BINDING_VERSION) >> .env ; \ - docker-compose -f docker-compose-v3-test-parallel.yml up --no-log-prefix --exit-code-from tests --build ; \ + docker compose -f docker-compose-v3-test-parallel.yml up --no-log-prefix --exit-code-from tests --build ; \ done # This should run on its own CI job. There is no need to combine it with the other tests. # Its main purpose is to check that a video file was generated. test_video: video hub chrome firefox edge - # Running a few tests with docker-compose to generate the videos + # Running a few tests with docker compose to generate the videos rm -rf ./tests/videos; mkdir -p ./tests/videos for node in NodeChrome NodeFirefox NodeEdge ; do \ cd ./tests || true ; \ @@ -425,7 +425,7 @@ test_video: video hub chrome firefox edge echo BROWSER=firefox >> .env ; \ echo VIDEO_FILE_NAME=firefox_video.mp4 >> .env ; \ fi ; \ - docker-compose -f docker-compose-v3-test-video.yml up --abort-on-container-exit --build ; \ + docker compose -f docker-compose-v3-test-video.yml up --abort-on-container-exit --build ; \ done # Using ffmpeg to verify file integrity # https://superuser.com/questions/100288/how-can-i-check-the-integrity-of-a-video-file-avi-mpeg-mp4 @@ -435,6 +435,7 @@ test_video: video hub chrome firefox edge test_node_docker: hub standalone_docker standalone_chrome standalone_firefox standalone_edge video rm -rf ./tests/videos; mkdir -p ./tests/videos + sudo chmod 777 ./tests/videos for node in DeploymentAutoscaling JobAutoscaling ; do \ cd tests || true ; \ echo NAMESPACE=$(NAME) > .env ; \ @@ -449,7 +450,7 @@ test_node_docker: hub standalone_docker standalone_chrome standalone_firefox sta echo BINDING_VERSION=$(BINDING_VERSION) >> .env ; \ export $$(cat .env | xargs) ; \ envsubst < config.toml > ./videos/config.toml ; \ - docker-compose -f docker-compose-v3-test-node-docker.yaml up --no-log-prefix --exit-code-from tests --build ; \ + docker compose -f docker-compose-v3-test-node-docker.yaml up --no-log-prefix --exit-code-from tests --build ; \ if [ $$? -ne 0 ]; then exit 1; fi ; \ done diff --git a/README.md b/README.md index d146134fc..d5722bca9 100644 --- a/README.md +++ b/README.md @@ -183,9 +183,9 @@ $ docker run --rm -it -p 4444:4444 -p 7900:7900 --shm-size 2g selenium/standalon **docker-compose-v3-beta-channel.yml:** ```bash -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-beta-channel.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-beta-channel.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-beta-channel.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-beta-channel.yml down` version: "3" services: chrome: @@ -229,9 +229,9 @@ services: **docker-compose-v3-dev-channel.yml:** ```bash -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-dev-channel.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-dev-channel.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-dev-channel.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-dev-channel.yml down` version: "3" services: chrome: @@ -484,7 +484,7 @@ linked resources below, save them locally and check the execution instructions o ##### Version 3 [`docker-compose-v3.yml`](docker-compose-v3.yml) -To stop the Grid and cleanup the created containers, run `docker-compose down`. +To stop the Grid and cleanup the created containers, run `docker compose down`. ##### Version 3 with Swarm support [`docker-compose-v3-swarm.yml`](docker-compose-v3-swarm.yml) @@ -494,7 +494,7 @@ ___ ### Fully distributed mode - Router, Queue, Distributor, EventBus, SessionMap and Nodes It is possible to start a Selenium Grid with all its components apart. For simplicity, only an -example with docker-compose will be provided. Save the file locally, and check the execution +example with docker compose will be provided. Save the file locally, and check the execution instructions on top of it. [`docker-compose-v3-full-grid.yml`](docker-compose-v3-full-grid.yml) @@ -515,7 +515,7 @@ Docker image. One container is needed per each container where a browser is runn running 5 Nodes/Standalone containers, you will need 5 video containers, the mapping is 1-1. Currently, the only way to do this mapping is manually (either starting the containers manually or through -`docker-compose`). We are iterating on this process and probably this setup will be more simple in the future. +`docker compose`). We are iterating on this process and probably this setup will be more simple in the future. The video Docker image we provide is based on the ffmpeg Ubuntu image provided by the [jrottenberg/ffmpeg](https://github.com/jrottenberg/ffmpeg) project, thank you for providing this image and @@ -1345,7 +1345,7 @@ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \ selenium/node-firefox:4.19.1-20240402 ``` -You can also refer to the below docker-compose yaml files to be able to start a simple grid (or) a dynamic grid. +You can also refer to the below docker compose yaml files to be able to start a simple grid (or) a dynamic grid. * Simple Grid [v3 yaml file](docker-compose-v3-tracing.yml) * Simple Grid [v2 yaml file](docker-compose-v2-tracing.yml) diff --git a/docker-compose-v2-tracing.yml b/docker-compose-v2-tracing.yml index 7ea304e7e..651a150d9 100644 --- a/docker-compose-v2-tracing.yml +++ b/docker-compose-v2-tracing.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v2-tracing.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v2-tracing.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v2-tracing.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v2-tracing.yml down` version: '2' services: jaeger: diff --git a/docker-compose-v2.yml b/docker-compose-v2.yml index 1eff37fb7..126f80e20 100644 --- a/docker-compose-v2.yml +++ b/docker-compose-v2.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v2.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v2.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v2.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v2.yml down` version: '2' services: chrome: diff --git a/docker-compose-v3-basicauth.yml b/docker-compose-v3-basicauth.yml index 5b5216d51..d1a1b088d 100644 --- a/docker-compose-v3-basicauth.yml +++ b/docker-compose-v3-basicauth.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-basicauth.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-basicauth.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-basicauth.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-basicauth.yml down` version: "3" services: chrome: diff --git a/docker-compose-v3-beta-channel.yml b/docker-compose-v3-beta-channel.yml index 677ee3686..a9ff9d31a 100644 --- a/docker-compose-v3-beta-channel.yml +++ b/docker-compose-v3-beta-channel.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-beta-channel.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-beta-channel.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-beta-channel.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-beta-channel.yml down` version: "3" services: chrome: diff --git a/docker-compose-v3-dev-channel.yml b/docker-compose-v3-dev-channel.yml index 1a4bc292f..3cab04ea5 100644 --- a/docker-compose-v3-dev-channel.yml +++ b/docker-compose-v3-dev-channel.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-dev-channel.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-dev-channel.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-dev-channel.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-dev-channel.yml down` version: "3" services: chrome: diff --git a/docker-compose-v3-dev.yml b/docker-compose-v3-dev.yml index c35e97acd..3c29cef18 100644 --- a/docker-compose-v3-dev.yml +++ b/docker-compose-v3-dev.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-dev.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-dev.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-dev.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-dev.yml down` version: "3" services: chrome: diff --git a/docker-compose-v3-dynamic-grid.yml b/docker-compose-v3-dynamic-grid.yml index 873fd3cee..e861a5c74 100644 --- a/docker-compose-v3-dynamic-grid.yml +++ b/docker-compose-v3-dynamic-grid.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-dynamic-grid.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-dynamic-grid.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-dynamic-grid.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-dynamic-grid.yml down` version: "3" services: node-docker: diff --git a/docker-compose-v3-full-grid-dev.yml b/docker-compose-v3-full-grid-dev.yml index d1b2bedef..4b6178896 100644 --- a/docker-compose-v3-full-grid-dev.yml +++ b/docker-compose-v3-full-grid-dev.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-full-grid-dev.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-full-grid-dev.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-full-grid-dev.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-full-grid-dev.yml down` version: "3" services: selenium-event-bus: diff --git a/docker-compose-v3-full-grid-tracing.yml b/docker-compose-v3-full-grid-tracing.yml index 95a032e3e..aa0c7c04d 100644 --- a/docker-compose-v3-full-grid-tracing.yml +++ b/docker-compose-v3-full-grid-tracing.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-full-grid-tracing.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-full-grid-tracing.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-full-grid-tracing.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-full-grid-tracing.yml down` version: "3" services: jaeger: diff --git a/docker-compose-v3-full-grid.yml b/docker-compose-v3-full-grid.yml index dd2320c8a..1972b7566 100644 --- a/docker-compose-v3-full-grid.yml +++ b/docker-compose-v3-full-grid.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-full-grid.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-full-grid.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-full-grid.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-full-grid.yml down` version: "3" services: selenium-event-bus: @@ -92,4 +92,4 @@ services: environment: - SE_EVENT_BUS_HOST=selenium-event-bus - SE_EVENT_BUS_PUBLISH_PORT=4442 - - SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \ No newline at end of file + - SE_EVENT_BUS_SUBSCRIBE_PORT=4443 diff --git a/docker-compose-v3-tracing.yml b/docker-compose-v3-tracing.yml index 2b26d5079..02f1e583b 100644 --- a/docker-compose-v3-tracing.yml +++ b/docker-compose-v3-tracing.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-tracing.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-tracing.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-tracing.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-tracing.yml down` version: "3" services: jaeger: diff --git a/docker-compose-v3-video-upload.yml b/docker-compose-v3-video-upload.yml index 4e7fbb9bf..1c6b0e2e1 100644 --- a/docker-compose-v3-video-upload.yml +++ b/docker-compose-v3-video-upload.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-video-upload.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-video-upload.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-video-upload.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-video-upload.yml down` # ${variable_pattern} get value from .env in the same directory version: "3" services: diff --git a/docker-compose-v3-video.yml b/docker-compose-v3-video.yml index ff4e0c4c4..c55ad97d6 100644 --- a/docker-compose-v3-video.yml +++ b/docker-compose-v3-video.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-video.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3-video.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-video.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-video.yml down` version: "3" services: chrome: diff --git a/docker-compose-v3.yml b/docker-compose-v3.yml index b4ff7b2ca..03a882afa 100644 --- a/docker-compose-v3.yml +++ b/docker-compose-v3.yml @@ -1,6 +1,6 @@ -# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3.yml up` +# To execute this docker compose yml file use `docker compose -f docker-compose-v3.yml up` # Add the `-d` flag at the end for detached execution -# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3.yml down` +# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3.yml down` version: "3" services: chrome: diff --git a/tests/docker-compose-v3-test-node-docker.yaml b/tests/docker-compose-v3-test-node-docker.yaml index eb2316739..9d0fc7b19 100644 --- a/tests/docker-compose-v3-test-node-docker.yaml +++ b/tests/docker-compose-v3-test-node-docker.yaml @@ -2,6 +2,7 @@ version: "3" services: node-docker: image: ${NAMESPACE}/node-docker:${TAG} + user: root volumes: - ./videos:/opt/selenium/assets - ./videos/config.toml:/opt/bin/config.toml @@ -17,6 +18,7 @@ services: selenium-hub: image: ${NAMESPACE}/hub:${TAG} + user: ${UID} container_name: selenium-hub environment: - SE_LOG_LEVEL=${LOG_LEVEL} diff --git a/tests/docker-compose-v3-test-parallel.yml b/tests/docker-compose-v3-test-parallel.yml index bb919d6b7..5de09f7d0 100644 --- a/tests/docker-compose-v3-test-parallel.yml +++ b/tests/docker-compose-v3-test-parallel.yml @@ -1,6 +1,6 @@ # How to run this? -# docker-compose -f docker-compose-v3-test-video.yml up --abort-on-container-exit --build -# To clean up, `docker-compose -f docker-compose-v3-test-video.yml down` +# docker compose -f docker-compose-v3-test-video.yml up --abort-on-container-exit --build +# To clean up, `docker compose -f docker-compose-v3-test-video.yml down` version: "3" services: chrome: diff --git a/tests/docker-compose-v3-test-video.yml b/tests/docker-compose-v3-test-video.yml index 888b3212f..ade2a3628 100644 --- a/tests/docker-compose-v3-test-video.yml +++ b/tests/docker-compose-v3-test-video.yml @@ -1,6 +1,6 @@ # How to run this? -# docker-compose -f docker-compose-v3-test-video.yml up --abort-on-container-exit --build -# To clean up, `docker-compose -f docker-compose-v3-test-video.yml down` +# docker compose -f docker-compose-v3-test-video.yml up --abort-on-container-exit --build +# To clean up, `docker compose -f docker-compose-v3-test-video.yml down` version: "3" services: browser: diff --git a/tests/test.py b/tests/test.py index f637767e5..02bf23c08 100644 --- a/tests/test.py +++ b/tests/test.py @@ -185,7 +185,7 @@ def standalone_browser_container_matches(container): # Flag for failure (for posterity) failed = False - # Avoiding to start the containers when running inside docker-compose + # Avoiding to start the containers when running inside docker compose test_container_id = '' hub_id = '' if not run_in_docker_compose: @@ -240,7 +240,7 @@ def standalone_browser_container_matches(container): logger.fatal(e) failed = True - # Avoiding a container cleanup if tests run inside docker-compose + # Avoiding a container cleanup if tests run inside docker compose if not run_in_docker_compose: logger.info("Cleaning up...")