diff options
author | Florian Klink <flokli@flokli.de> | 2019-05-17 14:12:52 +0200 |
---|---|---|
committer | Florian Klink <flokli@flokli.de> | 2019-05-31 22:27:55 +0200 |
commit | 5ea7a3eb211d0c75f8f50bdfaeeba1ec72031b57 (patch) | |
tree | 01796b6ce6e74980c8063228f208cfb16515e601 /nixos | |
parent | edd10c12f76145decf19f81e9c86ad5ad4a01c0e (diff) |
nixos/mysql: drop services.mysql.pidDir
mysql already has its socket path hardcoded to to /run/mysqld/mysqld.sock. There's not much value in making the pidDir configurable, which also points to /run/mysqld by default. We only seem to use `services.mysql.pidDir` in the wordpress startup script, to wait for mysql to boot up, but we can also simply wait on the (hardcoded) socket location too. A much nicer way to accomplish that would be to properly describe a dependency on mysqld.service. This however is not easily doable, due to how the apache-httpd module was designed.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/doc/manual/release-notes/rl-1909.xml | 8 | ||||
-rw-r--r-- | nixos/modules/rename.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/databases/mysql.nix | 15 | ||||
-rw-r--r-- | nixos/modules/services/web-servers/apache-httpd/wordpress.nix | 2 |
4 files changed, 12 insertions, 14 deletions
diff --git a/nixos/doc/manual/release-notes/rl-1909.xml b/nixos/doc/manual/release-notes/rl-1909.xml index ef2b1d3418937..0b411005f1e02 100644 --- a/nixos/doc/manual/release-notes/rl-1909.xml +++ b/nixos/doc/manual/release-notes/rl-1909.xml @@ -95,6 +95,14 @@ </listitem> <listitem> <para> + The <option>services.mysql.pidDir</option> option was removed, as it was only used by the wordpress + apache-httpd service to wait for mysql to have started up. + This can be accomplished by either describing a dependency on mysql.service (preferred) + or waiting for the (hardcoded) <filename>/run/mysqld/mysql.sock</filename> file to appear. + </para> + </listitem> + <listitem> + <para> The <option>services.emby.enable</option> module has been removed, see <option>services.jellyfin.enable</option> instead for a free software fork of Emby. diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 7db0f7f050aca..a424e86038e7a 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -212,6 +212,7 @@ with lib; (mkRemovedOptionModule [ "services" "logstash" "enableWeb" ] "The web interface was removed from logstash") (mkRemovedOptionModule [ "boot" "zfs" "enableLegacyCrypto" ] "The corresponding package was removed from nixpkgs.") (mkRemovedOptionModule [ "services" "winstone" ] "The corresponding package was removed from nixpkgs.") + (mkRemovedOptionModule [ "services" "mysql" "pidDir" ] "Don't wait for pidfiles, describe dependencies through systemd") # ZSH (mkRenamedOptionModule [ "programs" "zsh" "enableSyntaxHighlighting" ] [ "programs" "zsh" "syntaxHighlighting" "enable" ]) diff --git a/nixos/modules/services/databases/mysql.nix b/nixos/modules/services/databases/mysql.nix index 97e58fd228f45..66d55b650a450 100644 --- a/nixos/modules/services/databases/mysql.nix +++ b/nixos/modules/services/databases/mysql.nix @@ -18,16 +18,12 @@ let in (pName mysql == pName pkgs.mysql57) && ((builtins.compareVersions mysql.version "5.7") >= 0); - pidFile = "${cfg.pidDir}/mysqld.pid"; - - mysqldAndInstallOptions = - "--user=${cfg.user} --datadir=${cfg.dataDir} --basedir=${mysql}"; mysqldOptions = - "${mysqldAndInstallOptions} --pid-file=${pidFile}"; + "--user=${cfg.user} --datadir=${cfg.dataDir} --basedir=${mysql}"; # For MySQL 5.7+, --insecure creates the root user without password # (earlier versions and MariaDB do this by default). installOptions = - "${mysqldAndInstallOptions} ${lib.optionalString isMysqlAtLeast57 "--insecure"}"; + "${mysqldOptions} ${lib.optionalString isMysqlAtLeast57 "--insecure"}"; in @@ -80,11 +76,6 @@ in description = "Location where MySQL stores its table files"; }; - pidDir = mkOption { - default = "/run/mysqld"; - description = "Location of the file which stores the PID of the MySQL server"; - }; - extraOptions = mkOption { type = types.lines; default = ""; @@ -298,7 +289,6 @@ in systemd.tmpfiles.rules = [ "d '${cfg.dataDir}' 0700 ${cfg.user} mysql -" - "d '${cfg.pidDir}' 0755 ${cfg.user} mysql -" ]; systemd.services.mysql = let @@ -329,7 +319,6 @@ in User = cfg.user; Group = "mysql"; Type = if hasNotify then "notify" else "simple"; - # /run/mysqld needs to be created in addition to pidDir, as they could point to different locations RuntimeDirectory = "mysqld"; RuntimeDirectoryMode = "0755"; # The last two environment variables are used for starting Galera clusters diff --git a/nixos/modules/services/web-servers/apache-httpd/wordpress.nix b/nixos/modules/services/web-servers/apache-httpd/wordpress.nix index c68bfd25f6a86..3dddda138fedb 100644 --- a/nixos/modules/services/web-servers/apache-httpd/wordpress.nix +++ b/nixos/modules/services/web-servers/apache-httpd/wordpress.nix @@ -273,7 +273,7 @@ in if [ ! -d ${serverInfo.fullConfig.services.mysql.dataDir}/${config.dbName} ]; then echo "Need to create the database '${config.dbName}' and grant permissions to user named '${config.dbUser}'." # Wait until MySQL is up - while [ ! -e ${serverInfo.fullConfig.services.mysql.pidDir}/mysqld.pid ]; do + while [ ! -S /run/mysqld/mysqld.sock ]; do sleep 1 done ${pkgs.mysql}/bin/mysql -e 'CREATE DATABASE ${config.dbName};' |