Rebase templates on the latest version rather than earliest
Correct healthcheck.sh comments. Few minor errors in later versions corrected. 11.6 upgrade file corrected. More resiliant to version changes. Remove mysql/mariadb safe.cnf file that isn't distributed from Dockerfile.
This commit is contained in:
parent
6d6407c8d9
commit
aecdf2e613
@ -10,8 +10,8 @@
|
|||||||
# the --replication option. This allows a different set of replication checks
|
# the --replication option. This allows a different set of replication checks
|
||||||
# on different connections.
|
# on different connections.
|
||||||
#
|
#
|
||||||
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
|
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
|
||||||
# Useful if mariadb@localhost user exists with unix socket authentication
|
# Useful if mysql@localhost user exists with unix socket authentication
|
||||||
# Using this option disregards previous options set, so should usually be the
|
# Using this option disregards previous options set, so should usually be the
|
||||||
# first option.
|
# first option.
|
||||||
#
|
#
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
# the --replication option. This allows a different set of replication checks
|
# the --replication option. This allows a different set of replication checks
|
||||||
# on different connections.
|
# on different connections.
|
||||||
#
|
#
|
||||||
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
|
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
|
||||||
# Useful if mariadb@localhost user exists with unix socket authentication
|
# Useful if mysql@localhost user exists with unix socket authentication
|
||||||
# Using this option disregards previous options set, so should usually be the
|
# Using this option disregards previous options set, so should usually be the
|
||||||
# first option.
|
# first option.
|
||||||
#
|
#
|
||||||
|
@ -221,16 +221,16 @@ docker_init_database_dir() {
|
|||||||
installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal )
|
installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal )
|
||||||
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
|
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
|
||||||
|
|
||||||
local mariadbdArgs=()
|
local mysqldArgs=()
|
||||||
for arg in "${@:2}"; do
|
for arg in "${@:2}"; do
|
||||||
# Check if the argument contains whitespace
|
# Check if the argument contains whitespace
|
||||||
if [[ "$arg" =~ [[:space:]] ]]; then
|
if [[ "$arg" =~ [[:space:]] ]]; then
|
||||||
mysql_warn "Not passing argument \'$arg\' to mariadb-install-db because mariadb-install-db does not support arguments with whitespace."
|
mysql_warn "Not passing argument \'$arg\' to mysql_install_db because mysql_install_db does not support arguments with whitespace."
|
||||||
else
|
else
|
||||||
mariadbdArgs+=("$arg")
|
mysqldArgs+=("$arg")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
mysql_install_db "${installArgs[@]}" "${mariadbdArgs[@]}" \
|
mysql_install_db "${installArgs[@]}" "${mysqldArgs[@]}" \
|
||||||
--skip-test-db \
|
--skip-test-db \
|
||||||
--default-time-zone=SYSTEM --enforce-storage-engine= \
|
--default-time-zone=SYSTEM --enforce-storage-engine= \
|
||||||
--skip-log-bin \
|
--skip-log-bin \
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
# replication REPLICATION_CLIENT (<10.5)or REPLICA MONITOR (10.5+)
|
# replication REPLICATION_CLIENT (<10.5)or REPLICA MONITOR (10.5+)
|
||||||
# mariadbupgrade none, however unix user permissions on datadir
|
# mariadbupgrade none, however unix user permissions on datadir
|
||||||
#
|
#
|
||||||
# The SQL user used is the default for the mysql client. This can be the unix user
|
# The SQL user used is the default for the mariadb client. This can be the unix user
|
||||||
# if no user(or password) is set in the [mariadb-client] section of a configuration
|
# if no user(or password) is set in the [mariadb-client] section of a configuration
|
||||||
# file. --defaults-{file,extra-file,group-suffix} can specify a file/configuration
|
# file. --defaults-{file,extra-file,group-suffix} can specify a file/configuration
|
||||||
# different from elsewhere.
|
# different from elsewhere.
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
# the --replication option. This allows a different set of replication checks
|
# the --replication option. This allows a different set of replication checks
|
||||||
# on different connections.
|
# on different connections.
|
||||||
#
|
#
|
||||||
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
|
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
|
||||||
# Useful if mariadb@localhost user exists with unix socket authentication
|
# Useful if mysql@localhost user exists with unix socket authentication
|
||||||
# Using this option disregards previous options set, so should usually be the
|
# Using this option disregards previous options set, so should usually be the
|
||||||
# first option.
|
# first option.
|
||||||
#
|
#
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
# the --replication option. This allows a different set of replication checks
|
# the --replication option. This allows a different set of replication checks
|
||||||
# on different connections.
|
# on different connections.
|
||||||
#
|
#
|
||||||
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
|
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
|
||||||
# Useful if mariadb@localhost user exists with unix socket authentication
|
# Useful if mysql@localhost user exists with unix socket authentication
|
||||||
# Using this option disregards previous options set, so should usually be the
|
# Using this option disregards previous options set, so should usually be the
|
||||||
# first option.
|
# first option.
|
||||||
#
|
#
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
# the --replication option. This allows a different set of replication checks
|
# the --replication option. This allows a different set of replication checks
|
||||||
# on different connections.
|
# on different connections.
|
||||||
#
|
#
|
||||||
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
|
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
|
||||||
# Useful if mariadb@localhost user exists with unix socket authentication
|
# Useful if mysql@localhost user exists with unix socket authentication
|
||||||
# Using this option disregards previous options set, so should usually be the
|
# Using this option disregards previous options set, so should usually be the
|
||||||
# first option.
|
# first option.
|
||||||
#
|
#
|
||||||
|
@ -114,7 +114,7 @@ RUN set -ex; \
|
|||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*; \
|
rm -rf /var/lib/apt/lists/*; \
|
||||||
# purge and re-create /var/lib/mysql with appropriate ownership
|
# purge and re-create /var/lib/mysql with appropriate ownership
|
||||||
rm -rf /var/lib/mysql /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf; \
|
rm -rf /var/lib/mysql; \
|
||||||
mkdir -p /var/lib/mysql /run/mysqld; \
|
mkdir -p /var/lib/mysql /run/mysqld; \
|
||||||
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
|
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
|
||||||
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
|
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
# the --replication option. This allows a different set of replication checks
|
# the --replication option. This allows a different set of replication checks
|
||||||
# on different connections.
|
# on different connections.
|
||||||
#
|
#
|
||||||
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
|
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
|
||||||
# Useful if mariadb@localhost user exists with unix socket authentication
|
# Useful if mysql@localhost user exists with unix socket authentication
|
||||||
# Using this option disregards previous options set, so should usually be the
|
# Using this option disregards previous options set, so should usually be the
|
||||||
# first option.
|
# first option.
|
||||||
#
|
#
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
# the --replication option. This allows a different set of replication checks
|
# the --replication option. This allows a different set of replication checks
|
||||||
# on different connections.
|
# on different connections.
|
||||||
#
|
#
|
||||||
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
|
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
|
||||||
# Useful if mariadb@localhost user exists with unix socket authentication
|
# Useful if mysql@localhost user exists with unix socket authentication
|
||||||
# Using this option disregards previous options set, so should usually be the
|
# Using this option disregards previous options set, so should usually be the
|
||||||
# first option.
|
# first option.
|
||||||
#
|
#
|
||||||
|
@ -114,7 +114,7 @@ RUN set -ex; \
|
|||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*; \
|
rm -rf /var/lib/apt/lists/*; \
|
||||||
# purge and re-create /var/lib/mysql with appropriate ownership
|
# purge and re-create /var/lib/mysql with appropriate ownership
|
||||||
rm -rf /var/lib/mysql /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf; \
|
rm -rf /var/lib/mysql; \
|
||||||
mkdir -p /var/lib/mysql /run/mysqld; \
|
mkdir -p /var/lib/mysql /run/mysqld; \
|
||||||
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
|
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
|
||||||
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
|
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
# the --replication option. This allows a different set of replication checks
|
# the --replication option. This allows a different set of replication checks
|
||||||
# on different connections.
|
# on different connections.
|
||||||
#
|
#
|
||||||
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
|
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
|
||||||
# Useful if mariadb@localhost user exists with unix socket authentication
|
# Useful if mysql@localhost user exists with unix socket authentication
|
||||||
# Using this option disregards previous options set, so should usually be the
|
# Using this option disregards previous options set, so should usually be the
|
||||||
# first option.
|
# first option.
|
||||||
#
|
#
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
# the --replication option. This allows a different set of replication checks
|
# the --replication option. This allows a different set of replication checks
|
||||||
# on different connections.
|
# on different connections.
|
||||||
#
|
#
|
||||||
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
|
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
|
||||||
# Useful if mariadb@localhost user exists with unix socket authentication
|
# Useful if mysql@localhost user exists with unix socket authentication
|
||||||
# Using this option disregards previous options set, so should usually be the
|
# Using this option disregards previous options set, so should usually be the
|
||||||
# first option.
|
# first option.
|
||||||
#
|
#
|
||||||
|
@ -114,7 +114,7 @@ RUN set -ex; \
|
|||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*; \
|
rm -rf /var/lib/apt/lists/*; \
|
||||||
# purge and re-create /var/lib/mysql with appropriate ownership
|
# purge and re-create /var/lib/mysql with appropriate ownership
|
||||||
rm -rf /var/lib/mysql /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf; \
|
rm -rf /var/lib/mysql; \
|
||||||
mkdir -p /var/lib/mysql /run/mysqld; \
|
mkdir -p /var/lib/mysql /run/mysqld; \
|
||||||
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
|
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
|
||||||
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
|
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
# the --replication option. This allows a different set of replication checks
|
# the --replication option. This allows a different set of replication checks
|
||||||
# on different connections.
|
# on different connections.
|
||||||
#
|
#
|
||||||
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
|
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
|
||||||
# Useful if mariadb@localhost user exists with unix socket authentication
|
# Useful if mysql@localhost user exists with unix socket authentication
|
||||||
# Using this option disregards previous options set, so should usually be the
|
# Using this option disregards previous options set, so should usually be the
|
||||||
# first option.
|
# first option.
|
||||||
#
|
#
|
||||||
|
@ -573,8 +573,8 @@ docker_mariadb_backup_system()
|
|||||||
fi
|
fi
|
||||||
local backup_db="system_mysql_backup_unknown_version.sql.zst"
|
local backup_db="system_mysql_backup_unknown_version.sql.zst"
|
||||||
local oldfullversion="unknown_version"
|
local oldfullversion="unknown_version"
|
||||||
if [ -r "$DATADIR"/mysql_upgrade_info ]; then
|
if [ -r "$DATADIR"/mariadb_upgrade_info ]; then
|
||||||
read -r -d '' oldfullversion < "$DATADIR"/mysql_upgrade_info || true
|
read -r -d '' oldfullversion < "$DATADIR"/mariadb_upgrade_info || true
|
||||||
if [ -n "$oldfullversion" ]; then
|
if [ -n "$oldfullversion" ]; then
|
||||||
backup_db="system_mysql_backup_${oldfullversion}.sql.zst"
|
backup_db="system_mysql_backup_${oldfullversion}.sql.zst"
|
||||||
fi
|
fi
|
||||||
@ -641,14 +641,14 @@ EOSQL
|
|||||||
|
|
||||||
|
|
||||||
_check_if_upgrade_is_needed() {
|
_check_if_upgrade_is_needed() {
|
||||||
if [ ! -f "$DATADIR"/mysql_upgrade_info ]; then
|
if [ ! -f "$DATADIR"/mariadb_upgrade_info ]; then
|
||||||
mysql_note "MariaDB upgrade information missing, assuming required"
|
mysql_note "MariaDB upgrade information missing, assuming required"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
local mariadbVersion
|
local mariadbVersion
|
||||||
mariadbVersion="$(_mariadb_version)"
|
mariadbVersion="$(_mariadb_version)"
|
||||||
IFS='.-' read -ra newversion <<<"$mariadbVersion"
|
IFS='.-' read -ra newversion <<<"$mariadbVersion"
|
||||||
IFS='.-' read -ra oldversion < "$DATADIR"/mysql_upgrade_info || true
|
IFS='.-' read -ra oldversion < "$DATADIR"/mariadb_upgrade_info || true
|
||||||
|
|
||||||
if [[ ${#newversion[@]} -lt 2 ]] || [[ ${#oldversion[@]} -lt 2 ]] \
|
if [[ ${#newversion[@]} -lt 2 ]] || [[ ${#oldversion[@]} -lt 2 ]] \
|
||||||
|| [[ ${oldversion[0]} -lt ${newversion[0]} ]] \
|
|| [[ ${oldversion[0]} -lt ${newversion[0]} ]] \
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
# the --replication option. This allows a different set of replication checks
|
# the --replication option. This allows a different set of replication checks
|
||||||
# on different connections.
|
# on different connections.
|
||||||
#
|
#
|
||||||
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
|
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
|
||||||
# Useful if mariadb@localhost user exists with unix socket authentication
|
# Useful if mysql@localhost user exists with unix socket authentication
|
||||||
# Using this option disregards previous options set, so should usually be the
|
# Using this option disregards previous options set, so should usually be the
|
||||||
# first option.
|
# first option.
|
||||||
#
|
#
|
||||||
@ -201,11 +201,11 @@ replication()
|
|||||||
|
|
||||||
# mariadbupgrade
|
# mariadbupgrade
|
||||||
#
|
#
|
||||||
# Test the lock on the file $datadir/mysql_upgrade_info
|
# Test the lock on the file $datadir/mariadb_upgrade_info
|
||||||
# https://jira.mariadb.org/browse/MDEV-27068
|
# https://jira.mariadb.org/browse/MDEV-27068
|
||||||
mariadbupgrade()
|
mariadbupgrade()
|
||||||
{
|
{
|
||||||
local f="$datadir/mysql_upgrade_info"
|
local f="$datadir/mariadb_upgrade_info"
|
||||||
if [ -r "$f" ]; then
|
if [ -r "$f" ]; then
|
||||||
flock --exclusive --nonblock -n 9 9<"$f"
|
flock --exclusive --nonblock -n 9 9<"$f"
|
||||||
return $?
|
return $?
|
||||||
|
@ -114,7 +114,7 @@ RUN set -ex; \
|
|||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*; \
|
rm -rf /var/lib/apt/lists/*; \
|
||||||
# purge and re-create /var/lib/mysql with appropriate ownership
|
# purge and re-create /var/lib/mysql with appropriate ownership
|
||||||
rm -rf /var/lib/mysql /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf; \
|
rm -rf /var/lib/mysql; \
|
||||||
mkdir -p /var/lib/mysql /run/mysqld; \
|
mkdir -p /var/lib/mysql /run/mysqld; \
|
||||||
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
|
chown -R mysql:mysql /var/lib/mysql /run/mysqld; \
|
||||||
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
|
# ensure that /run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
|
||||||
|
@ -573,8 +573,8 @@ docker_mariadb_backup_system()
|
|||||||
fi
|
fi
|
||||||
local backup_db="system_mysql_backup_unknown_version.sql.zst"
|
local backup_db="system_mysql_backup_unknown_version.sql.zst"
|
||||||
local oldfullversion="unknown_version"
|
local oldfullversion="unknown_version"
|
||||||
if [ -r "$DATADIR"/mysql_upgrade_info ]; then
|
if [ -r "$DATADIR"/mariadb_upgrade_info ]; then
|
||||||
read -r -d '' oldfullversion < "$DATADIR"/mysql_upgrade_info || true
|
read -r -d '' oldfullversion < "$DATADIR"/mariadb_upgrade_info || true
|
||||||
if [ -n "$oldfullversion" ]; then
|
if [ -n "$oldfullversion" ]; then
|
||||||
backup_db="system_mysql_backup_${oldfullversion}.sql.zst"
|
backup_db="system_mysql_backup_${oldfullversion}.sql.zst"
|
||||||
fi
|
fi
|
||||||
@ -641,14 +641,14 @@ EOSQL
|
|||||||
|
|
||||||
|
|
||||||
_check_if_upgrade_is_needed() {
|
_check_if_upgrade_is_needed() {
|
||||||
if [ ! -f "$DATADIR"/mysql_upgrade_info ]; then
|
if [ ! -f "$DATADIR"/mariadb_upgrade_info ]; then
|
||||||
mysql_note "MariaDB upgrade information missing, assuming required"
|
mysql_note "MariaDB upgrade information missing, assuming required"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
local mariadbVersion
|
local mariadbVersion
|
||||||
mariadbVersion="$(_mariadb_version)"
|
mariadbVersion="$(_mariadb_version)"
|
||||||
IFS='.-' read -ra newversion <<<"$mariadbVersion"
|
IFS='.-' read -ra newversion <<<"$mariadbVersion"
|
||||||
IFS='.-' read -ra oldversion < "$DATADIR"/mysql_upgrade_info || true
|
IFS='.-' read -ra oldversion < "$DATADIR"/mariadb_upgrade_info || true
|
||||||
|
|
||||||
if [[ ${#newversion[@]} -lt 2 ]] || [[ ${#oldversion[@]} -lt 2 ]] \
|
if [[ ${#newversion[@]} -lt 2 ]] || [[ ${#oldversion[@]} -lt 2 ]] \
|
||||||
|| [[ ${oldversion[0]} -lt ${newversion[0]} ]] \
|
|| [[ ${oldversion[0]} -lt ${newversion[0]} ]] \
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
# the --replication option. This allows a different set of replication checks
|
# the --replication option. This allows a different set of replication checks
|
||||||
# on different connections.
|
# on different connections.
|
||||||
#
|
#
|
||||||
# --su{=|-mariadb} is option to run the healthcheck as a different unix user.
|
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
|
||||||
# Useful if mariadb@localhost user exists with unix socket authentication
|
# Useful if mysql@localhost user exists with unix socket authentication
|
||||||
# Using this option disregards previous options set, so should usually be the
|
# Using this option disregards previous options set, so should usually be the
|
||||||
# first option.
|
# first option.
|
||||||
#
|
#
|
||||||
@ -201,11 +201,11 @@ replication()
|
|||||||
|
|
||||||
# mariadbupgrade
|
# mariadbupgrade
|
||||||
#
|
#
|
||||||
# Test the lock on the file $datadir/mysql_upgrade_info
|
# Test the lock on the file $datadir/mariadb_upgrade_info
|
||||||
# https://jira.mariadb.org/browse/MDEV-27068
|
# https://jira.mariadb.org/browse/MDEV-27068
|
||||||
mariadbupgrade()
|
mariadbupgrade()
|
||||||
{
|
{
|
||||||
local f="$datadir/mysql_upgrade_info"
|
local f="$datadir/mariadb_upgrade_info"
|
||||||
if [ -r "$f" ]; then
|
if [ -r "$f" ]; then
|
||||||
flock --exclusive --nonblock -n 9 9<"$f"
|
flock --exclusive --nonblock -n 9 9<"$f"
|
||||||
return $?
|
return $?
|
||||||
|
@ -138,8 +138,7 @@ VOLUME /var/lib/mysql
|
|||||||
|
|
||||||
COPY healthcheck.sh /usr/local/bin/healthcheck.sh
|
COPY healthcheck.sh /usr/local/bin/healthcheck.sh
|
||||||
COPY docker-entrypoint.sh /usr/local/bin/
|
COPY docker-entrypoint.sh /usr/local/bin/
|
||||||
RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
|
|
||||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||||
|
|
||||||
EXPOSE 3306
|
EXPOSE 3306
|
||||||
CMD ["mysqld"]
|
CMD ["mariadbd"]
|
||||||
|
@ -95,7 +95,7 @@ docker_process_init_files() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values)
|
# arguments necessary to run "mariadbd --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values)
|
||||||
_verboseHelpArgs=(
|
_verboseHelpArgs=(
|
||||||
--verbose --help
|
--verbose --help
|
||||||
)
|
)
|
||||||
@ -103,12 +103,12 @@ _verboseHelpArgs=(
|
|||||||
mysql_check_config() {
|
mysql_check_config() {
|
||||||
local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors
|
local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors
|
||||||
if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then
|
if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then
|
||||||
mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors"
|
mysql_error $'mariadbd failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fetch value from server config
|
# Fetch value from server config
|
||||||
# We use mysqld --verbose --help instead of my_print_defaults because the
|
# We use mariadbd --verbose --help instead of my_print_defaults because the
|
||||||
# latter only show values present in config files, and not server defaults
|
# latter only show values present in config files, and not server defaults
|
||||||
mysql_get_config() {
|
mysql_get_config() {
|
||||||
local conf="$1"; shift
|
local conf="$1"; shift
|
||||||
@ -147,7 +147,7 @@ docker_temp_server_start() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop the server. When using a local socket file mysqladmin will block until
|
# Stop the server. When using a local socket file mariadb-admin will block until
|
||||||
# the shutdown is complete.
|
# the shutdown is complete.
|
||||||
docker_temp_server_stop() {
|
docker_temp_server_stop() {
|
||||||
kill "$MARIADB_PID"
|
kill "$MARIADB_PID"
|
||||||
@ -229,7 +229,7 @@ _mariadb_version() {
|
|||||||
docker_init_database_dir() {
|
docker_init_database_dir() {
|
||||||
mysql_note "Initializing database files"
|
mysql_note "Initializing database files"
|
||||||
installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal )
|
installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal )
|
||||||
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here)
|
# "Other options are passed to mariadbd." (so we pass all "mariadbd" arguments directly here)
|
||||||
|
|
||||||
local mariadbdArgs=()
|
local mariadbdArgs=()
|
||||||
for arg in "${@:2}"; do
|
for arg in "${@:2}"; do
|
||||||
@ -240,7 +240,7 @@ docker_init_database_dir() {
|
|||||||
mariadbdArgs+=("$arg")
|
mariadbdArgs+=("$arg")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
mysql_install_db "${installArgs[@]}" "${mariadbdArgs[@]}" \
|
mariadb-install-db "${installArgs[@]}" "${mariadbdArgs[@]}" \
|
||||||
--skip-test-db \
|
--skip-test-db \
|
||||||
--old-mode='UTF8_IS_UTF8MB3' \
|
--old-mode='UTF8_IS_UTF8MB3' \
|
||||||
--default-time-zone=SYSTEM --enforce-storage-engine= \
|
--default-time-zone=SYSTEM --enforce-storage-engine= \
|
||||||
@ -298,7 +298,7 @@ docker_exec_client() {
|
|||||||
if [ -n "$MYSQL_DATABASE" ]; then
|
if [ -n "$MYSQL_DATABASE" ]; then
|
||||||
set -- --database="$MYSQL_DATABASE" "$@"
|
set -- --database="$MYSQL_DATABASE" "$@"
|
||||||
fi
|
fi
|
||||||
mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@"
|
mariadb --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute sql script, passed via stdin
|
# Execute sql script, passed via stdin
|
||||||
@ -366,7 +366,7 @@ docker_setup_db() {
|
|||||||
# --skip-write-binlog usefully disables binary logging
|
# --skip-write-binlog usefully disables binary logging
|
||||||
# but also outputs LOCK TABLES to improve the IO of
|
# but also outputs LOCK TABLES to improve the IO of
|
||||||
# Aria (MDEV-23326) for 10.4+.
|
# Aria (MDEV-23326) for 10.4+.
|
||||||
mysql_tzinfo_to_sql --skip-write-binlog /usr/share/zoneinfo \
|
mariadb-tzinfo-to-sql --skip-write-binlog /usr/share/zoneinfo \
|
||||||
| docker_process_sql --dont-use-mysql-root-password --database=mysql
|
| docker_process_sql --dont-use-mysql-root-password --database=mysql
|
||||||
# tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is not set yet
|
# tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is not set yet
|
||||||
fi
|
fi
|
||||||
@ -523,7 +523,7 @@ docker_mariadb_init()
|
|||||||
if [ -f "$DATADIR/.init/backup-my.cnf" ]; then
|
if [ -f "$DATADIR/.init/backup-my.cnf" ]; then
|
||||||
mv "$DATADIR/.init/backup-my.cnf" "$DATADIR/.my.cnf"
|
mv "$DATADIR/.init/backup-my.cnf" "$DATADIR/.my.cnf"
|
||||||
mysql_note "Adding startup configuration:"
|
mysql_note "Adding startup configuration:"
|
||||||
my_print_defaults --defaults-file="$DATADIR/.my.cnf" --mysqld
|
my_print_defaults --defaults-file="$DATADIR/.my.cnf" --mariadbd
|
||||||
fi
|
fi
|
||||||
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
|
rm -rf "$DATADIR"/.init "$DATADIR"/.restore
|
||||||
if [ "$(id -u)" = "0" ]; then
|
if [ "$(id -u)" = "0" ]; then
|
||||||
@ -573,15 +573,15 @@ docker_mariadb_backup_system()
|
|||||||
fi
|
fi
|
||||||
local backup_db="system_mysql_backup_unknown_version.sql.zst"
|
local backup_db="system_mysql_backup_unknown_version.sql.zst"
|
||||||
local oldfullversion="unknown_version"
|
local oldfullversion="unknown_version"
|
||||||
if [ -r "$DATADIR"/mysql_upgrade_info ]; then
|
if [ -r "$DATADIR"/mariadb_upgrade_info ]; then
|
||||||
read -r -d '' oldfullversion < "$DATADIR"/mysql_upgrade_info || true
|
read -r -d '' oldfullversion < "$DATADIR"/mariadb_upgrade_info || true
|
||||||
if [ -n "$oldfullversion" ]; then
|
if [ -n "$oldfullversion" ]; then
|
||||||
backup_db="system_mysql_backup_${oldfullversion}.sql.zst"
|
backup_db="system_mysql_backup_${oldfullversion}.sql.zst"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mysql_note "Backing up system database to $backup_db"
|
mysql_note "Backing up system database to $backup_db"
|
||||||
if ! mysqldump --skip-lock-tables --replace --databases mysql --socket="${SOCKET}" | zstd > "${DATADIR}/${backup_db}"; then
|
if ! mariadb-dump --skip-lock-tables --replace --databases mysql --socket="${SOCKET}" | zstd > "${DATADIR}/${backup_db}"; then
|
||||||
mysql_error "Unable backup system database for upgrade from $oldfullversion."
|
mysql_error "Unable backup system database for upgrade from $oldfullversion."
|
||||||
fi
|
fi
|
||||||
mysql_note "Backing up complete"
|
mysql_note "Backing up complete"
|
||||||
@ -592,7 +592,7 @@ docker_mariadb_backup_system()
|
|||||||
docker_mariadb_upgrade() {
|
docker_mariadb_upgrade() {
|
||||||
if [ -z "$MARIADB_AUTO_UPGRADE" ] \
|
if [ -z "$MARIADB_AUTO_UPGRADE" ] \
|
||||||
|| [ "$MARIADB_AUTO_UPGRADE" = 0 ]; then
|
|| [ "$MARIADB_AUTO_UPGRADE" = 0 ]; then
|
||||||
mysql_note "MariaDB upgrade (mysql_upgrade or creating healthcheck users) required, but skipped due to \$MARIADB_AUTO_UPGRADE setting"
|
mysql_note "MariaDB upgrade (mariadb-upgrade or creating healthcheck users) required, but skipped due to \$MARIADB_AUTO_UPGRADE setting"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
mysql_note "Starting temporary server"
|
mysql_note "Starting temporary server"
|
||||||
@ -631,7 +631,7 @@ EOSQL
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mysql_note "Starting mariadb-upgrade"
|
mysql_note "Starting mariadb-upgrade"
|
||||||
mysql_upgrade --upgrade-system-tables
|
mariadb-upgrade --upgrade-system-tables
|
||||||
mysql_note "Finished mariadb-upgrade"
|
mysql_note "Finished mariadb-upgrade"
|
||||||
|
|
||||||
mysql_note "Stopping temporary server"
|
mysql_note "Stopping temporary server"
|
||||||
@ -641,14 +641,14 @@ EOSQL
|
|||||||
|
|
||||||
|
|
||||||
_check_if_upgrade_is_needed() {
|
_check_if_upgrade_is_needed() {
|
||||||
if [ ! -f "$DATADIR"/mysql_upgrade_info ]; then
|
if [ ! -f "$DATADIR"/mariadb_upgrade_info ]; then
|
||||||
mysql_note "MariaDB upgrade information missing, assuming required"
|
mysql_note "MariaDB upgrade information missing, assuming required"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
local mariadbVersion
|
local mariadbVersion
|
||||||
mariadbVersion="$(_mariadb_version)"
|
mariadbVersion="$(_mariadb_version)"
|
||||||
IFS='.-' read -ra newversion <<<"$mariadbVersion"
|
IFS='.-' read -ra newversion <<<"$mariadbVersion"
|
||||||
IFS='.-' read -ra oldversion < "$DATADIR"/mysql_upgrade_info || true
|
IFS='.-' read -ra oldversion < "$DATADIR"/mariadb_upgrade_info || true
|
||||||
|
|
||||||
if [[ ${#newversion[@]} -lt 2 ]] || [[ ${#oldversion[@]} -lt 2 ]] \
|
if [[ ${#newversion[@]} -lt 2 ]] || [[ ${#oldversion[@]} -lt 2 ]] \
|
||||||
|| [[ ${oldversion[0]} -lt ${newversion[0]} ]] \
|
|| [[ ${oldversion[0]} -lt ${newversion[0]} ]] \
|
||||||
@ -663,7 +663,7 @@ _check_if_upgrade_is_needed() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# check arguments for an option that would cause mysqld to stop
|
# check arguments for an option that would cause mariadbd to stop
|
||||||
# return true if there is one
|
# return true if there is one
|
||||||
_mysql_want_help() {
|
_mysql_want_help() {
|
||||||
local arg
|
local arg
|
||||||
@ -678,9 +678,9 @@ _mysql_want_help() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_main() {
|
_main() {
|
||||||
# if command starts with an option, prepend mysqld
|
# if command starts with an option, prepend mariadbd
|
||||||
if [ "${1:0:1}" = '-' ]; then
|
if [ "${1:0:1}" = '-' ]; then
|
||||||
set -- mysqld "$@"
|
set -- mariadbd "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#ENDOFSUBSTITUTIONS
|
#ENDOFSUBSTITUTIONS
|
||||||
@ -705,7 +705,7 @@ _main() {
|
|||||||
|
|
||||||
docker_mariadb_init "$@"
|
docker_mariadb_init "$@"
|
||||||
# MDEV-27636 mariadb_upgrade --check-if-upgrade-is-needed cannot be run offline
|
# MDEV-27636 mariadb_upgrade --check-if-upgrade-is-needed cannot be run offline
|
||||||
#elif mysql_upgrade --check-if-upgrade-is-needed; then
|
#elif mariadb-upgrade --check-if-upgrade-is-needed; then
|
||||||
elif _check_if_upgrade_is_needed; then
|
elif _check_if_upgrade_is_needed; then
|
||||||
docker_mariadb_upgrade "$@"
|
docker_mariadb_upgrade "$@"
|
||||||
fi
|
fi
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
# replication REPLICATION_CLIENT (<10.5)or REPLICA MONITOR (10.5+)
|
# replication REPLICATION_CLIENT (<10.5)or REPLICA MONITOR (10.5+)
|
||||||
# mariadbupgrade none, however unix user permissions on datadir
|
# mariadbupgrade none, however unix user permissions on datadir
|
||||||
#
|
#
|
||||||
# The SQL user used is the default for the mysql client. This can be the unix user
|
# The SQL user used is the default for the mariadb client. This can be the unix user
|
||||||
# if no user(or password) is set in the [mariadb-client] section of a configuration
|
# if no user(or password) is set in the [mariadb-client] section of a configuration
|
||||||
# file. --defaults-{file,extra-file,group-suffix} can specify a file/configuration
|
# file. --defaults-{file,extra-file,group-suffix} can specify a file/configuration
|
||||||
# different from elsewhere.
|
# different from elsewhere.
|
||||||
@ -38,7 +38,7 @@ set -eo pipefail
|
|||||||
|
|
||||||
_process_sql()
|
_process_sql()
|
||||||
{
|
{
|
||||||
mysql ${nodefaults:+--no-defaults} \
|
mariadb ${nodefaults:+--no-defaults} \
|
||||||
${def['file']:+--defaults-file=${def['file']}} \
|
${def['file']:+--defaults-file=${def['file']}} \
|
||||||
${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \
|
${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \
|
||||||
${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \
|
${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \
|
||||||
@ -59,7 +59,7 @@ connect()
|
|||||||
set +e +o pipefail
|
set +e +o pipefail
|
||||||
# (on second extra_file)
|
# (on second extra_file)
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
mysql ${nodefaults:+--no-defaults} \
|
mariadb ${nodefaults:+--no-defaults} \
|
||||||
${def['file']:+--defaults-file=${def['file']}} \
|
${def['file']:+--defaults-file=${def['file']}} \
|
||||||
${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \
|
${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \
|
||||||
${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \
|
${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \
|
||||||
@ -201,11 +201,11 @@ replication()
|
|||||||
|
|
||||||
# mariadbupgrade
|
# mariadbupgrade
|
||||||
#
|
#
|
||||||
# Test the lock on the file $datadir/mysql_upgrade_info
|
# Test the lock on the file $datadir/mariadb_upgrade_info
|
||||||
# https://jira.mariadb.org/browse/MDEV-27068
|
# https://jira.mariadb.org/browse/MDEV-27068
|
||||||
mariadbupgrade()
|
mariadbupgrade()
|
||||||
{
|
{
|
||||||
local f="$datadir/mysql_upgrade_info"
|
local f="$datadir/mariadb_upgrade_info"
|
||||||
if [ -r "$f" ]; then
|
if [ -r "$f" ]; then
|
||||||
flock --exclusive --nonblock -n 9 9<"$f"
|
flock --exclusive --nonblock -n 9 9<"$f"
|
||||||
return $?
|
return $?
|
||||||
|
80
update.sh
80
update.sh
@ -94,49 +94,55 @@ update_version()
|
|||||||
10.5)
|
10.5)
|
||||||
sed -i -e '/--old-mode/d' \
|
sed -i -e '/--old-mode/d' \
|
||||||
-e '/--skip-ssl/d' \
|
-e '/--skip-ssl/d' \
|
||||||
|
-e 's/mariadb-upgrade\([^_"]\)/mysql_upgrade\1/' \
|
||||||
|
-e 's/mariadb-dump/mysqldump/' \
|
||||||
|
-e 's/mariadb-admin/mysqladmin/' \
|
||||||
|
-e 's/\bmariadb --protocol\b/mysql --protocol/' \
|
||||||
|
-e 's/mariadb-install-db/mysql_install_db/g' \
|
||||||
|
-e 's/--mariadbd/--mysqld/' \
|
||||||
|
-e 's/mariadb-tzinfo-to-sql/mysql_tzinfo_to_sql/' \
|
||||||
|
-e '0,/#ENDOFSUBSTITUTIONS/s/mariadbd/mysqld/g' \
|
||||||
-e '/memory\.pressure/,+7d' "$dir/docker-entrypoint.sh"
|
-e '/memory\.pressure/,+7d' "$dir/docker-entrypoint.sh"
|
||||||
sed -i '/backwards compat/d' "$dir/Dockerfile"
|
|
||||||
sed -i -e '/--skip-ssl/d' \
|
sed -i -e '/--skip-ssl/d' \
|
||||||
"$dir"/healthcheck.sh
|
-e '0,/#ENDOFSUBSTITUTIONS/s/\tmariadb/\tmysql/' "$dir/healthcheck.sh"
|
||||||
|
sed -i -e '/^CMD/s/mariadbd/mysqld/' "$dir/Dockerfile"
|
||||||
|
sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \
|
||||||
|
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
|
||||||
|
;;
|
||||||
|
10.6)
|
||||||
|
sed -i -e '/memory\.pressure/,+7d' \
|
||||||
|
-e 's/--mariadbd/--mysqld/' \
|
||||||
|
"$dir/docker-entrypoint.sh"
|
||||||
|
sed -i -e '/--skip-ssl/d' "$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
|
||||||
|
sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \
|
||||||
|
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
|
||||||
|
;;
|
||||||
|
10.11)
|
||||||
|
sed -i -e 's/mariadb_upgrade_info/mysql_upgrade_info/' \
|
||||||
|
-e '/--skip-ssl/d' \
|
||||||
|
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
|
||||||
|
# quoted $ intentional
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
sed -i -e '/^ARG MARIADB_MAJOR/d' \
|
||||||
|
-e '/^ENV MARIADB_MAJOR/d' \
|
||||||
|
-e 's/-\$MARIADB_MAJOR//' \
|
||||||
|
"$dir/Dockerfile"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
sed -i -e '/^CMD/s/mysqld/mariadbd/' \
|
# quoted $ intentional
|
||||||
-e '/backwards compat/d' "$dir/Dockerfile"
|
# shellcheck disable=SC2016
|
||||||
sed -i -e 's/mysql_upgrade\([^_]\)/mariadb-upgrade\1/' \
|
sed -i -e '/^ARG MARIADB_MAJOR/d' \
|
||||||
-e 's/mysqldump/mariadb-dump/' \
|
-e '/^ENV MARIADB_MAJOR/d' \
|
||||||
-e 's/mysqladmin/mariadb-admin/' \
|
-e 's/-\$MARIADB_MAJOR//' \
|
||||||
-e 's/\bmysql --protocol\b/mariadb --protocol/' \
|
"$dir/Dockerfile"
|
||||||
-e 's/mysql_install_db/mariadb-install-db/' \
|
if [[ $vmin =~ 11.[12] ]]; then
|
||||||
-e 's/mysql_tzinfo_to_sql/mariadb-tzinfo-to-sql/' \
|
sed -i -e '/--skip-ssl/d' \
|
||||||
"$dir/docker-entrypoint.sh"
|
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
|
||||||
if [ "$vmin" = 10.6 ]; then
|
|
||||||
# my_print_defaults didn't recognise --mysqld until 10.11
|
|
||||||
sed -i -e '0,/#ENDOFSUBSTITUTIONS/s/\([^-]\)mysqld/\1mariadbd/g' \
|
|
||||||
"$dir/docker-entrypoint.sh"
|
|
||||||
else
|
|
||||||
sed -i -e '0,/#ENDOFSUBSTITUTIONS/s/\mysqld/mariadbd/g' \
|
|
||||||
"$dir/docker-entrypoint.sh"
|
|
||||||
fi
|
fi
|
||||||
sed -i -e '0,/#ENDOFSUBSTITUTIONS/s/\bmysql\b/mariadb/' "$dir/healthcheck.sh"
|
if [ "$vmin" == 11.1 ]; then
|
||||||
if [[ ! "${vmin}" =~ 10.[678] ]]; then
|
|
||||||
# quoted $ intentional
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
sed -i -e '/^ARG MARIADB_MAJOR/d' \
|
|
||||||
-e '/^ENV MARIADB_MAJOR/d' \
|
|
||||||
-e 's/-\$MARIADB_MAJOR//' \
|
|
||||||
"$dir/Dockerfile"
|
|
||||||
else
|
|
||||||
sed -i -e '/memory\.pressure/,+7d' "$dir/docker-entrypoint.sh"
|
|
||||||
fi
|
|
||||||
if [[ $vmin = 10.* || $vmin =~ 11.[12] ]]; then
|
|
||||||
sed -i -e '/--skip-ssl/d' "$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
|
|
||||||
fi
|
|
||||||
if [[ $vmin =~ 11.[012345] ]]; then
|
|
||||||
sed -i -e 's/mysql_upgrade_info/mariadb_upgrade_info/' \
|
|
||||||
"$dir/docker-entrypoint.sh" "$dir/healthcheck.sh"
|
|
||||||
fi
|
|
||||||
if [[ $vmin =~ 11.[01] ]]; then
|
|
||||||
sed -i -e 's/50-mysqld_safe.cnf/50-mariadb_safe.cnf/' "$dir/Dockerfile"
|
sed -i -e 's/50-mysqld_safe.cnf/50-mariadb_safe.cnf/' "$dir/Dockerfile"
|
||||||
|
else
|
||||||
|
sed -i -e 's/ \/[^ ]*50-mysqld_safe.cnf//' "$dir/Dockerfile"
|
||||||
fi
|
fi
|
||||||
;&
|
;&
|
||||||
esac
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user