From d6bcfefa5f105de1e44bab65964c086b8715408e Mon Sep 17 00:00:00 2001 From: Alexander Taborda Acosta Date: Thu, 13 Aug 2026 11:11:36 -0500 Subject: [PATCH] fix: restore MariaDB definers after backup recovery Recreate and reset the accounts required by restored RomM views, triggers, and loopback database access before MariaDB accepts network connections. Release the restore fix as 5.1.0:10. --- docker-images/mariadb/Dockerfile | 9 ++++-- docker-images/mariadb/startos-entrypoint.sh | 32 +++++++++++++++++++++ startos/versions/current.ts | 12 ++++---- 3 files changed, 44 insertions(+), 9 deletions(-) create mode 100755 docker-images/mariadb/startos-entrypoint.sh diff --git a/docker-images/mariadb/Dockerfile b/docker-images/mariadb/Dockerfile index 4c391b4..c2212de 100644 --- a/docker-images/mariadb/Dockerfile +++ b/docker-images/mariadb/Dockerfile @@ -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"] diff --git a/docker-images/mariadb/startos-entrypoint.sh b/docker-images/mariadb/startos-entrypoint.sh new file mode 100755 index 0000000..84022f3 --- /dev/null +++ b/docker-images/mariadb/startos-entrypoint.sh @@ -0,0 +1,32 @@ +#!/bin/sh +set -eu + +/usr/local/bin/docker-entrypoint.sh "$@" --skip-networking & +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'@'%' IDENTIFIED BY '$MARIADB_PASSWORD'; ALTER USER 'romm'@'%' IDENTIFIED BY '$MARIADB_PASSWORD'; GRANT ALL PRIVILEGES ON romm.* TO 'romm'@'%'; CREATE USER IF NOT EXISTS 'romm'@'127.0.0.1' IDENTIFIED BY '$MARIADB_PASSWORD'; ALTER USER 'romm'@'127.0.0.1' IDENTIFIED BY '$MARIADB_PASSWORD'; GRANT ALL PRIVILEGES ON romm.* TO 'romm'@'127.0.0.1';" + +kill -TERM "$server_pid" +wait "$server_pid" + +exec /usr/local/bin/docker-entrypoint.sh "$@" diff --git a/startos/versions/current.ts b/startos/versions/current.ts index 98fe2ea..19ead39 100644 --- a/startos/versions/current.ts +++ b/startos/versions/current.ts @@ -1,18 +1,18 @@ import { IMPOSSIBLE, VersionInfo } from '@start9labs/start-sdk' export const current = VersionInfo.of({ - version: '5.1.0:1', + version: '5.1.0:10', releaseNotes: { en_US: - 'Initial StartOS release of RomM 5.1.0. Adds the scan settings UI and per-field artwork priorities, improves library scanning, and includes security hardening and numerous fixes. Full release notes: https://github.com/rommapp/romm/releases/tag/5.1.0', + 'Restores the MariaDB account required by RomM view and trigger definers after backup recovery. Full release notes: https://github.com/rommapp/romm/releases/tag/5.1.0', es_ES: - 'Versión inicial de RomM 5.1.0 para StartOS. Añade la interfaz de configuración de escaneo y prioridades de ilustraciones por campo, mejora el escaneo de la biblioteca e incluye refuerzos de seguridad y numerosas correcciones. Notas completas: https://github.com/rommapp/romm/releases/tag/5.1.0', + 'Restaura la cuenta de MariaDB requerida por los definidores de vistas y disparadores de RomM después de recuperar una copia de seguridad. Notas completas: https://github.com/rommapp/romm/releases/tag/5.1.0', de_DE: - 'Erste StartOS-Veröffentlichung von RomM 5.1.0. Fügt die Oberfläche für Scan-Einstellungen und feldbezogene Prioritäten für Grafiken hinzu, verbessert Bibliotheksscans und enthält Sicherheitshärtungen sowie zahlreiche Korrekturen. Vollständige Versionshinweise: https://github.com/rommapp/romm/releases/tag/5.1.0', + 'Stellt nach einer Sicherungswiederherstellung das MariaDB-Konto wieder her, das von den Definern der RomM-Views und Trigger benötigt wird. Vollständige Versionshinweise: https://github.com/rommapp/romm/releases/tag/5.1.0', pl_PL: - 'Pierwsze wydanie RomM 5.1.0 dla StartOS. Dodaje interfejs ustawień skanowania i priorytety grafik dla poszczególnych pól, usprawnia skanowanie biblioteki oraz zawiera wzmocnienia zabezpieczeń i liczne poprawki. Pełne informacje o wydaniu: https://github.com/rommapp/romm/releases/tag/5.1.0', + 'Przywraca po odzyskaniu kopii zapasowej konto MariaDB wymagane przez definicje widoków i wyzwalaczy RomM. Pełne informacje o wydaniu: https://github.com/rommapp/romm/releases/tag/5.1.0', fr_FR: - 'Première version de RomM 5.1.0 pour StartOS. Ajoute l’interface des paramètres d’analyse et les priorités d’illustration par champ, améliore l’analyse de la ludothèque et inclut un renforcement de la sécurité ainsi que de nombreux correctifs. Notes complètes : https://github.com/rommapp/romm/releases/tag/5.1.0', + 'Restaure après récupération d’une sauvegarde le compte MariaDB requis par les définisseurs des vues et déclencheurs RomM. Notes complètes : https://github.com/rommapp/romm/releases/tag/5.1.0', }, migrations: { up: async () => {},