975ff536 by Adam Heath

Switch to bitnami/mariadb, which allows for in initContainer phase.

1 parent 477934f6
......@@ -14,7 +14,7 @@ environments:
user: CHANGEME
images:
debian: "debian:bullseye-20211220"
mariadb: "mariadb"
mariadb: "bitnami/mariadb:10.3.32-debian-10-r67"
---
......
......@@ -13,4 +13,6 @@ configMapGenerator:
- ./scripts/wait-for-file
- ./scripts/mariadb-is-ready
- ./scripts/restore-from-empty
- ./scripts/bitnami-mariadb-entrypoint-container.sh
- ./scripts/bitnami-mariadb-entrypoint-initContainer.sh
......
......@@ -53,6 +53,8 @@ spec:
secretName: mariadb-secret
- name: database-restore
emptyDir: {}
- name: etc
emptyDir: {}
initContainers:
- name: wait-for-file
......@@ -67,18 +69,22 @@ spec:
- name: WAIT_FOR_FILE
value: /docker-entrypoint-initdb.d/.restored
containers:
- name: mariadb
- name: init-mariadb
image: mariadb
command: ["/var/scripts/bitnami-mariadb-entrypoint-initContainer.sh"]
volumeMounts:
- name: mariadb-scripts
mountPath: /var/scripts
- name: mariadb-data
mountPath: /var/lib/mysql
mountPath: /bitnami/mariadb
- name: mariadb-config
mountPath: /var/mariadb-config
- name: mariadb-secret
mountPath: /var/mariadb-secret
- name: mariadb-entrypoint-initdb
mountPath: /docker-entrypoint-initdb.d
- name: etc
mountPath: /runtime-etc
env:
- name: MARIADB_DATABASE_FILE
value: /var/mariadb-config/MARIADB_DATABASE
......@@ -89,3 +95,19 @@ spec:
- name: MARIADB_ROOT_PASSWORD_FILE
value: /var/mariadb-secret/MARIADB_ROOT_PASSWORD
containers:
- name: mariadb
image: mariadb
#securityContext:
# runAsUser: 1001
# runAsGroup: 1001
command: ["/var/scripts/bitnami-mariadb-entrypoint-container.sh"]
args: ["/opt/bitnami/scripts/mariadb/run.sh"]
volumeMounts:
- name: mariadb-scripts
mountPath: /var/scripts
- name: mariadb-data
mountPath: /bitnami/mariadb
- name: etc
mountPath: /etc
......
#!/bin/bash
# shellcheck disable=SC1091
set -o errexit
set -o nounset
set -o pipefail
# set -o xtrace # Uncomment this line for debugging purposes
# Load libraries
. /opt/bitnami/scripts/libbitnami.sh
. /opt/bitnami/scripts/libmariadb.sh
# Load MySQL environment variables
. /opt/bitnami/scripts/mariadb-env.sh
print_welcome_page
set -x
id
cat /etc/passwd
ls -la /bitnami/mariadb /bitnami/mariadb/data/ /opt/bitnami/mariadb/
chown -R $DB_DAEMON_USER:$DB_DAEMON_GROUP /opt/bitnami/mariadb/tmp /opt/bitnami/mariadb/logs
exec bash -x "$@"
#!/bin/bash
# shellcheck disable=SC1091
set -o errexit
set -o nounset
set -o pipefail
# set -o xtrace # Uncomment this line for debugging purposes
# Load libraries
. /opt/bitnami/scripts/libbitnami.sh
. /opt/bitnami/scripts/libmariadb.sh
# Load MySQL environment variables
. /opt/bitnami/scripts/mariadb-env.sh
print_welcome_page
info "** Starting MariaDB setup **"
/opt/bitnami/scripts/mariadb/setup.sh
info "** MariaDB setup finished! **"
ls -la /bitnami/mariadb /bitnami/mariadb/data/ /opt/bitnami/mariadb/
cp -a /etc/* /runtime-etc/
cat /etc/passwd