Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.0.x backport: Use docker compose plugin #8060

Open
wants to merge 18 commits into
base: 8.0.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ATS_VERSION=9.1.2
GO_VERSION=1.22.1
ATS_VERSION=9.2.4
GO_VERSION=1.22.5
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
28 changes: 21 additions & 7 deletions .github/containers/trafficserver-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,36 @@
# specific language governing permissions and limitations
# under the License.

FROM alpine:latest AS build-trafficserver
FROM alpine:3.18 AS build-trafficserver
ARG ATS_VERSION
ADD https://downloads.apache.org/trafficserver/trafficserver-${ATS_VERSION}.tar.bz2 /tmp/
ADD https://archive.apache.org/dist/trafficserver/trafficserver-${ATS_VERSION}.tar.bz2 /tmp/
RUN set -o errexit -o nounset -o xtrace; \
cd tmp; \
dirname=trafficserver-${ATS_VERSION}; \
tar xf ${dirname}.tar.bz2; \
rm ${dirname}.tar.bz2; \
apk add --no-cache \
apk add --update --no-cache \
# configure dependencies
g++ \
perl \
openssl-dev \
pcre-dev \
make \
# build dependencies
libexecinfo-dev \
fortify-headers \
linux-headers \
zlib-dev; \
# Alpine versions above 3.16 do not contain package libexecinfo-dev,
# which ATS needs.
# https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/issues/68#issuecomment-1571877109
apk add --update --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/v3.16/main/ \
libexecinfo-dev; \
cd $dirname; \
# Fix is from https://github.com/apache/trafficserver-ingress-controller/pull/151
sed -i 's/PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP/PTHREAD_RWLOCK_INITIALIZER/' \
include/tscore/ink_rwlock.h \
include/tscpp/util/TsSharedMutex.h; \
./configure \
--disable-tests \
--enable-experimental-plugins \
Expand All @@ -52,13 +61,18 @@ RUN set -o errexit -o nounset -o xtrace; \
cd ..; \
rm -r $dirname

FROM alpine:latest
FROM alpine:3.18
COPY --from=build-trafficserver /tmp/built/ /
RUN apk add --no-cache \
RUN apk add --update --no-cache \
# runtime dependencies
libexecinfo \
libstdc++ \
pcre && \
# Alpine versions above 3.16 do not contain package libexecinfo,
# which ATS needs.
# https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/issues/68#issuecomment-1571877109
apk add --update --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/v3.16/main/ \
libexecinfo && \
adduser -D ats
USER ats
CMD /bin/traffic_server
7 changes: 3 additions & 4 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 All @@ -42,4 +41,4 @@ services:
- linux/amd64
- linux/arm64
# for example, ghcr.io/apache/trafficcontrol/ci/trafficserver-alpine:9.1.2
image: ${CONTAINER:-ghcr.io/apache/trafficcontrol/ci/trafficserver-alpine}:${ATS_VERSION}
image: ${CONTAINER:-ghcr.io/${GITHUB_REPOSITORY:-apache/trafficcontrol}/ci/trafficserver-alpine}:${ATS_VERSION}
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/container-trafficserver-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

name: Container ghcr.io/apache/trafficcontrol/ci/trafficserver-alpine
name: Container trafficserver-alpine

env:
CONTAINER: ghcr.io/${{ github.repository }}/ci/trafficserver-alpine
Expand Down
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [unreleased]
### Changed
- [#8060](https://github.com/apache/trafficcontrol/pull/8060) Remove the `version` key from compose files and use `docker compose` instead of `docker-compose`.

## [8.0.1] - 2024-03-19
### Fixed
- [#7957](https://github.com/apache/trafficcontrol/pull/7957) *Traffic Ops*: Fix the incorrect display of delivery services assigned to ORG servers.
Expand Down
2 changes: 1 addition & 1 deletion GO_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.22.1
1.22.5
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
4 changes: 2 additions & 2 deletions cache-config/testing/docker/yumserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
# Based on CentOS 6.6
############################################################

FROM centos:7
FROM rockylinux:8
MAINTAINER dev@trafficcontrol.apache.org

RUN yum install -y httpd createrepo yum-utils
RUN dnf install -y httpd createrepo yum-utils

RUN mkdir -p /var/www/html/traffic-control/7/x86_64/Packages
RUN sed -i -e 's/#ServerName www.example.com:80/ServerName www.example.com:80/g' /etc/httpd/conf/httpd.conf
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
Loading