about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/services/databases
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-05-18 14:34:25 +0000
committerAlyssa Ross <hi@alyssa.is>2020-05-18 16:21:12 +0000
commit93e90ca356baed5941e1cccf8c0d8e3e2c460e29 (patch)
treef6c26f06a2f830a3f1bab00fdc029b76be8805c6 /nixpkgs/nixos/modules/services/databases
parentd2753504ef2bd591ade35851dad31d3aac117e19 (diff)
parentb47873026c7e356a340d0e1de7789d4e8428ac66 (diff)
downloadnixlib-93e90ca356baed5941e1cccf8c0d8e3e2c460e29.tar
nixlib-93e90ca356baed5941e1cccf8c0d8e3e2c460e29.tar.gz
nixlib-93e90ca356baed5941e1cccf8c0d8e3e2c460e29.tar.bz2
nixlib-93e90ca356baed5941e1cccf8c0d8e3e2c460e29.tar.lz
nixlib-93e90ca356baed5941e1cccf8c0d8e3e2c460e29.tar.xz
nixlib-93e90ca356baed5941e1cccf8c0d8e3e2c460e29.tar.zst
nixlib-93e90ca356baed5941e1cccf8c0d8e3e2c460e29.zip
Merge commit 'b47873026c7e356a340d0e1de7789d4e8428ac66'
Diffstat (limited to 'nixpkgs/nixos/modules/services/databases')
-rw-r--r--nixpkgs/nixos/modules/services/databases/mysql.nix7
-rw-r--r--nixpkgs/nixos/modules/services/databases/postgresql.nix14
2 files changed, 17 insertions, 4 deletions
diff --git a/nixpkgs/nixos/modules/services/databases/mysql.nix b/nixpkgs/nixos/modules/services/databases/mysql.nix
index f9e657f57742..44183788d936 100644
--- a/nixpkgs/nixos/modules/services/databases/mysql.nix
+++ b/nixpkgs/nixos/modules/services/databases/mysql.nix
@@ -87,7 +87,6 @@ in
             datadir = /var/lib/mysql
             bind-address = 127.0.0.1
             port = 3336
-            plugin-load-add = auth_socket.so
 
             !includedir /etc/mysql/conf.d/
           ''';
@@ -315,13 +314,16 @@ in
         datadir = cfg.dataDir;
         bind-address = mkIf (cfg.bind != null) cfg.bind;
         port = cfg.port;
-        plugin-load-add = optional (cfg.ensureUsers != []) "auth_socket.so";
       }
       (mkIf (cfg.replication.role == "master" || cfg.replication.role == "slave") {
         log-bin = "mysql-bin-${toString cfg.replication.serverId}";
         log-bin-index = "mysql-bin-${toString cfg.replication.serverId}.index";
         relay-log = "mysql-relay-bin";
         server-id = cfg.replication.serverId;
+        binlog-ignore-db = [ "information_schema" "performance_schema" "mysql" ];
+      })
+      (mkIf (!isMariaDB) {
+        plugin-load-add = optional (cfg.ensureUsers != []) "auth_socket.so";
       })
     ];
 
@@ -444,7 +446,6 @@ in
 
                         ( echo "stop slave;"
                           echo "change master to master_host='${cfg.replication.masterHost}', master_user='${cfg.replication.masterUser}', master_password='${cfg.replication.masterPassword}';"
-                          echo "set global slave_exec_mode='IDEMPOTENT';"
                           echo "start slave;"
                         ) | ${mysql}/bin/mysql -u root -N
                       ''}
diff --git a/nixpkgs/nixos/modules/services/databases/postgresql.nix b/nixpkgs/nixos/modules/services/databases/postgresql.nix
index 93f5c1ca5f55..579b6a4d9c67 100644
--- a/nixpkgs/nixos/modules/services/databases/postgresql.nix
+++ b/nixpkgs/nixos/modules/services/databases/postgresql.nix
@@ -17,6 +17,7 @@ let
       hba_file = '${pkgs.writeText "pg_hba.conf" cfg.authentication}'
       ident_file = '${pkgs.writeText "pg_ident.conf" cfg.identMap}'
       log_destination = 'stderr'
+      log_line_prefix = '${cfg.logLinePrefix}'
       listen_addresses = '${if cfg.enableTCPIP then "*" else "localhost"}'
       port = ${toString cfg.port}
       ${cfg.extraConfig}
@@ -186,6 +187,17 @@ in
         '';
       };
 
+      logLinePrefix = mkOption {
+        type = types.str;
+        default = "[%p] ";
+        example = "%m [%p] ";
+        description = ''
+          A printf-style string that is output at the beginning of each log line.
+          Upstream default is <literal>'%m [%p] '</literal>, i.e. it includes the timestamp. We do
+          not include the timestamp, because journal has it anyway.
+        '';
+      };
+
       extraPlugins = mkOption {
         type = types.listOf types.path;
         default = [];
@@ -331,7 +343,7 @@ in
         # Wait for PostgreSQL to be ready to accept connections.
         postStart =
           ''
-            PSQL="${pkgs.sudo}/bin/sudo -u ${cfg.superUser} psql --port=${toString cfg.port}"
+            PSQL="${pkgs.utillinux}/bin/runuser -u ${cfg.superUser} -- psql --port=${toString cfg.port}"
 
             while ! $PSQL -d postgres -c "" 2> /dev/null; do
                 if ! kill -0 "$MAINPID"; then exit 1; fi