Skip to content

Commit 301a147

Browse files
committed
Fix: remove deprecated 'docker-compose'
Signed-off-by: Simone Tollardo <tollsimy.dev@protonmail.com>
1 parent c6ce7c9 commit 301a147

File tree

5 files changed

+63
-33
lines changed

5 files changed

+63
-33
lines changed

localinstall/2-install_api.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
#!/bin/sh
22
. ./main.cfg
33

4-
# is docker-compose exists? if not use docker compose
5-
if [ -z "$(which docker-compose)" ]; then
6-
echo "docker-compose is not installed, using docker compose"
7-
DOCKER_COMPOSE="docker compose"
8-
else
9-
DOCKER_COMPOSE="docker-compose"
10-
fi
11-
124
# i am groot?
135
if [ $(id -u) -ne 0 ]; then
146
SUDO=sudo
@@ -36,8 +28,8 @@ fi
3628
cat ../../ssh.key.pub > docker/ssh/user-data/authorized_keys
3729

3830
# down, just in case old containers are running
39-
${DOCKER_COMPOSE} down
40-
${DOCKER_COMPOSE} up -d
31+
docker compose down
32+
docker compose up -d
4133
echo "Waiting for API to be up"
4234
sleep 1
4335
# loop until the API is up, try 5 times

localinstall/4-start-cycle.sh

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
#!/bin/bash
22
. ./main.cfg
33

4-
# is docker-compose exists? if not use docker compose
5-
if [ -z "$(which docker-compose)" ]; then
6-
echo "docker-compose is not installed, using docker compose"
7-
DOCKER_COMPOSE="docker compose"
8-
else
9-
DOCKER_COMPOSE="docker-compose"
10-
fi
11-
124
cd kernelci/kernelci-pipeline
13-
${DOCKER_COMPOSE} down
14-
${DOCKER_COMPOSE} up -d
15-
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"
5+
docker compose down
6+
docker compose up -d
7+
8+
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"
169
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>"
1710
echo "You can also open API viewer at http://127.0.0.1:8001/viewer"

playbooks/production/roles/common/tasks/main.yml

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,66 @@
55
apt: name={{ item }}
66
with_items:
77
- git
8-
- docker.io
9-
- docker-compose
108
- python3-pip
119
- python3-venv
1210
- curl
1311
- libssl-dev
1412
- pkg-config
1513
- rsync
14+
- ca-certificates
15+
- gnupg
16+
- lsb-release
1617

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

24+
- name: Remove unofficial docker packages
25+
apt:
26+
name: "{{ item }}"
27+
state: absent
28+
with_items:
29+
- docker.io
30+
- docker-doc
31+
- docker-compose
32+
- docker-compose-v2
33+
- podman-docker
34+
- containerd
35+
- runc
36+
37+
- name: Ensure /etc/apt/keyrings directory exists
38+
file:
39+
path: /etc/apt/keyrings
40+
state: directory
41+
mode: '0755'
42+
43+
- name: Download Docker GPG key
44+
get_url:
45+
url: https://download.docker.com/linux/ubuntu/gpg
46+
dest: /etc/apt/keyrings/docker.asc
47+
mode: '0644'
48+
49+
- name: Add Docker repository
50+
apt_repository:
51+
repo: "deb [arch={{ ansible_architecture }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable"
52+
state: present
53+
filename: docker
54+
55+
- name: Update apt cache
56+
apt: update_cache=yes cache_valid_time=3600
57+
58+
- name: Install Docker Engine and Compose plugin
59+
apt:
60+
name:
61+
- docker-ce
62+
- docker-ce-cli
63+
- containerd.io
64+
- docker-buildx-plugin
65+
- docker-compose-plugin
66+
state: present
67+
2368
- name: Change ssh port to 22022
2469
ansible.builtin.lineinfile:
2570
path: /etc/ssh/sshd_config

playbooks/production/roles/storage/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
dest: /srv/kernelci-storage/docker-compose.yml
2121

2222
- name: Start kernelci-storage docker container
23-
command: docker-compose -f /srv/kernelci-storage/docker-compose.yml up -d
23+
command: docker compose -f /srv/kernelci-storage/docker-compose.yml up -d
2424
args:
2525
chdir: /srv/kernelci-storage

staging.kernelci.org

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,16 @@ cmd_api_pipeline() {
157157
git fetch origin
158158
git checkout origin/staging.kernelci.org
159159
echo "Pulling pipeline containers"
160-
docker-compose $compose_files pull
160+
docker compose $compose_files pull
161161
set +e
162-
docker-compose $compose_files down --remove-orphans
162+
docker compose $compose_files down --remove-orphans
163163
# verify if it failed due orphaned network bug
164164
if [ $? -ne 0 ]; then
165165
echo "Failed to stop pipeline containers, restarting containerd and docker"
166166
docker_workaround
167167
echo "Attempting to restart pipeline containers again"
168168
set -e
169-
docker-compose $compose_files down --remove-orphans
169+
docker compose $compose_files down --remove-orphans
170170
fi
171171
set -e
172172
cd -
@@ -177,28 +177,28 @@ cmd_api_pipeline() {
177177
git prune
178178
git fetch origin
179179
git checkout origin/staging.kernelci.org
180-
docker-compose pull $api_services
180+
docker compose pull $api_services
181181
echo "Stopping API containers"
182182
set +e
183-
docker-compose down
183+
docker compose down
184184
# verify if it failed due orphaned network bug
185185
if [ $? -ne 0 ]; then
186186
echo "Failed to stop API containers, restarting containerd and docker"
187187
docker_workaround
188188
echo "Attempting to restart API containers again"
189189
set -e
190-
docker-compose down
190+
docker compose down
191191
fi
192192
set -e
193193
echo "Starting API containers"
194-
docker-compose up -d $api_services
194+
docker compose up -d $api_services
195195
cd -
196196

197197
cd checkout/kernelci-pipeline
198-
#REQUIREMENTS=requirements-dev.txt docker-compose $compose_files build --no-cache
198+
#REQUIREMENTS=requirements-dev.txt docker compose $compose_files build --no-cache
199199
echo "Starting pipeline containers"
200200
SETTINGS=/home/kernelci/config/staging.kernelci.org.secrets.toml \
201-
docker-compose $compose_files up -d
201+
docker compose $compose_files up -d
202202
cd -
203203
}
204204

0 commit comments

Comments
 (0)