Merge pull request #105369 from markuskowa/upd-slurm
slurm/nixos: 20.02.5.1 -> 20.11.0.1, fix module
This commit is contained in:
@@ -278,6 +278,15 @@
|
|||||||
<xref linkend="opt-services.privoxy.enableTor" /> = true;
|
<xref linkend="opt-services.privoxy.enableTor" /> = true;
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
The options <literal>services.slurm.dbdserver.storagePass</literal>
|
||||||
|
and <literal>services.slurm.dbdserver.configFile</literal> have been removed.
|
||||||
|
Use <literal>services.slurm.dbdserver.storagePassFile</literal> instead to provide the database password.
|
||||||
|
Extra config options can be given via the option <literal>services.slurm.dbdserver.extraConfig</literal>. The actual configuration file is created on the fly on startup of the service.
|
||||||
|
This avoids that the password gets exposed in the nix store.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@@ -34,13 +34,12 @@ let
|
|||||||
${cfg.extraCgroupConfig}
|
${cfg.extraCgroupConfig}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
slurmdbdConf = pkgs.writeTextDir "slurmdbd.conf"
|
slurmdbdConf = pkgs.writeText "slurmdbd.conf"
|
||||||
''
|
''
|
||||||
DbdHost=${cfg.dbdserver.dbdHost}
|
DbdHost=${cfg.dbdserver.dbdHost}
|
||||||
SlurmUser=${cfg.user}
|
SlurmUser=${cfg.user}
|
||||||
StorageType=accounting_storage/mysql
|
StorageType=accounting_storage/mysql
|
||||||
StorageUser=${cfg.dbdserver.storageUser}
|
StorageUser=${cfg.dbdserver.storageUser}
|
||||||
${optionalString (cfg.dbdserver.storagePass != null) "StoragePass=${cfg.dbdserver.storagePass}"}
|
|
||||||
${cfg.dbdserver.extraConfig}
|
${cfg.dbdserver.extraConfig}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@@ -95,26 +94,12 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
storagePass = mkOption {
|
storagePassFile = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = with types; nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Database password. Note that this password will be publicable
|
Path to file with database password. The content of this will be used to
|
||||||
readable in the nix store. Use <option>configFile</option>
|
create the password for the <literal>StoragePass</literal> option.
|
||||||
to store the and config file and password outside the nix store.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
configFile = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
Path to <literal>slurmdbd.conf</literal>. The password for the database connection
|
|
||||||
is stored in the config file. Use this option to specfify a path
|
|
||||||
outside the nix store. If this option is unset a configuration file
|
|
||||||
will be generated. See also:
|
|
||||||
<citerefentry><refentrytitle>slurmdbd.conf</refentrytitle>
|
|
||||||
<manvolnum>8</manvolnum></citerefentry>.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -122,7 +107,9 @@ in
|
|||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
description = ''
|
description = ''
|
||||||
Extra configuration for <literal>slurmdbd.conf</literal>
|
Extra configuration for <literal>slurmdbd.conf</literal> See also:
|
||||||
|
<citerefentry><refentrytitle>slurmdbd.conf</refentrytitle>
|
||||||
|
<manvolnum>8</manvolnum></citerefentry>.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -292,6 +279,16 @@ in
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
(mkRemovedOptionModule [ "services" "slurm" "dbdserver" "storagePass" ] ''
|
||||||
|
This option has been removed so that the database password is not exposed via the nix store.
|
||||||
|
Use services.slurm.dbdserver.storagePassFile to provide the database password.
|
||||||
|
'')
|
||||||
|
(mkRemovedOptionModule [ "services" "slurm" "dbdserver" "configFile" ] ''
|
||||||
|
This option has been removed. Use services.slurm.dbdserver.storagePassFile
|
||||||
|
and services.slurm.dbdserver.extraConfig instead.
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
@@ -386,23 +383,34 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.slurmdbd = mkIf (cfg.dbdserver.enable) {
|
systemd.services.slurmdbd = let
|
||||||
|
# slurm strips the last component off the path
|
||||||
|
configPath = "$RUNTIME_DIRECTORY/slurmdbd.conf";
|
||||||
|
in mkIf (cfg.dbdserver.enable) {
|
||||||
path = with pkgs; [ wrappedSlurm munge coreutils ];
|
path = with pkgs; [ wrappedSlurm munge coreutils ];
|
||||||
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network.target" "munged.service" "mysql.service" ];
|
after = [ "network.target" "munged.service" "mysql.service" ];
|
||||||
requires = [ "munged.service" "mysql.service" ];
|
requires = [ "munged.service" "mysql.service" ];
|
||||||
|
|
||||||
# slurm strips the last component off the path
|
preStart = ''
|
||||||
environment.SLURM_CONF =
|
cp ${slurmdbdConf} ${configPath}
|
||||||
if (cfg.dbdserver.configFile == null) then
|
chmod 600 ${configPath}
|
||||||
"${slurmdbdConf}/slurm.conf"
|
chown ${cfg.user} ${configPath}
|
||||||
else
|
${optionalString (cfg.dbdserver.storagePassFile != null) ''
|
||||||
cfg.dbdserver.configFile;
|
echo "StoragePass=$(cat ${cfg.dbdserver.storagePassFile})" \
|
||||||
|
>> ${configPath}
|
||||||
|
''}
|
||||||
|
'';
|
||||||
|
|
||||||
|
script = ''
|
||||||
|
export SLURM_CONF=${configPath}
|
||||||
|
exec ${cfg.package}/bin/slurmdbd -D
|
||||||
|
'';
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "forking";
|
RuntimeDirectory = "slurmdbd";
|
||||||
ExecStart = "${cfg.package}/bin/slurmdbd";
|
Type = "simple";
|
||||||
PIDFile = "/run/slurmdbd.pid";
|
PIDFile = "/run/slurmdbd.pid";
|
||||||
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -86,14 +86,16 @@ in {
|
|||||||
|
|
||||||
dbd =
|
dbd =
|
||||||
{ pkgs, ... } :
|
{ pkgs, ... } :
|
||||||
{
|
let
|
||||||
|
passFile = pkgs.writeText "dbdpassword" "password123";
|
||||||
|
in {
|
||||||
networking.firewall.enable = false;
|
networking.firewall.enable = false;
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"f /etc/munge/munge.key 0400 munge munge - mungeverryweakkeybuteasytointegratoinatest"
|
"f /etc/munge/munge.key 0400 munge munge - mungeverryweakkeybuteasytointegratoinatest"
|
||||||
];
|
];
|
||||||
services.slurm.dbdserver = {
|
services.slurm.dbdserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
storagePass = "password123";
|
storagePassFile = "${passFile}";
|
||||||
};
|
};
|
||||||
services.mysql = {
|
services.mysql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "slurm";
|
pname = "slurm";
|
||||||
version = "20.02.6.1";
|
version = "20.11.0.1";
|
||||||
|
|
||||||
# N.B. We use github release tags instead of https://www.schedmd.com/downloads.php
|
# N.B. We use github release tags instead of https://www.schedmd.com/downloads.php
|
||||||
# because the latter does not keep older releases.
|
# because the latter does not keep older releases.
|
||||||
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
|
|||||||
repo = "slurm";
|
repo = "slurm";
|
||||||
# The release tags use - instead of .
|
# The release tags use - instead of .
|
||||||
rev = "${pname}-${builtins.replaceStrings ["."] ["-"] version}";
|
rev = "${pname}-${builtins.replaceStrings ["."] ["-"] version}";
|
||||||
sha256 = "0vllyljsmv3y9hw4vfgnz9cnjqhlk55dy1bipssw872aldlxfcdk";
|
sha256 = "0f750wlvm48j5b2fkvhy47zyagxfl6kbn2m9lx0spxwyn9qgh6bn";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = [ "out" "dev" ];
|
outputs = [ "out" "dev" ];
|
||||||
|
|||||||
Reference in New Issue
Block a user