Skip to content

Fix: remove deprecated 'docker-compose' #226

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 2 additions & 10 deletions localinstall/2-install_api.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
#!/bin/sh
. ./main.cfg

# is docker-compose exists? if not use docker compose
if [ -z "$(which docker-compose)" ]; then
echo "docker-compose is not installed, using docker compose"
DOCKER_COMPOSE="docker compose"
else
DOCKER_COMPOSE="docker-compose"
fi

# i am groot?
if [ $(id -u) -ne 0 ]; then
SUDO=sudo
Expand Down Expand Up @@ -36,8 +28,8 @@ fi
cat ../../ssh.key.pub > docker/ssh/user-data/authorized_keys

# down, just in case old containers are running
${DOCKER_COMPOSE} down
${DOCKER_COMPOSE} up -d
docker compose down
docker compose up -d
echo "Waiting for API to be up"
sleep 1
# loop until the API is up, try 5 times
Expand Down
15 changes: 4 additions & 11 deletions localinstall/4-start-cycle.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
#!/bin/bash
. ./main.cfg

# is docker-compose exists? if not use docker compose
if [ -z "$(which docker-compose)" ]; then
echo "docker-compose is not installed, using docker compose"
DOCKER_COMPOSE="docker compose"
else
DOCKER_COMPOSE="docker-compose"
fi

cd kernelci/kernelci-pipeline
${DOCKER_COMPOSE} down
${DOCKER_COMPOSE} up -d
echo "You can view now logs of containers using docker logs -f <container_id> or docker-compose logs -f in kernelci/kernelci-pipeline or kernelci/kernelci-api directories"
docker compose down
docker compose up -d

echo "You can view now logs of containers using docker logs -f <container_id> or docker compose logs -f in kernelci/kernelci-pipeline or kernelci/kernelci-api directories"
echo "Also you can do docker ps to see running containers, and in case of ongoing builds, you can view their logs too by docker logs -f <container_id>"
echo "You can also open API viewer at http://127.0.0.1:8001/viewer"
49 changes: 47 additions & 2 deletions playbooks/production/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,66 @@
apt: name={{ item }}
with_items:
- git
- docker.io
- docker-compose
- python3-pip
- python3-venv
- curl
- libssl-dev
- pkg-config
- rsync
- ca-certificates
- gnupg
- lsb-release

#- name: Add to fstab
# ansible.builtin.lineinfile:
# path: /etc/fstab
# line: "UUID=64d72737-f1de-4f67-a22a-f693a79f228f /data ext4 defaults,nofail 0 2"
# state: present

- name: Remove unofficial docker packages
apt:
name: "{{ item }}"
state: absent
with_items:
- docker.io
- docker-doc
- docker-compose
- docker-compose-v2
- podman-docker
- containerd
- runc

- name: Ensure /etc/apt/keyrings directory exists
file:
path: /etc/apt/keyrings
state: directory
mode: '0755'

- name: Download Docker GPG key
get_url:
url: https://download.docker.com/linux/ubuntu/gpg
dest: /etc/apt/keyrings/docker.asc
mode: '0644'

- name: Add Docker repository
apt_repository:
repo: "deb [arch={{ ansible_architecture }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable"
state: present
filename: docker

- name: Update apt cache
apt: update_cache=yes cache_valid_time=3600

- name: Install Docker Engine and Compose plugin
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present

- name: Change ssh port to 22022
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
Expand Down
2 changes: 1 addition & 1 deletion playbooks/production/roles/storage/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
dest: /srv/kernelci-storage/docker-compose.yml

- name: Start kernelci-storage docker container
command: docker-compose -f /srv/kernelci-storage/docker-compose.yml up -d
command: docker compose -f /srv/kernelci-storage/docker-compose.yml up -d
args:
chdir: /srv/kernelci-storage
18 changes: 9 additions & 9 deletions staging.kernelci.org
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,16 @@ cmd_api_pipeline() {
git fetch origin
git checkout origin/staging.kernelci.org
echo "Pulling pipeline containers"
docker-compose $compose_files pull
docker compose $compose_files pull
set +e
docker-compose $compose_files down --remove-orphans
docker compose $compose_files down --remove-orphans
# verify if it failed due orphaned network bug
if [ $? -ne 0 ]; then
echo "Failed to stop pipeline containers, restarting containerd and docker"
docker_workaround
echo "Attempting to restart pipeline containers again"
set -e
docker-compose $compose_files down --remove-orphans
docker compose $compose_files down --remove-orphans
fi
set -e
cd -
Expand All @@ -177,28 +177,28 @@ cmd_api_pipeline() {
git prune
git fetch origin
git checkout origin/staging.kernelci.org
docker-compose pull $api_services
docker compose pull $api_services
echo "Stopping API containers"
set +e
docker-compose down
docker compose down
# verify if it failed due orphaned network bug
if [ $? -ne 0 ]; then
echo "Failed to stop API containers, restarting containerd and docker"
docker_workaround
echo "Attempting to restart API containers again"
set -e
docker-compose down
docker compose down
fi
set -e
echo "Starting API containers"
docker-compose up -d $api_services
docker compose up -d $api_services
cd -

cd checkout/kernelci-pipeline
#REQUIREMENTS=requirements-dev.txt docker-compose $compose_files build --no-cache
#REQUIREMENTS=requirements-dev.txt docker compose $compose_files build --no-cache
echo "Starting pipeline containers"
SETTINGS=/home/kernelci/config/staging.kernelci.org.secrets.toml \
docker-compose $compose_files up -d
docker compose $compose_files up -d
cd -
}

Expand Down