diff --git a/lxc1/p0-infrastructure/mgdb.yml b/lxc1/p0-infrastructure/mgdb.yml index 3a22b45..0226275 100644 --- a/lxc1/p0-infrastructure/mgdb.yml +++ b/lxc1/p0-infrastructure/mgdb.yml @@ -9,11 +9,13 @@ services: - MARIADB_USER=${DB_ADMIN_USER} - MARIADB_PASSWORD=${DB_ADMIN_PASSWORD} - MARIADB_DATABASE=initial_db + - SST_PASSWORD=${SST_PASSWORD} volumes: - /docker/maria/data:/var/lib/mysql - /docker/maria/conf:/etc/mysql/conf.d + - /docker/maria/init:/docker-entrypoint-initdb.d command: - - mariadb + - mariadbd - --${WS_NEW_CLUSTER} - --wsrep-on=ON - --wsrep-provider=/usr/lib/galera/libgalera_smm.so diff --git a/lxc1/p0-infrastructure/mgdb/01_deploy_mgdb_dbs.sh b/lxc1/p0-infrastructure/mgdb/01_deploy_mgdb_dbs.sh index d739bd9..1a0569f 100644 --- a/lxc1/p0-infrastructure/mgdb/01_deploy_mgdb_dbs.sh +++ b/lxc1/p0-infrastructure/mgdb/01_deploy_mgdb_dbs.sh @@ -30,4 +30,13 @@ EOSQL done echo "All slots provisioned. Flushing privileges..." -mariadb -u root -p"${M_ROOT_PASS}" -e "FLUSH PRIVILEGES;" \ No newline at end of file +mariadb -u root -p"${M_ROOT_PASS}" -e "FLUSH PRIVILEGES;" + +# Add this inside your 01_deploy_mgdb_dbs.sh script +# (either in the loop or as a standalone block at the bottom) + +mariadb -u root -p"${M_ROOT_PASS}" <<-EOSQL + CREATE USER IF NOT EXISTS 'sstuser'@'localhost' IDENTIFIED BY '${SST_PASSWORD}'; + GRANT RELOAD, PROCESS, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'sstuser'@'localhost'; + FLUSH PRIVILEGES; +EOSQL \ No newline at end of file