aboutsummaryrefslogtreecommitdiff
path: root/modules/private/databases/mariadb_replication.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/private/databases/mariadb_replication.nix')
-rw-r--r--modules/private/databases/mariadb_replication.nix24
1 files changed, 10 insertions, 14 deletions
diff --git a/modules/private/databases/mariadb_replication.nix b/modules/private/databases/mariadb_replication.nix
index e857c41..68e6f7f 100644
--- a/modules/private/databases/mariadb_replication.nix
+++ b/modules/private/databases/mariadb_replication.nix
@@ -81,9 +81,8 @@ in
81 }; 81 };
82 users.groups.mysql.gid = config.ids.gids.mysql; 82 users.groups.mysql.gid = config.ids.gids.mysql;
83 83
84 secrets.keys = lib.flatten (lib.mapAttrsToList (name: hcfg: [ 84 secrets.keys = lib.listToAttrs (lib.flatten (lib.mapAttrsToList (name: hcfg: [
85 { 85 (lib.nameValuePair "mysql_replication/${name}/slave_init_commands" {
86 dest = "mysql_replication/${name}/slave_init_commands";
87 user = "mysql"; 86 user = "mysql";
88 group = "mysql"; 87 group = "mysql";
89 permissions = "0400"; 88 permissions = "0400";
@@ -91,9 +90,8 @@ in
91 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; 90 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;
92 START SLAVE; 91 START SLAVE;
93 ''; 92 '';
94 } 93 })
95 { 94 (lib.nameValuePair "mysql_replication/${name}/mysqldump_remote" {
96 dest = "mysql_replication/${name}/mysqldump_remote";
97 permissions = "0400"; 95 permissions = "0400";
98 user = "root"; 96 user = "root";
99 group = "root"; 97 group = "root";
@@ -102,9 +100,8 @@ in
102 user = ${hcfg.user} 100 user = ${hcfg.user}
103 password = ${hcfg.password} 101 password = ${hcfg.password}
104 ''; 102 '';
105 } 103 })
106 { 104 (lib.nameValuePair "mysql_replication/${name}/mysqldump" {
107 dest = "mysql_replication/${name}/mysqldump";
108 permissions = "0400"; 105 permissions = "0400";
109 user = "root"; 106 user = "root";
110 group = "root"; 107 group = "root";
@@ -113,9 +110,8 @@ in
113 user = ${hcfg.dumpUser} 110 user = ${hcfg.dumpUser}
114 password = ${hcfg.dumpPassword} 111 password = ${hcfg.dumpPassword}
115 ''; 112 '';
116 } 113 })
117 { 114 (lib.nameValuePair "mysql_replication/${name}/client" {
118 dest = "mysql_replication/${name}/client";
119 permissions = "0400"; 115 permissions = "0400";
120 user = "mysql"; 116 user = "mysql";
121 group = "mysql"; 117 group = "mysql";
@@ -124,8 +120,8 @@ in
124 user = ${hcfg.dumpUser} 120 user = ${hcfg.dumpUser}
125 password = ${hcfg.dumpPassword} 121 password = ${hcfg.dumpPassword}
126 ''; 122 '';
127 } 123 })
128 ]) cfg.hosts); 124 ]) cfg.hosts));
129 125
130 services.cron = { 126 services.cron = {
131 enable = true; 127 enable = true;