Skip to content

Commit

Permalink
[Docker, CI] Use docker compose v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Vuk Vojta authored and szymondabrowskipartner committed Jan 8, 2025
1 parent 834b3d3 commit ec25b14
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 80 deletions.
12 changes: 6 additions & 6 deletions examples/custom-headers/run_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ function wait_for_endpoint {
}

echo "killing potentially existing containers"
docker-compose stop
docker-compose rm -f
docker compose stop
docker compose rm -f

echo -e "\nstarting the orchestra"
docker-compose up -d
docker compose up -d
if [ $? -ne 0 ]
then
echo "failed to start containers"
Expand All @@ -35,10 +35,10 @@ echo -e "\n\ntrigger a joynr method call on the consumer"
curl http://localhost:8081/control/trigger
sleep 5

docker-compose logs -t > custom-headers-full.log
docker compose logs -t > custom-headers-full.log

echo -e "\n\nstop all containers"
docker-compose stop
docker compose stop

echo -e "\nremove all containers"
docker-compose rm -f
docker compose rm -f
12 changes: 6 additions & 6 deletions examples/stateless-async/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ system required to run an end-to-end test.

First, startup the infrastructure components:

$ docker-compose up -d hivemq joynr-gcd-db postgresql ; docker-compose logs -f
$ docker compose up -d hivemq joynr-gcd-db postgresql ; docker compose logs -f

Wait until no more log entries are written, then start up the joynr backend services:

$ docker-compose up -d joynr-gcd ; docker-compose logs -f joynr-gcd
$ docker compose up -d joynr-gcd ; docker compose logs -f joynr-gcd

Again, wait until it's fully started, then fire up the car simulator:

$ docker-compose up -d carsim ; docker-compose logs -f carsim
$ docker compose up -d carsim ; docker compose logs -f carsim

After this has started, fire up a number of JEE consumer applications. E.g. for starting two instances:

$ docker-compose up -d jee-consumer-1 jee-consumer-2 ; docker-compose logs -f jee-consumer-1 jee-consumer-2
$ docker compose up -d jee-consumer-1 jee-consumer-2 ; docker compose logs -f jee-consumer-1 jee-consumer-2

Wait until these have fully started up, then you can commence testing.

Expand All @@ -83,7 +83,7 @@ In order to see what the various applications are doing, you should tail the log
involved. In order to prevent being swamped with log entries, it's recommended to only tail the two JEE
applications, but feel free to inspect the logs of any and all of the other applications, too.

$ docker-compose logs -f --tail 10 jee-consumer-1 jee-consumer-2
$ docker compose logs -f --tail 10 jee-consumer-1 jee-consumer-2

First we need to create a vehicle configuration entry:

Expand Down Expand Up @@ -129,7 +129,7 @@ In addition to the JEE consumer application we've provided an example plain-Java
application which demonstrates the use of the stateless async API. If you want to start up the
application, then run:

$ docker-compose up -d java-consumer ; docker-compose logs -f java-consumer
$ docker compose up -d java-consumer ; docker compose logs -f java-consumer

It will automatically fire off a set of requests to the car sim application and you can see in the
logs that the replies have been processed.
Expand Down
20 changes: 10 additions & 10 deletions tests/gcd-e2e-test/run-gcd-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,24 @@ fi

echo "### Stop and remove any potentially still running joynr-backend containers"
cd $JOYNR_SOURCE_DIR/docker
docker-compose -f joynr-backend.yml stop
docker-compose -f joynr-backend.yml rm -f
docker-compose -f joynr-multiple-backend.yml stop
docker-compose -f joynr-multiple-backend.yml rm -f
docker compose -f joynr-backend.yml stop
docker compose -f joynr-backend.yml rm -f
docker compose -f joynr-multiple-backend.yml stop
docker compose -f joynr-multiple-backend.yml rm -f

echo "### Start required joynr-backend"
if [ $SINGLE_BROKER -eq 1 ]
then
echo "Configuring for single broker"
cd $JOYNR_SOURCE_DIR/docker
docker-compose -f joynr-backend.yml up -d
docker compose -f joynr-backend.yml up -d
configure_single_broker
fi
if [ $MULTIPLE_BROKER -eq 1 ]
then
echo "Configuring for multiple broker"
cd $JOYNR_SOURCE_DIR/docker
docker-compose -f joynr-multiple-backend.yml up -d
docker compose -f joynr-multiple-backend.yml up -d
configure_multiple_broker
fi

Expand All @@ -141,14 +141,14 @@ echo "### Stop and remove joynr-backend containers"
if [ $SINGLE_BROKER -eq 1 ]
then
cd $JOYNR_SOURCE_DIR/docker
docker-compose -f joynr-backend.yml stop
docker-compose -f joynr-backend.yml rm -f
docker compose -f joynr-backend.yml stop
docker compose -f joynr-backend.yml rm -f
fi
if [ $MULTIPLE_BROKER -eq 1 ]
then
cd $JOYNR_SOURCE_DIR/docker
docker-compose -f joynr-multiple-backend.yml stop
docker-compose -f joynr-multiple-backend.yml rm -f
docker compose -f joynr-multiple-backend.yml stop
docker compose -f joynr-multiple-backend.yml rm -f
fi

echo "### Test completed with exit code $EXITCODE"
Expand Down
6 changes: 3 additions & 3 deletions tests/graceful-shutdown-test/run
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

echo "Launching docker containers"
docker-compose up -d
docker compose up -d
sleep 2

while [ -z "$(docker logs --tail 50 consumer 2>&1 | grep FINISHED)" ]; do
Expand Down Expand Up @@ -43,5 +43,5 @@ else
echo FAILED
fi

docker-compose stop
docker-compose rm -f
docker compose stop
docker compose rm -f
2 changes: 1 addition & 1 deletion tests/inter-language-test/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ $ ./build_docker_image.sh --docker-run-flags "-e DEV_UID=$(id -u)" <other params
### Run scripts

A parameterized script `<ILT_DIR>/docker/run-docker-inter-language-tests.sh` is
provided to run the docker concerto using docker-compose and execute the required
provided to run the docker concerto using docker compose and execute the required
steps within each container instance.

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ echo "JOYNR_VERSION_OLD=$JOYNR_VERSION_OLD"
echo "JOYNR_VERSION_NEW=$JOYNR_VERSION_NEW"
echo "JOYNR_BACKEND_IMAGE_VERSION=$JOYNR_BACKEND_IMAGE_VERSION"

# derive image versions used by docker-compose
# derive image versions used by docker compose
#
# Container 1 uses new version
# while Container 2 uses the old version
Expand All @@ -134,11 +134,11 @@ export ILT_ONBOARD_APPS_IMAGE_VERSION_2=$JOYNR_VERSION_OLD
export JOYNR_BACKEND_IMAGE_VERSION

# start containers in background mode
docker-compose up -d
docker compose up -d
if [ "$?" -ne 0 ]
then
echo "ERROR: docker-compose up -d failed."
docker-compose stop
echo "ERROR: docker compose up -d failed."
docker compose stop
exit 1
fi

Expand Down Expand Up @@ -188,10 +188,10 @@ done
sleep 5

# stop containers
docker-compose stop
docker compose stop

# remove containers
docker-compose rm -f
docker compose rm -f

# evaluate results
NUMBER_OF_FILES=`ls -1 $HOME/docker/build/${JOYNR_CONSUMER_NODE}/*.exitcode 2> /dev/null | wc -l`
Expand Down
12 changes: 6 additions & 6 deletions tests/joynr-hivemq-shared-subscriptions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ using joynr JEE integration with MQTT for incoming communication, allowing joynr
to scale horizontally in a JEE cluster.

This test setup creates a set of Docker containers using
docker-compose comprising:
docker compose comprising:
* a (mini) JEE cluster offering a joynr provider
* a single node monitoring application (joynr proxy, also JEE) which communicates with the
cluster
Expand All @@ -32,7 +32,7 @@ messages in case of heavy load situations. For more details on the backpressure
https://github.com/bmwcarit/joynr/blob/master/wiki/JavaSettings.md#limitandbackpressuresettings.

This test setup creates a set of Docker containers using
docker-compose comprising:
docker compose comprising:
* a (mini) JEE cluster offering a joynr provider and set up with backpressure mechanism turned on
* a single node monitoring application (joynr proxy, also JEE) which communicates with the
cluster and which produces a heavy-load situation
Expand All @@ -41,7 +41,7 @@ cluster and which produces a heavy-load situation
## Pre-requisites

You must have a version of docker installed `>=1.13`, and
a matching version of `docker-compose`.
a matching version of `docker compose`.

You must be able to install the required infrastructure Docker Images
in your local repository (see below for which ones are required).
Expand Down Expand Up @@ -132,7 +132,7 @@ and

If you want to trigger tests manually, execute:

`docker-compose up -d`
`docker compose up -d`

This will start the docker orchestra. Next connect to one of
the both monitoring containers. See what its ID is by executing `docker ps`, and
Expand Down Expand Up @@ -165,9 +165,9 @@ of the Docker Container running the monitoring application).
To stop the scenario, `exit` the container you connected to and then
run the following commands:

`docker-compose stop`
`docker compose stop`

`docker-compose rm -f`
`docker compose rm -f`

In case you are executing the `run_tests.sh` script no action is needed
as the docker orchestra is stopped automatically.
14 changes: 7 additions & 7 deletions tests/joynr-hivemq-shared-subscriptions/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ cd ../../docker/ && ./build_backend.sh
cd -

echo "killing potentially existing containers, e.g. due to a previous failing build"
docker-compose stop
docker-compose rm -f
docker compose stop
docker compose rm -f

echo "starting the orchestra"
docker-compose up -d
docker compose up -d
if [ $? -ne 0 ]
then
echo "failed to start containers"
Expand All @@ -22,17 +22,17 @@ sleep 360

echo "Logging results. Started: $(date). Timeout = 240s"

# timeout runs the docker-compose logs command for 240s, and if it is not terminated,
# timeout runs the docker compose logs command for 240s, and if it is not terminated,
# it will kill it after ten seconds
timeout -k 10s 240s docker-compose logs --no-color -t > sst-full.log
timeout -k 10s 240s docker compose logs --no-color -t > sst-full.log

echo "Logged: $(du -sh sst-full.log)"

echo "stop all containers"
docker-compose stop
docker compose stop

echo "remove all containers"
docker-compose rm -f
docker compose rm -f

# Check SST test result
if grep -F -q '[SST] Triggered 100 pings. 100 were successful' sst-full.log ; then
Expand Down
8 changes: 4 additions & 4 deletions tests/standalone-pt/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ images which are used by the `docker-compose.yml` script contained in this direc

## Prerequisites software
* Docker version 19.03.6 or later
* docker-compose version 1.17.1 or later
* docker compose version v2.12.2 or later

## Prerequisites images
Joynr has a variety of docker images. The standalone test needs `joynr-complete-with-joynr` image.
Expand All @@ -30,16 +30,16 @@ change them, do so in the `docker-compose.yml` for the `consumer` service.

Some settings originally configurable inside the `docker-compose.yaml` are parameterized and can be
conveniently configured inside the `compose.conf` which is automatically found and used by the
docker-compose via the `.env` symlink inside this directory.
docker compose via the `.env` symlink inside this directory.
### Traffic Shaping
You can configure the behaviour of the traffic shaping via the `compose.conf` file.
`docker-tc` supports multiple different ways traffic shaping. More information about the possibilities
can be found at: https://github.com/lukaszlach/docker-tc/blob/master/docker-compose.yml

## Running test scenario
Run the `./run_pt.sh` script to start all services. This will instantiate a number of `consumer` services
as defined by the `--scale consumer=N` parameter passed to the `docker-compose` command in the script.
Container names will be auto-generated by docker-compose using the pattern `docker_SERVICENAME_NUM`
as defined by the `--scale consumer=N` parameter passed to the `docker compose` command in the script.
Container names will be auto-generated by docker compose using the pattern `docker_SERVICENAME_NUM`

The script runs forever, until the user stops it with Ctrl-C. The Docker containers will be stopped and
cleaned up, and the `results` folder will be created in the current working directory and is
Expand Down
14 changes: 7 additions & 7 deletions tests/standalone-pt/docker/run_pt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ docker network prune -f
docker_ps=$(docker ps -a)
conts=$(echo $docker_ps | cut -d' ' -f9-)
if [ ! -z "$conts" ]; then
echo "Stopping running docker-compose containers, e.g. due to a previous failing build"
docker-compose stop
docker-compose rm -f
echo "Stopping running docker compose containers, e.g. due to a previous failing build"
docker compose stop
docker compose rm -f
docker system prune -f
fi

Expand Down Expand Up @@ -39,7 +39,7 @@ fi
mkdir results

echo "Starting the orchestra"
docker-compose up -d --scale consumer=10
docker compose up -d --scale consumer=10

if [ $? -ne 0 ]
then
Expand All @@ -55,7 +55,7 @@ trap stop_me SIGINT
function stop_me {
echo ""
echo "Ctrl-c is sent. Logging containers to logsOfAllContainers.log ..."
docker-compose logs --no-color > logsOfAllContainers.log
docker compose logs --no-color > logsOfAllContainers.log

cat logsOfAllContainers.log | grep -a 'PT RESULT' > pt-result.log

Expand All @@ -69,13 +69,13 @@ function stop_me {
fi

echo "Stop and remove all containers"
docker-compose stop
docker compose stop

echo number of tests: `cat pt-result.log | wc -l`
echo successful: `cat pt-result.log | grep success | wc -l`

# clean up
docker-compose rm -f
docker compose rm -f
docker system prune -f

if [ -d results ]; then
Expand Down
8 changes: 4 additions & 4 deletions tests/system-integration-test/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,17 @@ can start up the scenario by executing the following script:
Alternatively, you can also start up the scenario manually by
executing the following commands:

`docker-compose up -d`
`docker compose up -d`

Check for progress of the various containers by running:

`docker-compose logs`
`docker compose logs`

In order to shutdown and remove the containers, issue the
following commands:

`docker-compose stop`
`docker compose stop`

and

`docker-compose rm -f`
`docker compose rm -f`
Loading

0 comments on commit ec25b14

Please sign in to comment.