diff options
-rwxr-xr-x | slurm-deploy.sh | 19 | ||||
-rw-r--r-- | slurm.scm | 117 |
2 files changed, 136 insertions, 0 deletions
diff --git a/slurm-deploy.sh b/slurm-deploy.sh new file mode 100755 index 0000000..8118d56 --- /dev/null +++ b/slurm-deploy.sh @@ -0,0 +1,19 @@ +#! /bin/sh -xe + +## +## Test slurm deployment on tux04 +## + +slurm=$(guix build -f slurm.scm) +echo $slurm + +# Symlink slurm daemon executables and systemd service files. +for executable in slurmctld slurmdbd slurmd slurmrestd; +do + sudo ln --no-target-directory --force --symbolic $slurm/sbin/$executable /usr/local/sbin/$executable + sudo ln --no-target-directory --force --symbolic $slurm/etc/$executable.service /etc/systemd/system/$executable.service +done + +# It is enough to register one gcroot as that marks the whole store +# item as live. +sudo ln --force --symbolic /usr/local/sbin/slurmd /var/guix/gcroots diff --git a/slurm.scm b/slurm.scm new file mode 100644 index 0000000..a46e161 --- /dev/null +++ b/slurm.scm @@ -0,0 +1,117 @@ +;; +;; Test slurm deployment on tux04 +;; + +(use-modules ((gnu packages check) #:select (check)) + ((gnu packages databases) #:select (mariadb)) + ((gnu packages glib) #:select (dbus)) + ((gnu packages linux) #:select (linux-libre-headers)) + ((gnu packages networking) #:select (librdkafka)) + ((gnu packages parallel) #:select (slurm) #:prefix guix:) + ((gnu packages pkg-config) #:select (pkg-config)) + ((gnu packages serialization) #:select (libyaml)) + ((gnu packages tls) #:select (openssl)) + ((gnu packages web) #:select (jansson json-c)) + (guix download) + (guix build-system gnu) + (guix gexp) + (guix git-download) + ((guix licenses) #:prefix license:) + (guix packages) + (guix utils)) + +(define-public http-parser + (package + (name "http-parser") + (version "2.9.4") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/nodejs/http-parser") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1vda4dp75pjf5fcph73sy0ifm3xrssrmf927qd1x8g3q46z0cv6c")))) + (build-system gnu-build-system) + (arguments + (list #:make-flags #~(list (string-append "PREFIX=" #$output) + (string-append "CC=" #$(cc-for-target)) + "library") + #:test-target "test" + #:phases + #~(modify-phases %standard-phases + (delete 'configure)))) + (home-page "https://github.com/nodejs/http-parser") + (synopsis "C HTTP request/response parser") + (description "@code{http-parser} is a parser for HTTP messages +written in C. It parses both requests and responses. The parser is +designed to be used in performance HTTP applications. It does not +make any syscalls nor allocations, it does not buffer data, it can be +interrupted at anytime. Depending on your architecture, it only +requires about 40 bytes of data per message stream (in a web server +that is per connection).") + (license license:expat))) + +(define-public libjwt + (package + (name "libjwt") + (version "1.17.1") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/benmcollins/libjwt/releases/download/v" + version "/libjwt-" + version ".tar.bz2")) + (sha256 + (base32 + "0wkdl2qnic2by0j8bj1n90m2hrzlxjm913gf19syxq655z6zzf0x")))) + (build-system gnu-build-system) + (inputs + (list jansson openssl)) + (native-inputs + (list check pkg-config)) + (home-page "https://github.com/benmcollins/libjwt") + (synopsis "C JWT library") + (description "@code{libjwt} is a JWT library for C.") + (license license:mpl2.0))) + +(define slurm + (package + (inherit guix:slurm) + (arguments + (substitute-keyword-arguments (package-arguments guix:slurm) + ((#:configure-flags flags #~'()) + #~(cons* "--enable-slurmrestd" + (string-append "--with-http-parser=" + #$(this-package-input "http-parser")) + (string-append "--with-rdkafka=" + #$(this-package-input "librdkafka")) + (string-append "--with-bpf=" + #$(this-package-input "linux-libre-headers")) + "--sysconfdir=/etc" + #$flags)) + ((#:phases phases #~%standard-phases) + #~(modify-phases #$phases + (add-after 'install 'install-systemd-service-files + (lambda _ + (for-each (lambda (file) + (install-file file + (string-append #$output "/etc"))) + (list "etc/slurmrestd.service" + "etc/slurmdbd.service" + "etc/slurmd.service" + "etc/slurmctld.service")) + (substitute* (string-append #$output "/etc/slurmrestd.service") + ;; Set user and group to run slurmrestd as. + (("# User=") "User=slurmrestd") + (("# Group=") "Group=slurmrestd") + ;; Disable listening on Unix socket by default. + ((" unix:[^ ]*") "")))))))) + (inputs + (modify-inputs (package-inputs guix:slurm) + (prepend dbus http-parser json-c libjwt + librdkafka libyaml linux-libre-headers + (list mariadb "dev")))))) + +slurm |