From 916d39f5ce36964a5b62f20d4c5ae3d18cfdea51 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 14 Jul 2013 01:47:40 +0200 Subject: [PATCH] mysql/mysql55: Log to stderr instead of logfile. This should integrate the logging more tightly into systemd, so for example "systemctl status mysql" actually gives an overview about what's actually going on. This removes the logError option attribute, so in case you still want to write into a logfile, I've introduced an option called extraOptions, so you can use something like: services.mysql*.extraOptions = '' log-error = /var/log/mysql_err.log ''; Signed-off-by: aszlig --- modules/services/databases/mysql.nix | 24 ++++++++++++++++++------ modules/services/databases/mysql55.nix | 24 ++++++++++++++++++------ 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/modules/services/databases/mysql.nix b/modules/services/databases/mysql.nix index 7bf7a77aa85..ed9d03dc60f 100644 --- a/modules/services/databases/mysql.nix +++ b/modules/services/databases/mysql.nix @@ -12,7 +12,7 @@ let mysqldOptions = "--user=${cfg.user} --datadir=${cfg.dataDir} " + - "--log-error=${cfg.logError} --pid-file=${pidFile}"; + "--pid-file=${pidFile}"; myCnf = pkgs.writeText "my.cnf" '' @@ -26,6 +26,7 @@ let master-password = ${cfg.replication.masterPassword} master-port = ${toString cfg.replication.masterPort} ''} + ${cfg.extraOptions} ''; in @@ -67,16 +68,27 @@ in description = "Location where MySQL stores its table files"; }; - logError = mkOption { - default = "/var/log/mysql_err.log"; - description = "Location of the MySQL error logfile"; - }; - pidDir = mkOption { default = "/var/run/mysql"; description = "Location of the file which stores the PID of the MySQL server"; }; + extraOptions = mkOption { + default = ""; + example = '' + key_buffer_size = 6G + table_cache = 1600 + log-error = /var/log/mysql_err.log + ''; + description = '' + Provide extra options to the MySQL configuration file. + + Please note, that these options are added to the + [mysqld] section so you don't need to explicitly + state it again. + ''; + }; + initialDatabases = mkOption { default = []; description = "List of database names and their initial schemas that should be used to create databases on the first startup of MySQL"; diff --git a/modules/services/databases/mysql55.nix b/modules/services/databases/mysql55.nix index 37cab395677..1da182a0e59 100644 --- a/modules/services/databases/mysql55.nix +++ b/modules/services/databases/mysql55.nix @@ -12,13 +12,14 @@ let mysqldOptions = "--user=${cfg.user} --datadir=${cfg.dataDir} " + - "--log-error=${cfg.logError} --pid-file=${pidFile}"; + "--pid-file=${pidFile}"; myCnf = pkgs.writeText "my.cnf" '' [mysqld] ${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "log-bin=mysql-bin"} ${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "server-id = ${toString cfg.replication.serverId}"} + ${cfg.extraOptions} ''; in @@ -60,16 +61,27 @@ in description = "Location where MySQL stores its table files"; }; - logError = mkOption { - default = "/var/log/mysql_err.log"; - description = "Location of the MySQL error logfile"; - }; - pidDir = mkOption { default = "/var/run/mysql"; description = "Location of the file which stores the PID of the MySQL server"; }; + extraOptions = mkOption { + default = ""; + example = '' + key_buffer_size = 6G + table_cache = 1600 + log-error = /var/log/mysql_err.log + ''; + description = '' + Provide extra options to the MySQL configuration file. + + Please note, that these options are added to the + [mysqld] section so you don't need to explicitly + state it again. + ''; + }; + initialDatabases = mkOption { default = []; description = "List of database names and their initial schemas that should be used to create databases on the first startup of MySQL";