From 77efaac7a25684f78bf45a02fab7dda9fc1df17a Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Tue, 7 May 2024 19:27:44 +0300 Subject: Add guix configuration for the LLM instance. * qa-gn-deploy.sh: New file. * qa-gn.scm: New file. Co-authored-by: Alexander_Kabui Co-authored-by: John Nduli --- qa-gn-deploy.sh | 63 ++++++++++++++++++++++++++++++ qa-gn.scm | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100755 qa-gn-deploy.sh create mode 100644 qa-gn.scm diff --git a/qa-gn-deploy.sh b/qa-gn-deploy.sh new file mode 100755 index 0000000..42904b7 --- /dev/null +++ b/qa-gn-deploy.sh @@ -0,0 +1,63 @@ +#! /bin/bash -e + +# qa-deploy.sh --- Guix configuration for genenetwork machines LLM +# instance + +# Copyright © 2024 Munyoki Kilyungi +# Copyright © 2024 Alexander Kabui +# Copyright © 2024 John Nduli +# +# This file is part of genenetwork-machines. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Build and install qa container on tux02. + +SCRIPTARGS=("$@") + +MODULEARGS=() +if [ "${#SCRIPTARGS[@]}" -gt 0 ] +then + echo "===== Auxilliary module load paths =====" + for path in "${SCRIPTARGS[@]}" + do + echo "-L ${path}" + MODULEARGS+=("-L" "${path}") + done + echo "===== END: Auxilliary module load paths =====" +fi + +container_script=$(guix system container \ + "${MODULEARGS[@]}" \ + --network \ + --load-path=. \ + --verbosity=3 \ + --share=/export2/guix-containers/genenetwork/gn-qa/var/genenetwork=/var/genenetwork \ + --share=/export2/guix-containers/genenetwork/gn-qa/var/lib/acme=/var/lib/acme \ + --share=/export2/guix-containers/genenetwork/gn-qa/var/lib/mysql=/var/lib/mysql \ + --share=/export2/guix-containers/genenetwork/gn-qa/var/lib/virtuoso=/var/lib/virtuoso \ + --share=/export2/guix-containers/genenetwork/gn-qa/var/log=/var/log \ + --share=/export2/guix-containers/genenetwork/gn-qa/var/ssl=/var/ssl \ + --share=/export2/guix-containers/genenetwork/gn-qa/etc/genenetwork=/etc/genenetwork \ + --expose=/export/data/genenetwork-xapian/=/export/data/genenetwork-xapian \ + --share=/export/data/gn-qa/genenetwork-sqlite=/export/data/genenetwork-sqlite \ + --expose=/export/data/genenetwork/genotype_files=/export/data/genenetwork/genotype_files \ + --share=/export/data/gn-qa/genenetwork3=/export/data/genenetwork3 \ + --share=/export/data/gn-qa/gn-uploader \ + --share=/var/run/mysqld3307=/run/mysqld \ + qa-gn.scm) + +echo "${container_script}" +sudo ln --force --symbolic "${container_script}" /usr/local/bin/gn-qa-container +sudo ln --force --symbolic /usr/local/bin/gn-qa-container /var/guix/gcroots diff --git a/qa-gn.scm b/qa-gn.scm new file mode 100644 index 0000000..5c2b281 --- /dev/null +++ b/qa-gn.scm @@ -0,0 +1,119 @@ +;;; qa-gn.scm --- +;;; Copyright © 2024 Munyoki Kilyungi +;;; Copyright © 2024 Alexander Kabui +;;; Copyright © 2024 John Nduli +;;; +;;; This file is part of genenetwork-machines. +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License +;;; as published by the Free Software Foundation; either version 3 +;;; of the License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . + +(use-modules (gnu) + ((gnu packages admin) #:select (shepherd)) + ((gnu packages certs) #:select (nss-certs)) + (gnu services databases) + (gnu build linux-container) + (genenetwork services genenetwork) + (gn services databases) + (guix packages) + (guix download) + (guix git) + (guix git-download) + (guix build-system python) + ((gn packages genenetwork) #:select (genenetwork2 genenetwork3 gn-auth)) + (forge acme) + (forge nginx) + (forge socket)) + + + +(operating-system + (host-name "qa-gn") + (timezone "UTC") + (locale "en_US.utf8") + (bootloader (bootloader-configuration + (bootloader grub-bootloader) + (targets (list "/dev/sdX")))) + (file-systems %base-file-systems) + (sudoers-file + (mixed-text-file "sudoers" + "@include " %sudoers-specification + "\nacme ALL = NOPASSWD: " + (file-append shepherd "/bin/herd") + " restart nginx\n")) + (packages (cons (specification->package "nss-certs") %base-packages)) + (services + (cons* + (service genenetwork-service-type + (genenetwork-configuration + ;; Use the latest stable version of GN2/3 with the most + ;; recent LLM code. + (genenetwork2 (package + (inherit genenetwork2) + (name "genenetwork2") + (version "0") + (source + (git-checkout + (branch "feature/gnqa-system") + (url "https://github.com/genenetwork/genenetwork2.git"))))) + (genenetwork3 (package + (inherit genenetwork3) + (name "genenetwork3") + (version "0") + (source + (git-checkout + (branch "feature/gnqa-api") + (url "https://github.com/genenetwork/genenetwork3.git"))))) + (gn-auth (package + (inherit gn-auth) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://git.genenetwork.org/gn-auth") + (commit "de4a7f6bfa870a0e5fc4b1f381cb452ab1250210"))) + (hash + (content-hash + (base32 + "0dxanpgwgjil3g0qlkar7gg8znm9dpizcwkgbyvj0h44qnv1346k"))))) + (propagated-inputs + (modify-inputs (package-propagated-inputs genenetwork3) + (append nss-certs))) + (arguments + `(#:tests? #f)))) + (server-name "qa.genenetwork.org") + (gn-auth-server-name "qa-auth.genenetwork.org") + ;; XXX: We probably need to use the production server + ;; for this + (gn2-port 10904) + (gn3-port 10905) + (gn-auth-port 10906) + (sql-uri "mysql://webqtlout:webqtlout@127.0.0.1:3307/db_webqtl") + (auth-db "/export/data/genenetwork-sqlite/auth-qa.db") + (xapian-db "/export/data/genenetwork-xapian") + (genotype-files "/export/data/genenetwork/genotype_files") + (sparql-endpoint "http://localhost:9082/sparql") + (gn3-data-directory "/export/data/genenetwork3") + (llm-db "/export/data/genenetwork-sqlite/llm-qa.db"))) + (service forge-nginx-service-type + (forge-nginx-configuration + (http-listen (forge-ip-socket + (ip "0.0.0.0") + (port 10907))) + (https-listen (forge-ip-socket + (ip "0.0.0.0") + (port 10908))))) + (service acme-service-type + (acme-configuration + (email "arunisaac@systemreboot.net"))) + %base-services))) -- cgit v1.2.3