Improve MariaDB in-place upgrade system.
This commit is contained in:
parent
87b7c28a95
commit
ffe7aca2ca
12
Dockerfile
12
Dockerfile
|
@ -17,11 +17,6 @@ RUN curl -fsSL -o icecast.tar.gz https://github.com/AzuraCast/icecast-kh-ac/arch
|
|||
&& make \
|
||||
&& make install
|
||||
|
||||
#
|
||||
# MariaDB stage (for later copy)
|
||||
#
|
||||
FROM mariadb:10.9-jammy AS mariadb
|
||||
|
||||
#
|
||||
# Golang dependencies build step
|
||||
#
|
||||
|
@ -35,7 +30,7 @@ RUN go install github.com/jwilder/dockerize@latest
|
|||
#
|
||||
# Final build image
|
||||
#
|
||||
FROM ubuntu:jammy
|
||||
FROM mariadb:10.9-jammy
|
||||
|
||||
ENV TZ="UTC"
|
||||
|
||||
|
@ -46,10 +41,6 @@ COPY --from=dockerize /go/bin/dockerize /usr/local/bin
|
|||
COPY --from=icecast /usr/local/bin/icecast /usr/local/bin/icecast
|
||||
COPY --from=icecast /usr/local/share/icecast /usr/local/share/icecast
|
||||
|
||||
# Import MariaDB scripts.
|
||||
COPY --from=mariadb /usr/local/bin/healthcheck.sh /usr/local/bin/db_healthcheck.sh
|
||||
COPY --from=mariadb /usr/local/bin/docker-entrypoint.sh /usr/local/bin/db_entrypoint.sh
|
||||
|
||||
# Run base build process
|
||||
COPY ./util/docker/common /bd_build/
|
||||
RUN chmod a+x /bd_build/*.sh \
|
||||
|
@ -115,7 +106,6 @@ EXPOSE 8000-8999
|
|||
ENV LANG="en_US.UTF-8" \
|
||||
DOCKER_IS_STANDALONE="true" \
|
||||
APPLICATION_ENV="production" \
|
||||
MARIADB_AUTO_UPGRADE=1 \
|
||||
MYSQL_HOST="localhost" \
|
||||
MYSQL_PORT=3306 \
|
||||
MYSQL_USER="azuracast" \
|
||||
|
|
|
@ -2,47 +2,10 @@
|
|||
set -e
|
||||
set -x
|
||||
|
||||
apt-get install -y --no-install-recommends tzdata libjemalloc2 pwgen xz-utils zstd dirmngr apt-transport-https
|
||||
# MariaDB setup is handled by the "parent" image.
|
||||
|
||||
sudo curl -o /etc/apt/trusted.gpg.d/mariadb_release_signing_key.asc 'https://mariadb.org/mariadb_release_signing_key.asc'
|
||||
sudo sh -c "echo 'deb https://atl.mirrors.knownhost.com/mariadb/repo/10.9/ubuntu jammy main' >>/etc/apt/sources.list"
|
||||
|
||||
# Pulled from MariaDB Docker container
|
||||
export MARIADB_MAJOR=10.9
|
||||
|
||||
{
|
||||
echo "mariadb-server-$MARIADB_MAJOR" mysql-server/root_password password 'unused';
|
||||
echo "mariadb-server-$MARIADB_MAJOR" mysql-server/root_password_again password 'unused';
|
||||
} | debconf-set-selections;
|
||||
|
||||
apt update
|
||||
apt-get install -y --no-install-recommends mariadb-server mariadb-backup socat
|
||||
|
||||
# Temporary work around for MDEV-27980, closes #417
|
||||
sed --follow-symlinks -i -e 's/--loose-disable-plugin-file-key-management//' /usr/bin/mysql_install_db
|
||||
|
||||
# Purge and re-create /var/lib/mysql with appropriate ownership
|
||||
rm -rf /var/lib/mysql;
|
||||
mkdir -p /var/lib/mysql /var/run/mysqld;
|
||||
chown -R mysql:mysql /var/lib/mysql /var/run/mysqld;
|
||||
|
||||
# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
|
||||
chmod 777 /var/run/mysqld;
|
||||
|
||||
# comment out a few problematic configuration values
|
||||
find /etc/mysql/ -name '*.cnf' -print0 \
|
||||
| xargs -0 grep -lZE '^(bind-address|log|user\s)' \
|
||||
| xargs -rt -0 sed -Ei 's/^(bind-address|log|user\s)/#&/';
|
||||
|
||||
# don't reverse lookup hostnames, they are usually another container
|
||||
# Issue #327 Correct order of reading directories /etc/mysql/mariadb.conf.d before /etc/mysql/conf.d (mount-point per documentation)
|
||||
if [ ! -L /etc/mysql/my.cnf ]; then
|
||||
sed -i -e '/includedir/i[mariadb]\nskip-host-cache\nskip-name-resolve\n' /etc/mysql/my.cnf;
|
||||
else
|
||||
sed -i -e '/includedir/ {N;s/\(.*\)\n\(.*\)/[mariadbd]\nskip-host-cache\nskip-name-resolve\n\n\2\n\1/}' /etc/mysql/mariadb.cnf;
|
||||
fi
|
||||
|
||||
mkdir /docker-entrypoint-initdb.d
|
||||
mv /usr/local/bin/healthcheck.sh /usr/local/bin/db_healthcheck.sh
|
||||
mv /usr/local/bin/docker-entrypoint.sh /usr/local/bin/db_entrypoint.sh
|
||||
|
||||
cp /bd_build/mariadb/mariadb/db.sql /docker-entrypoint-initdb.d/00-azuracast.sql
|
||||
cp /bd_build/mariadb/mariadb/db.cnf.tmpl /etc/mysql/db.cnf.tmpl
|
||||
|
|
|
@ -5,6 +5,8 @@ if [ ! -f /etc/supervisor/minimal.conf.d/mariadb.conf ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
export MARIADB_AUTO_UPGRADE=1
|
||||
|
||||
source /usr/local/bin/db_entrypoint.sh
|
||||
|
||||
set -- mysqld
|
||||
|
|
Loading…
Reference in New Issue