Fixes backup restore by recreating the MariaDB account RomM uses over the internal loopback connection, including backups that restore the database root credential.
This commit is contained in:
3 files changed
+41
-9
No files matched your search
@@ -1,10 +1,13 @@
|
||||
FROM mariadb:11.4.5@sha256:49117dcc565cf51aa57ac5fca59ab31213402ff0eae6ffc13c46a37b938f7e4b
|
||||
|
||||
# start-sdk 2.0.9's logical backup helper invokes the legacy MySQL command
|
||||
# names. MariaDB 11.4 ships only mariadb-* names, so expose compatibility
|
||||
# aliases until these commands are configurable by the SDK.
|
||||
RUN ln -s /usr/bin/mariadb-admin /usr/local/bin/mysqladmin \
|
||||
&& ln -s /usr/bin/mariadb-dump /usr/local/bin/mysqldump \
|
||||
&& ln -s /usr/bin/mariadb /usr/local/bin/mysql \
|
||||
&& ln -s /usr/bin/mariadb-install-db /usr/local/bin/mysql_install_db \
|
||||
&& ln -s /usr/sbin/mariadbd /usr/local/bin/mysqld
|
||||
|
||||
COPY startos-entrypoint.sh /usr/local/bin/startos-entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/startos-entrypoint.sh"]
|
||||
|
||||
CMD ["mariadbd"]
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
/usr/local/bin/docker-entrypoint.sh "$@" &
|
||||
server_pid=$!
|
||||
|
||||
trap 'kill -TERM "$server_pid" 2>/dev/null || true; wait "$server_pid"' TERM INT
|
||||
|
||||
root_password=''
|
||||
|
||||
until {
|
||||
if mariadb --protocol=socket --user=root --password="$MARIADB_ROOT_PASSWORD" --execute 'SELECT 1' >/dev/null 2>&1; then
|
||||
root_password="$MARIADB_ROOT_PASSWORD"
|
||||
elif mariadb --protocol=socket --user=root --password="$MARIADB_PASSWORD" --execute 'SELECT 1' >/dev/null 2>&1; then
|
||||
root_password="$MARIADB_PASSWORD"
|
||||
else
|
||||
false
|
||||
fi
|
||||
}; do
|
||||
if ! kill -0 "$server_pid" 2>/dev/null; then
|
||||
wait "$server_pid"
|
||||
exit $?
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
mariadb --protocol=socket --user=root --password="$root_password" --execute "CREATE USER IF NOT EXISTS 'romm'@'127.0.0.1' IDENTIFIED BY '$MARIADB_PASSWORD'; GRANT ALL PRIVILEGES ON romm.* TO 'romm'@'127.0.0.1'; FLUSH PRIVILEGES;"
|
||||
|
||||
wait "$server_pid"
|
||||
Reference in new issue
Block a user