]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Fix mariadb replication
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 13 Oct 2021 00:24:38 +0000 (02:24 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 14 Oct 2021 14:21:31 +0000 (16:21 +0200)
It adds the pam soname at install which is missing at first dump.

modules/private/databases/mariadb_replication.nix

index 5a5a8b0ebcb669df0f7a84135cb3c8cb2156d35e..b89c764ec536d6e012a82b4aaeebcdd2c3e6ba85 100644 (file)
@@ -192,15 +192,17 @@ in
 
         preStart = ''
           if ! test -e ${dataDir}/mysql; then
-            ${hcfg.package}/bin/mysqldump \
-              --defaults-file=${config.secrets.location}/mysql_replication/${name}/mysqldump_remote \
-              -h ${hcfg.host} \
-              -P ${hcfg.port} \
-              --ssl \
-              --gtid \
-              --flush-privileges \
-              --master-data \
-              --all-databases > ${dataDir}/initial.sql
+            if ! test -e ${dataDir}/initial.sql; then
+              ${hcfg.package}/bin/mysqldump \
+                --defaults-file=${config.secrets.location}/mysql_replication/${name}/mysqldump_remote \
+                -h ${hcfg.host} \
+                -P ${hcfg.port} \
+                --ssl \
+                --gtid \
+                --flush-privileges \
+                --master-data \
+                --all-databases > ${dataDir}/initial.sql
+            fi
 
             ${hcfg.package}/bin/mysql_install_db \
               --defaults-file=/etc/mysql/${name}_my.cnf \
@@ -224,6 +226,7 @@ in
             let
               sql_before = pkgs.writeText "mysql-initial-before" ''
                 DROP DATABASE test;
+                INSTALL SONAME 'auth_pam';
                 '';
               setupScript = pkgs.writeScript "mysql-setup" ''
                 #!${pkgs.runtimeShell} -e