Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/topic/awelzel/switch-to-docker-c…
Browse files Browse the repository at this point in the history
…ompose-v2'

* origin/topic/awelzel/switch-to-docker-compose-v2:
  Docker/setups: Fix multiple merge keys in yaml
  docker-compose: Switch to docker compose v2
  • Loading branch information
awelzel committed Mar 15, 2024
2 parents 4545b99 + 2e9afe2 commit 216efb9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
9 changes: 3 additions & 6 deletions Docker/setups/default/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@ x-zeek-controller: &ZEEK_CONTROLLER

services:
controller:
<<: *ZEEK_BASE
<<: *ZEEK_CONTROLLER
<<: [*ZEEK_BASE, *ZEEK_CONTROLLER]

inst1:
<<: *ZEEK_BASE
<<: *ZEEK_AGENT
<<: [*ZEEK_BASE, *ZEEK_AGENT]

inst2:
<<: *ZEEK_BASE
<<: *ZEEK_AGENT
<<: [*ZEEK_BASE, *ZEEK_AGENT]

client:
image: zeektest:latest
Expand Down
6 changes: 2 additions & 4 deletions Docker/setups/singlehost/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ x-zeek-client: &ZEEK_CLIENT

services:
controller:
<<: *ZEEK_BASE
<<: *ZEEK_CONTROLLER
<<: [*ZEEK_BASE, *ZEEK_CONTROLLER]

client:
<<: *ZEEK_BASE
<<: *ZEEK_CLIENT
<<: [*ZEEK_BASE, *ZEEK_CLIENT]
4 changes: 2 additions & 2 deletions Scripts/docker-compose-teardown
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if docker ps -a | grep -q $controller; then
fi

# Grab the Docker logs
docker-compose -p ${testname}_ -f docker-compose.yml logs >docker-compose.logs
docker compose -p ${testname}_ -f docker-compose.yml logs >docker-compose.logs

[ -n "$TEST_SKIP_DOCKER_TEARDOWN" ] && exit 0
[ "$TEST_FAILED" -eq 1 ] && [ -n "$TEST_SKIP_DOCKER_TEARDOWN_ON_FAILURE" ] && exit 0
Expand All @@ -28,6 +28,6 @@ if [ ! -f docker-compose.yml ]; then
fi

# Don't wait at all for clean container shutdown
docker-compose -p ${testname}_ -f docker-compose.yml down -t 0
docker compose -p ${testname}_ -f docker-compose.yml down -t 0

exit 0
4 changes: 2 additions & 2 deletions Scripts/docker-requirements
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ command -v docker >/dev/null || {
exit 1
}

command -v docker-compose >/dev/null || {
echo "docker-compose command unavailable"
docker compose version >/dev/null || {
echo "docker compose plugin unavailable"
exit 1
}

Expand Down
6 changes: 3 additions & 3 deletions Scripts/docker-setup
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ docker_populate() {
fi
}

# The corresponding "docker-compose down" happens in docker-compose-teardown.
# The corresponding "docker compose down" happens in docker-compose-teardown.
# Might shift this around in the future for better symmetry.
docker_compose_up() {
local config1="${1:-docker-compose.yml}"
local config2="${2:-docker-compose.override.yml}"

if [ -f "${config2}" ]; then
docker-compose -p ${testname} -f "$config1" -f "$config2" up -d
docker compose -p ${testname} -f "$config1" -f "$config2" up -d
else
docker-compose -p ${testname} -f "$config1" up -d
docker compose -p ${testname} -f "$config1" up -d
fi
}

Expand Down

0 comments on commit 216efb9

Please sign in to comment.