trove/playbooks/image-build/docker-registry.yaml
Hirotaka Wakabayashi 1062b035ce Allows users to specify a MariaDB version in Dockerfile
This PR allows users to select MariaDB versions.

The original problem is that Trove fails to create backup of MariaDB-
-10.7 instances because Trove's backup script is from MariaDB-10.4[1],
which is generally incompatible with MariaDB-10.7[2].

1: https://opendev.org/openstack/trove/src/branch/master/backup/install.sh#L26
2: https://mariadb.com/kb/en/mariabackup-overview/#compatibility-of-mariabackup-releases-with-mariadb-server-releases

Story: 2010566
Task: 47275
Change-Id: I03e6b58a7b1746fef8c08d92acd7b1ccac9a46eb
2023-09-18 06:20:23 +00:00

66 lines
2.6 KiB
YAML

- hosts: all
tasks:
- name: Ensure artifacts/images directory exists
file:
path: '{{ ansible_user_dir }}/images'
state: directory
- name: Install docker
become: true
package:
name: docker.io
state: present
- name: Start docker
become: true
systemd:
name: docker.io
daemon_reload: true
- name: Run docker registry
become: true
shell: docker run -d --net=host --restart=always -v /opt/trove_registry/:/var/lib/registry --name registry registry:2
- name: Pull and push trove datastore images
become: true
shell: docker pull {{ item }} && docker tag {{item}} 127.0.0.1:5000/trove-datastores/{{ item }} && \
docker push 127.0.0.1:5000/trove-datastores/{{ item }}
loop:
- "mysql:5.7.29"
- "mysql:8.0"
- "mariadb:10.4"
- "postgres:12"
- name: Build mysql 5.7 backup image
become: true
shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mysql5.7:1.1.0 --build-arg DATASTORE=mysql --build-arg DATASTORE_VERSION=5.7 .
args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup"
- name: Build mysql 8.0 backup image
become: true
shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mysql8.0:1.1.0 --build-arg DATASTORE=mysql --build-arg DATASTORE_VERSION=8.0 .
args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup"
- name: Build mariadb backup image
become: true
shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mariadb:1.1.0 --build-arg DATASTORE=mariadb --build-arg DATASTORE_VERSION=10.4 .
args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup"
- name: Build postgresql backup image
become: true
shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-postgresql:1.1.2 --build-arg DATASTORE=postgresql --build-arg DATASTORE_VERSION=12 .
args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup"
- name: Push the backup images
become: true
shell: docker push 127.0.0.1:5000/trove-datastores/db-backup-{{item}}
loop:
- "mariadb:1.1.0"
- "postgresql:1.1.2"
- name: Push mysql backup images
become: true
shell: docker push 127.0.0.1:5000/trove-datastores/db-backup-mysql{{ item }}:1.1.0
loop:
- "5.7"
- "8.0"
- name: Compress the docker registry files
become: true
archive:
path: "/opt/trove_registry/"
dest: "{{ ansible_user_dir }}/images/trove-datastore-registry-master.tar.gz"