Skip to content

Commit

Permalink
Use docker compose plugin (apache#8056)
Browse files Browse the repository at this point in the history
  • Loading branch information
zrhoffman authored and rimashah25 committed Sep 27, 2024
1 parent 7bcd2ce commit e866960
Show file tree
Hide file tree
Showing 83 changed files with 297 additions and 195 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build-ats-test-rpm/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const spawnOptions = {
};

let atcComponent = process.env.ATC_COMPONENT;
const dockerCompose = ["docker-compose", "-f", `${process.env.GITHUB_WORKSPACE}/cache-config/testing/docker/docker-compose-ats-build.yml`];
const dockerCompose = ["docker", "compose", "-f", `${process.env.GITHUB_WORKSPACE}/cache-config/testing/docker/docker-compose-ats-build.yml`];
if (typeof atcComponent !== "string" || atcComponent.length === 0) {
console.error("Missing environment variable ATC_COMPONENT");
process.exit(1);
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/build-ciab/build-ciab.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const spawnOptions = {
stdio: "inherit",
stderr: "inherit"
};
const dockerCompose = ["docker-compose", "-f", "docker-compose.yml", "-f", "docker-compose.readiness.yml"];
const dockerCompose = ["docker", "compose", "-f", "docker-compose.yml", "-f", "docker-compose.readiness.yml"];
process.env.DOCKER_BUILDKIT = 1;
process.env.COMPOSE_DOCKER_CLI_BUILD = 1;

Expand Down Expand Up @@ -49,5 +49,5 @@ function runProcess(...commandArguments) {

moveRPMs();
process.chdir(`${process.env.GITHUB_WORKSPACE}/infrastructure/cdn-in-a-box`);
runProcess("make"); // Place the RPMs for docker-compose build. All RPMs should have already been built.
runProcess("make"); // Place the RPMs for docker compose build. All RPMs should have already been built.
runProcess(...dockerCompose, "build", "--parallel");
2 changes: 1 addition & 1 deletion .github/actions/cache-config-integration-tests/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const spawnOptions = {
stderr: "inherit",
};

const dockerCompose = ["docker-compose", "-f", `${process.env.GITHUB_WORKSPACE}/cache-config/testing/docker/docker-compose.yml`];
const dockerCompose = ["docker", "compose", "-f", `${process.env.GITHUB_WORKSPACE}/cache-config/testing/docker/docker-compose.yml`];

function runProcess(...commandArguments) {
console.info(...commandArguments);
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/health-client-integration-tests/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const spawnOptions = {
stderr: "inherit",
};

const dockerCompose = ["docker-compose", "-f", `${process.env.GITHUB_WORKSPACE}/tc-health-client/testing/docker/docker-compose.yml`];
const dockerCompose = ["docker", "compose", "-f", `${process.env.GITHUB_WORKSPACE}/tc-health-client/testing/docker/docker-compose.yml`];

function runProcess(...commandArguments) {
console.info(...commandArguments);
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/run-ciab/run-ciab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ set -ex;
store_ciab_logs() {
echo 'Storing CDN-in-a-Box logs...';
mkdir logs;
for service in $($docker_compose ps --services); do
for service in $($docker_compose ps --services --all); do
$docker_compose logs --no-color --timestamps "$service" >"logs/${service}.log";
done;
}

cd infrastructure/cdn-in-a-box;
logged_services='trafficrouter readiness';
other_services='dns edge enroller mid-01 mid-02 origin static trafficmonitor trafficops trafficstats';
docker_compose='docker-compose -f ./docker-compose.yml -f ./docker-compose.readiness.yml';
docker_compose='docker compose -f ./docker-compose.yml -f ./docker-compose.readiness.yml';
$docker_compose up -d $logged_services $other_services;
$docker_compose logs -f $logged_services &

Expand All @@ -38,7 +38,7 @@ if ! timeout 12m $docker_compose logs -f readiness >/dev/null; then
echo "CDN-in-a-Box didn't become ready within 12 minutes - exiting" >&2;
exit_code=1;
store_ciab_logs;
elif exit_code="$(docker inspect --format='{{.State.ExitCode}}' "$($docker_compose ps -q readiness)")"; [ "$exit_code" -ne 0 ]; then
elif exit_code="$(docker inspect --format='{{.State.ExitCode}}' "$($docker_compose ps -q --all readiness)")"; [ "$exit_code" -ne 0 ]; then
echo 'Readiness container exited with an error' >&2;
store_ciab_logs;
fi;
Expand Down
5 changes: 2 additions & 3 deletions .github/containers/trafficserver-alpine/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@
# specific language governing permissions and limitations
# under the License.

version: '3.9'
services:
trafficserver:
build:
context: .
dockerfile: Dockerfile
args:
ATS_VERSION: ${ATS_VERSION}
# This docker-compose file is no longer used by the container-trafficserver-alpine.yml
# This docker compose file is no longer used by the container-trafficserver-alpine.yml
# Github Actions workflow and is here in case anyone wants to build it manually, since
# the emulated aarch64 GitHub Actions job takes about 3 hours to run.
# To build the trafficserver image for only your computer's own platform, run
# docker-compose build
# docker compose build
#
# To build and push a single image including both linux/amd64 and linux/arm64 platforms, run
# # docker/binfmt writes to /proc/sys/fs/binfmt_misc and its effects are cleared on reboot
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cache-config-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,6 @@ jobs:
name: trafficserver
path: ${{ github.workspace }}/cache-config/testing/docker/yumserver/test-rpms
- name: Build cache config test containers
run: docker-compose -f ${{ github.workspace }}/cache-config/testing/docker/docker-compose.yml build --parallel
run: docker compose -f ${{ github.workspace }}/cache-config/testing/docker/docker-compose.yml build --parallel
- name: Run cache config integration tests
uses: ./.github/actions/cache-config-integration-tests
2 changes: 1 addition & 1 deletion .github/workflows/health-client-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,6 @@ jobs:
- name: display directory
run: ls -l ${{ github.workspace }}/tc-health-client/testing/docker/health-check-test
- name: Build health client test containers
run: docker-compose -f ${{ github.workspace }}/tc-health-client/testing/docker/docker-compose.yml build --parallel
run: docker compose -f ${{ github.workspace }}/tc-health-client/testing/docker/docker-compose.yml build --parallel
- name: Run health client integration tests
uses: ./.github/actions/health-client-integration-tests
14 changes: 7 additions & 7 deletions .github/workflows/tr-ultimate-test-harness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ jobs:
go-version: ${{ env.GO_VERSION }}
- name: Vendor dependencies
run: go mod vendor
- name: Build docker-compose services
- name: Build docker compose services
run: |
docker-compose build --parallel &&
docker-compose pull db
docker compose build --parallel &&
docker compose pull db
- name: Cache local Maven repository
uses: actions/cache@v2
with:
Expand All @@ -81,7 +81,7 @@ jobs:
restore-keys: |
${{ runner.os }}-node-modules-
- name: Start the Dev CDN in a Box
run: docker-compose up -d
run: docker compose up -d
- name: Wait until Traffic Ops is ready to accept requests
run: |
trap 'echo "Error on line ${LINENO} of setting interface IP addresses"; exit 1' ERR
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
service_by_hostname[edge]=t3c
for hostname in trafficrouter edge; do
container_id="$(docker-compose ps -q "${service_by_hostname[$hostname]}")"
container_id="$(docker compose ps -q --all "${service_by_hostname[$hostname]}")"
interface="$(<<'JSON' jq
{
"mtu": 1500,
Expand Down Expand Up @@ -202,8 +202,8 @@ jobs:
run: |
set -o errexit -o nounset
mkdir -p dev/logs
for service in $(docker-compose ps --services); do
docker-compose logs --no-color --timestamps "$service" >"dev/logs/${service}.log"
for service in $(docker compose ps --all --services); do
docker compose logs --no-color --timestamps "$service" >"dev/logs/${service}.log"
done
if: ${{ failure() }}
- name: Upload Dev CDN-in-a-Box logs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/traffic.ops.database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ jobs:
- name: Build And Copy Traffic Ops RPM
run: ./pkg traffic_ops_build && cp ./dist/traffic_ops-*.x86_64.rpm traffic_ops_db/test/docker/traffic_ops.rpm && cp ./dist/traffic_ops-*.x86_64.rpm traffic_ops/app/db/trafficvault/test/traffic_ops.rpm
- name: Run Traffic Ops Database Docker Tests
run: cd traffic_ops_db/test/docker/ && docker-compose up --build --exit-code-from trafficops-db-admin
run: cd traffic_ops_db/test/docker/ && docker compose up --build --exit-code-from trafficops-db-admin
- name: Run Traffic Vault Database Docker Tests
run: cd traffic_ops/app/db/trafficvault/test/ && docker-compose up --build --exit-code-from trafficvault-db-admin
run: cd traffic_ops/app/db/trafficvault/test/ && docker compose up --build --exit-code-from trafficvault-db-admin
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ vendor/**/.travis.yml
.dbInfo
/dist
*.pyc
bin/docker-compose
bin/docker compose
/.m2/
/.npm/
/.github/actions/**/node_modules/
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

##[8.0.2] - 2024-09-27
- [#8081](https://github.com/apache/trafficcontrol/pull/8081) *GH Actions* Updates the versions used for actions/artifact-download and actions/artifact-upload.
- [#8056](https://github.com/apache/trafficcontrol/pull/8056) Remove the `version` key from compose files and use `docker compose` instead of `docker-compose`.

## [8.0.1] - 2024-03-19
### Fixed
Expand Down
6 changes: 3 additions & 3 deletions cache-config/testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Docker containers you will need to provide the following resources:
4. You may copy an Apache Trafficserver RPM to the
docker/yumserver/test-rpms directory or you can run:

**docker-compose -f docker-compose-ats-build.yml run trafficserver_build**
**docker compose -f docker-compose-ats-build.yml run trafficserver_build**

to build an rpm which is copied to docker/yumserver/test-rpms.

Expand All @@ -83,8 +83,8 @@ Docker containers you will need to provide the following resources:
6. Build the Docker images and run the ort test:
```
cd trafficcontrol/cache-config/testing/docker
docker-compose build
docker-compose run ort_test
docker compose build
docker compose run ort_test
```
After some time, test results should be available at
'ort-tests/test.log'
Expand Down
1 change: 0 additions & 1 deletion cache-config/testing/docker/docker-compose-ats-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#

---
version: '3.8'

volumes:
trafficcontrol:
Expand Down
5 changes: 2 additions & 3 deletions cache-config/testing/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@
# container updates ../ort-tests/tc-fixtures.json with
# the corresponding version string)
#
# Run: docker-compose build
# Run: docker-compose run ort_test
# Run: docker compose build
# Run: docker compose run ort_test
#

---
version: '3.8'

volumes:
trafficcontrol:
Expand Down
6 changes: 3 additions & 3 deletions dev/atc.dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# specific language governing permissions and limitations
# under the License.

alias atc-start="docker-compose up -d --build";
alias atc-build="docker-compose build";
alias atc-stop="docker-compose kill && docker-compose down -v --remove-orphans";
alias atc-start="docker compose up -d --build";
alias atc-build="docker compose build";
alias atc-stop="docker compose kill && docker compose down -v --remove-orphans";

function atc-restart {
if ! atc-stop $@; then
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# under the License.

---
version: '3.8'

services:
trafficops:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/admin/ansible-labs/ansible_labs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ A simple scaffold for a lab directory is included at :atc-file:`infrastructure/a
* The :atc-file:`infrastructure/ansible/sample.lab/ansible` subdirectory should be used to hold variables specific to a particular lab in either ``vars.yml`` or an encrypted Ansible ``vault``
* The :atc-file:`infrastructure/ansible/sample.lab/inventory` directory is where it's recommended for your provisioning layer to drop a valid Ansible inventory file describing what was allocated. When using Ansible, it's important to point the inventory source to this directory so that it will merge all available inventory files together for you.
* The :atc-file:`infrastructure/ansible/sample.lab/out/ssl` directory is generated with the first run of the lab and holds your local copy of the lab SSL data. The out directory is also handy for holding temporary data from the provisioning or steady-state layers to help triage failures.
* The docker and docker-compose related files are present as an optional wrapper for Linux hosts (doesn't work on OSX) around all the lab plumbing dependencies for Ansible. This is particularly handy for automated systems who perform regular redeployments such as in a CI/CD tool.
* The docker and docker compose related files are present as an optional wrapper for Linux hosts (doesn't work on OSX) around all the lab plumbing dependencies for Ansible. This is particularly handy for automated systems who perform regular redeployments such as in a CI/CD tool.
* :atc-file:`infrastructure/ansible/sample.lab/manual.run.sh` is a scaffold for the entrypoint for performing a lab rebuild from your local system.

Gilt
Expand Down
Loading

0 comments on commit e866960

Please sign in to comment.