]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - systems/backup-2/databases/mariadb_replication.nix
Squash changes containing private information
[perso/Immae/Config/Nix.git] / systems / backup-2 / databases / mariadb_replication.nix
similarity index 89%
rename from modules/private/databases/mariadb_replication.nix
rename to systems/backup-2/databases/mariadb_replication.nix
index 68e6f7fdd809590e503d35d7e4793539b9d695a2..8d2b45727652fba98ea1db897726c5561c08e169 100644 (file)
@@ -38,7 +38,7 @@ in
               '';
           };
           port = lib.mkOption {
-            type = lib.types.str;
+            type = lib.types.int;
             description = ''
               Port to connect to
               '';
@@ -73,6 +73,26 @@ in
   };
 
   config = lib.mkIf cfg.enable {
+    myServices.chatonsProperties.hostings.mysql-replication = {
+      file.datetime = "2022-08-27T15:00:00";
+      hosting = {
+        name = "Mysql replication";
+        description = "Replication of mysql database";
+        website = "db-1.immae.eu";
+        status.level = "OK";
+        status.description = "OK";
+        registration.load = "OPEN";
+        install.type = "PACKAGE";
+      };
+      software = {
+        name = "MariaDB";
+        website = "https://mariadb.org/";
+        license.url = "https://github.com/MariaDB/server/blob/10.11/COPYING";
+        license.name = "GNU General Public License v2.0";
+        version = pkgs.mariadb.version;
+        source.url = "https://github.com/MariaDB/server";
+      };
+    };
     users.users.mysql = {
       description = "MySQL server user";
       group = "mysql";
@@ -87,7 +107,7 @@ in
         group = "mysql";
         permissions = "0400";
         text = ''
-          CHANGE MASTER TO master_host="${hcfg.host}", master_port=${hcfg.port}, master_user="${hcfg.user}", master_password="${hcfg.password}", master_ssl=1, master_use_gtid=slave_pos;
+          CHANGE MASTER TO master_host="${hcfg.host}", master_port=${builtins.toString hcfg.port}, master_user="${hcfg.user}", master_password="${hcfg.password}", master_ssl=1, master_use_gtid=slave_pos;
           START SLAVE;
           '';
       })
@@ -192,7 +212,7 @@ in
               ${hcfg.package}/bin/mysqldump \
                 --defaults-file=${config.secrets.fullPaths."mysql_replication/${name}/mysqldump_remote"} \
                 -h ${hcfg.host} \
-                -P ${hcfg.port} \
+                -P ${builtins.toString hcfg.port} \
                 --ssl \
                 --gtid \
                 --flush-privileges \