feat: enable slurm jwt and remove slocket proxy
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
|||||||
*.pem
|
*.pem
|
||||||
*.csr
|
*.csr
|
||||||
|
*.key
|
||||||
result
|
result
|
||||||
result-*
|
result-*
|
||||||
gcroots/
|
gcroots/
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ let
|
|||||||
uid = cfg.mungeUid;
|
uid = cfg.mungeUid;
|
||||||
gid = 0;
|
gid = 0;
|
||||||
};
|
};
|
||||||
|
environment.etc."slurmctld/jwt_hs256.key" = {
|
||||||
|
source = cfg.jwtKey;
|
||||||
|
mode = "0400";
|
||||||
|
uid = cfg.slurmUid;
|
||||||
|
gid = 0;
|
||||||
|
};
|
||||||
|
|
||||||
services.slurm = {
|
services.slurm = {
|
||||||
controlMachine = cfg.controlMachine;
|
controlMachine = cfg.controlMachine;
|
||||||
@@ -24,8 +30,8 @@ let
|
|||||||
MailProg=/run/wrappers/bin/sendmail
|
MailProg=/run/wrappers/bin/sendmail
|
||||||
SelectType=select/cons_tres
|
SelectType=select/cons_tres
|
||||||
SelectTypeParameters=CR_Core
|
SelectTypeParameters=CR_Core
|
||||||
# AuthAltTypes=auth/jwt
|
AuthAltTypes=auth/jwt
|
||||||
# AuthAltParameters=jwt_key=/var/spool/slurm/statesave/jwt_hs256.key
|
AuthAltParameters=jwt_key=/etc/slurmctld/jwt_hs256.key
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -34,7 +40,6 @@ let
|
|||||||
nixpkgs.overlays = [ slurm-ucx ];
|
nixpkgs.overlays = [ slurm-ucx ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
slurmServer = {
|
slurmServer = {
|
||||||
services.mysql = {
|
services.mysql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -60,7 +65,7 @@ let
|
|||||||
# '';
|
# '';
|
||||||
dbdserver = {
|
dbdserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# dbdHost = cfg.controlMachine;
|
dbdHost = cfg.dbdHost;
|
||||||
# storagePass = cfg.storagePass;
|
# storagePass = cfg.storagePass;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -113,8 +118,14 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
slurmrestd = {
|
slurmrestd = {
|
||||||
systemd.tmpfiles.rules = [ "d /run/slurmrestd 0750 hipster hipster -" ];
|
services.dnsmasq.enable = true;
|
||||||
|
services.dnsmasq.settings = {
|
||||||
|
domain = [ "cluster.local" ];
|
||||||
|
address = [ "/slurmctld.cluster.local/127.0.0.1" ];
|
||||||
|
srv-host= "_slurmctld._tcp.cluster.local,slurmctld.cluster.local,6817,0,5";
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services.slurmrestd = {
|
systemd.services.slurmrestd = {
|
||||||
description = "Slurm REST API service";
|
description = "Slurm REST API service";
|
||||||
@@ -126,42 +137,26 @@ let
|
|||||||
Group = "hipster";
|
Group = "hipster";
|
||||||
};
|
};
|
||||||
environment = {
|
environment = {
|
||||||
# SLURM_JWT = "daemon";
|
SLURM_JWT = "daemon";
|
||||||
};
|
};
|
||||||
script = ''
|
script = ''
|
||||||
rm -f /run/slurmrestd/hipster.socket
|
/run/current-system/sw/bin/slurmrestd -v -a rest_auth/jwt :6822
|
||||||
/run/current-system/sw/bin/slurmrestd -v -a rest_auth/local unix:/run/slurmrestd/hipster.socket
|
|
||||||
'';
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
RuntimeDirectory = "slurmrestd";
|
RuntimeDirectory = "slurmrestd";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.sockets.slurm-http-proxy = {
|
|
||||||
enable = true;
|
|
||||||
description = "Proxy slurmrestd unix socket to port 6822";
|
|
||||||
listenStreams = [ "0.0.0.0:6822" ];
|
|
||||||
wantedBy = [ "sockets.target" ];
|
|
||||||
# If 'true', allow multiple instances of corresponding service (fails)
|
|
||||||
socketConfig.Accept = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services."slurm-http-proxy@" = {
|
|
||||||
enable = true;
|
|
||||||
description = "Proxy slurmrestd unix socket to port 6822";
|
|
||||||
serviceConfig = {
|
|
||||||
ExecStart = "-${pkgs.socat}/bin/socat STDIO UNIX-CONNECT:/run/slurmrestd/hipster.socket";
|
|
||||||
StandardInput="socket";
|
|
||||||
User = "hipster";
|
|
||||||
Group = "hipster";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.features.hpc.slurm = {
|
options.features.hpc.slurm = {
|
||||||
enable = mkEnableOption "Enable SLURM batch system";
|
enable = mkEnableOption "Enable SLURM batch system";
|
||||||
|
|
||||||
|
jwtKey = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
mungeKey = mkOption {
|
mungeKey = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
default = null;
|
default = null;
|
||||||
@@ -172,6 +167,11 @@ in
|
|||||||
default = 997;
|
default = 997;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
slurmUid = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 307;
|
||||||
|
};
|
||||||
|
|
||||||
pkey = mkOption {
|
pkey = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "0x7fff";
|
default = "0x7fff";
|
||||||
@@ -181,6 +181,12 @@ in
|
|||||||
type = types.str;
|
type = types.str;
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dbdHost = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
server = mkOption {
|
server = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user