about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.guix-channel2
-rwxr-xr-xgenenetwork-development-deploy.sh2
-rw-r--r--genenetwork-development.scm36
-rw-r--r--genenetwork/services/genenetwork.scm8
-rw-r--r--guix/gn-machines/genenetwork.scm27
-rw-r--r--guix/gn-machines/services/monitoring.scm68
-rwxr-xr-xproduction-deploy.sh4
-rw-r--r--services/README.md17
-rw-r--r--services/gn-guile.scm52
-rw-r--r--services/opensmtpd.scm21
10 files changed, 126 insertions, 111 deletions
diff --git a/.guix-channel b/.guix-channel
index f43f5ea..b8f3873 100644
--- a/.guix-channel
+++ b/.guix-channel
@@ -27,7 +27,7 @@
   (channel
    (name guix-bioinformatics)
    (url "https://git.genenetwork.org/guix-bioinformatics")
-   (commit "903465c85c9b2ae28480b236c3364da873ca8f51"))
+   (commit "9b0955f14ec725990abb1f6af3b9f171e4943f77"))
   ;; Until https://issues.guix.gnu.org/68797 is resolved, we need to
   ;; explicitly list guix-past and guix-rust-past-crates—the
   ;; dependencies of the guix-bioinformatics channel—here.
diff --git a/genenetwork-development-deploy.sh b/genenetwork-development-deploy.sh
index d63dcf0..53c53d9 100755
--- a/genenetwork-development-deploy.sh
+++ b/genenetwork-development-deploy.sh
@@ -29,7 +29,7 @@
 # /etc/genenetwork/conf instead of merely exposing it.
 container_script=$(guix system container --network \
                         --verbosity=3 \
-                        --load-path=. \
+                        --load-path=./guix/ \
                         --share=/home/git/public \
                         --share=/var/guix/daemon-socket=/var/host-guix/daemon-socket \
                         --share=/export2/guix-containers/genenetwork-development/var/lib/acme=/var/lib/acme \
diff --git a/genenetwork-development.scm b/genenetwork-development.scm
index 8e4e1e8..bfd2fc1 100644
--- a/genenetwork-development.scm
+++ b/genenetwork-development.scm
@@ -21,6 +21,7 @@
 ;;; <https://www.gnu.org/licenses/>.
 
 (use-modules (gnu)
+	     (gn-machines services monitoring)
              ((gn-machines genenetwork) #:select (genenetwork2 genenetwork3 gn-auth))
              (gn services databases)
              ((gn packages guile) #:select (gn-guile))
@@ -529,8 +530,11 @@ server described by CONFIG, a <genenetwork-configuration> object."
                                           (getenv "GN2_PROFILE")
                                           "/etc/ssl/certs/ca-certificates.crt"))
 	    (setenv "PYTHONPATH" (string-append
-				  (getenv "GN2_PROFILE")
-				  "/lib/python3.11/site-packages"))
+				  (getenv "GN3_PYTHONPATH")
+				  ":"
+				  (string-append
+				   (getenv "GN2_PROFILE")
+				   "/lib/python3.11/site-packages")))
 	    (setenv "PATH" (string-append (getenv "GN2_PROFILE") "/bin:$PATH"))
 	    (setenv "R_LIBS_SITE" (string-append (getenv "GN2_PROFILE") "/site-library"))
 	    (setenv "JS_GUIX_PATH" (string-append (getenv "GN2_PROFILE") "/share/genenetwork2/javascript"))
@@ -732,6 +736,7 @@ server described by CONFIG, a <genenetwork-configuration> object."
          (setenv "GIT_SSL_CAINFO" (getenv "SSL_CERT_FILE"))
          (setenv "CURL_CA_BUNDLE" (getenv "SSL_CERT_FILE"))
          (setenv "REQUESTS_CA_BUNDLE" (getenv "SSL_CERT_FILE"))
+	 (setenv "SPARQL-ENDPOINT" "http://localhost:9082/sparql/")
 	 (setenv "GIT_PAGER" #$(file-append coreutils-minimal "/bin/cat"))
          (let ((current-repo-path "/home/genenetwork/gn-docs"))
 	   (setenv "CURRENT_REPO_PATH" current-repo-path)
@@ -1131,12 +1136,6 @@ described by CONFIG, a <genenetwork-configuration> object."
              (copy-recursively build-directory #$virtuoso-data-dir)
              ;; Load RDF into virtuoso.
              (invoke "./pre-inst-env" "./load-rdf.scm" #$connection-settings)
-             ;; Visualize schema and archive results.
-             (invoke "./pre-inst-env" "./visualize-schema.scm" #$connection-settings)
-             (invoke #$(file-append graphviz "/bin/dot")
-                     "-Tsvg" "sql.dot" (string-append "-o" (getenv "ARCHIVE") "/sql.svg"))
-             (invoke #$(file-append graphviz "/bin/dot")
-                     "-Tsvg" "rdf.dot" (string-append "-o" (getenv "ARCHIVE") "/rdf.svg"))
              (delete-file-recursively build-directory)))))))
 
 (define transform-genenetwork-database-project
@@ -1429,6 +1428,19 @@ gn-auth."
                                       ";")
                        "proxy_set_header Host $host;")))))))
 
+(define (gn-guile-reverse-proxy-server-block)
+  "Return an <nginx-server-configuration> object to reverse proxy
+gn-guile to display RDF pages."
+  (nginx-server-configuration
+   (server-name '("rdf.genenetwork.org"))
+   (locations
+    (list (nginx-location-configuration
+           (uri "/")
+           (body (list (string-append "proxy_pass http://localhost:"
+                                      (number->string %gn-guile-port)
+                                      ";")
+                       "proxy_set_header Host $host;")))))))
+
 (define set-build-directory-permissions-gexp
   (with-imported-modules '((guix build utils))
     #~(begin
@@ -1453,6 +1465,8 @@ gn-auth."
 (define %gn-auth-port 9094)
 ;; Port on which virtuoso's SPARQL endpoint is listening
 (define %virtuoso-sparql-port 9082)
+;; Port on which gn-guile is listening
+(define %gn-guile-port 8091)
 
 (operating-system
   (host-name "genenetwork-development")
@@ -1577,7 +1591,11 @@ gn-auth."
                                      (list 'gn-bioinformatics
                                            'guix-bioinformatics))
                                     (tissue-reverse-proxy-server-block)
-                                    (gn-auth-reverse-proxy-server-block)))))
+                                    (gn-auth-reverse-proxy-server-block)
+				    (gn-guile-reverse-proxy-server-block)))))
+		   (service guile-sheepdog-service-type
+			    (guile-sheepdog-configuration
+			     (settings-file "/etc/genenetwork/conf/sheepdog.scm")))
                    (service acme-service-type
                             (acme-configuration
                              (email "arunisaac@systemreboot.net")))
diff --git a/genenetwork/services/genenetwork.scm b/genenetwork/services/genenetwork.scm
index 5c6b9f0..f66dcd9 100644
--- a/genenetwork/services/genenetwork.scm
+++ b/genenetwork/services/genenetwork.scm
@@ -450,7 +450,7 @@ object."
              (sockets (list (forge-ip-socket
                              (port gn2-port))))
              (wsgi-app-module "gn2.wsgi")
-             (workers 20)
+             (workers 10)
              (timeout 1200)
              (environment-variables
               (list (environment-variable
@@ -509,7 +509,7 @@ object."
              (sockets (list (forge-ip-socket
                              (port gn3-port))))
              (wsgi-app-module "gn3.app:create_app()")
-             (workers 20)
+             (workers 10)
              ;; gunicorn's default 30 second timeout is insufficient
              ;; for Fahamu AI endpoints and results in worker timeout
              ;; errors.
@@ -572,7 +572,7 @@ object."
              (sockets (list (forge-ip-socket
                              (port gn-auth-port))))
              (wsgi-app-module "gn_auth:create_app()")
-             (workers 20)
+             (workers 10)
              (timeout 1200)
              (environment-variables
               (list (environment-variable
@@ -800,7 +800,7 @@ a @code{<genenetwork-configuration>} record."
              (sockets (list (forge-ip-socket
                              (port port))))
              (wsgi-app-module "scripts.qcapp_wsgi:app")
-             (workers 20)
+             (workers 10)
              (timeout 1200)
              (environment-variables
               (list (environment-variable
diff --git a/guix/gn-machines/genenetwork.scm b/guix/gn-machines/genenetwork.scm
index 74be3c1..657322e 100644
--- a/guix/gn-machines/genenetwork.scm
+++ b/guix/gn-machines/genenetwork.scm
@@ -3,7 +3,7 @@
                 #:select (genenetwork2 genenetwork3 gn-auth gn-uploader gn-libs)
                 #:prefix gn:)
   #:use-module((gn packages guile)
-               #:select (gn-guile)
+               #:select (gn-guile guile-sheepdog)
                #:prefix gng:)
   #:use-module (guix git-download)
   #:use-module (guix packages))
@@ -73,7 +73,7 @@
          (replace "gn-libs" gn-libs))))))
 
 (define-public gn-uploader
-  (let ((commit "e4db73ebd5daf7cf4e228fb0f2b70e02db046e31")
+  (let ((commit "096fe9dfe3a582658c6bf9179b6c2662cc78711b")
         (revision "0"))
     (package
       (inherit gn:gn-uploader)
@@ -88,13 +88,13 @@
                 (hash
                  (content-hash
                   (base32
-                   "1x0h4czkkd0lv63yg95yrz65h9s1rbrfccx1sr988zp17v82s4hj")))))
+                   "02ds5vv8x2367r95zv0ddh42cqdlwh2jjbqipfd6ppn1dms3p9yj")))))
       (propagated-inputs
        (modify-inputs (package-propagated-inputs gn:gn-uploader)
          (replace "gn-libs" gn-libs))))))
 
 (define-public gn-libs
-  (let ((commit "9bc82972ad971dac4eb604923b9a6df51d4411ff")
+  (let ((commit "5f977e69b46e0ee99845fb69d504f299dc7429a1")
         (revision "03"))
     (package
       (inherit gn:gn-libs)
@@ -108,7 +108,7 @@
                 (file-name (string-append name "-" version))
                 (sha256
                  (base32
-                  "00xfz6wqqkik7ck5yszd6nhh9s0g870lssyclaz9j6kvw2p12a0n")))))))
+                  "0hvixdpmqhhby4xv2sq7wnw15gbbp3vicxxa04rmgq1fd4mj0j49")))))))
 
 (define-public gn-guile
   (let ((commit "454244b774ece37f04f146c74353ea4ec35d43e1")
@@ -126,3 +126,20 @@
 		(sha256
 		 (base32
                   "1n1zjpwfksq8bf42d7xr7lnblgsbqc0yszkbid253s943fyxzhfn")))))))
+
+(define-public guile-sheepdog
+  (let ((commit "1426617d58f305a4126bb867202843e8cf7dd4b2")
+	(revision "0"))
+    (package
+     (inherit gng:guile-sheepdog)
+     (name "guile-sheepdog")
+     (version (git-version "4.0.0" revision commit))
+     (source (origin
+	      (method git-fetch)
+	      (uri (git-reference
+		    (url "https://github.com/BonfaceKilz/guile-sheepdog.git")
+		    (commit commit)))
+	      (file-name (string-append name "-" version))
+	      (sha256
+	       (base32
+                "1z0xzg11p75s2hk312akxlg2h5278w2abma27dhzjf981g3lcqvr")))))))
diff --git a/guix/gn-machines/services/monitoring.scm b/guix/gn-machines/services/monitoring.scm
new file mode 100644
index 0000000..7fa59c9
--- /dev/null
+++ b/guix/gn-machines/services/monitoring.scm
@@ -0,0 +1,68 @@
+;;; genenetwork-machines --- Guix configuration for genenetwork machines
+;;; Copyright © 2025 Munyoki Kilyungi <me@bonfacemunyoki.com>
+;;;
+;;; This file is part of genenetwork-machines.
+;;;
+;;; genenetwork-machines 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.
+;;;
+;;; genenetwork-machines 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 genenetwork-machines.  If not, see
+;;; <https://www.gnu.org/licenses/>.
+
+(define-module (gn-machines services monitoring)
+  #:use-module (gnu)
+  #:use-module (gnu services shepherd)
+  #:use-module (gnu services databases)
+  #:use-module ((gn-machines genenetwork) #:select (guile-sheepdog))
+  #:use-module (guix gexp)
+  #:use-module (guix records)
+  #:use-module (ice-9 match)
+  #:export (guile-sheepdog-configuration
+	    guile-sheepdog-configuration?
+	    guile-sheepdog-configuration-settings-file
+	    guile-sheepdog-configuration-package
+	    guile-sheepdog-service-type))
+
+(define-record-type* <guile-sheepdog-configuration>
+  guile-sheepdog-configuration
+  make-guile-sheepdog-configuration
+  guile-sheepdog-configuration?
+  (settings-file guile-sheepdog-configuration-settings-file
+		 (default "/etc/conn.scm"))
+  (package guile-sheepdog-configuration-package (default guile-sheepdog)))
+
+(define (guile-sheepdog-gexp config)
+  (match-record config <guile-sheepdog-configuration> (settings-file package)
+    (program-file
+     "guile-sheepdog"
+     (with-imported-modules '((guix build utils))
+       #~(begin
+	   (use-modules (guix build utils))
+	   (invoke #$(file-append package "/bin/guile-sheepdog") #$settings-file))))))
+
+(define (guile-sheepdog-shepherd-service config)
+  (shepherd-service
+      (documentation "Run Sheepdog")
+      (provision '(guile-sheepdog))
+      (requirement '(networking redis))
+      (start #~(make-forkexec-constructor
+		(list #$(guile-sheepdog-gexp config))
+		#:log-file "/var/log/sheepdog.log"))
+      (stop #~(make-kill-destructor))))
+
+(define guile-sheepdog-service-type
+  (service-type
+   (name 'guile-sheepdog)
+   (description "Run sheepdog monitor")
+   (extensions
+    (list (service-extension shepherd-root-service-type
+                             (compose list guile-sheepdog-shepherd-service))))
+   (default-value (guile-sheepdog-configuration))))
diff --git a/production-deploy.sh b/production-deploy.sh
index c8e30fe..8fb3d36 100755
--- a/production-deploy.sh
+++ b/production-deploy.sh
@@ -3,6 +3,7 @@
 # genenetwork-machines --- Guix configuration for genenetwork machines
 # Copyright © 2022, 2024 Arun Isaac <arunisaac@systemreboot.net>
 # Copyright © 2024 Frederick Muriuki Muriithi <fredmanglis@protonmail.com>
+# Copyright © 2026 Munyoki Kilyungi <me@bonfacemunyoki.com>
 #
 # This file is part of genenetwork-machines.
 #
@@ -24,7 +25,8 @@
 
 container_script=$(guix system container \
                         --network \
-                        --load-path=. \
+                        --load-path=./guix/ \
+			--load-path=./ \
                         --verbosity=3 \
                         --share=/export/guix-containers/genenetwork/var/genenetwork=/var/genenetwork \
                         --share=/export/guix-containers/genenetwork/var/lib/acme=/var/lib/acme \
diff --git a/services/README.md b/services/README.md
deleted file mode 100644
index d0d1c01..0000000
--- a/services/README.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# Services
-
-This directory contains small and simple services that may be run independently.
-Note that composition is not the goal.
-For example, databases and web proxies are handled outsite the containers.
-Use these services for simple deployment and ad hoc testing.
-One nice aspect of small system containers is that you can run these easily on your laptop.
-
-IMPORTANT: more complex services do not belong in this directory.
-
-# Examples
-
-## gn-guile
-
-`gn-guile` is our next generation service (gn4?). It provides a REST API, at this point, and some portals, such as https://aging.genenetwork.org/.
-
-See the [gn-guile](./gn-guile.scm) system definition example.
diff --git a/services/gn-guile.scm b/services/gn-guile.scm
deleted file mode 100644
index 2f675a8..0000000
--- a/services/gn-guile.scm
+++ /dev/null
@@ -1,52 +0,0 @@
-;; This is an example definition for the gn-guile/GN4 service
-;;
-;; Run with
-;;
-;;   export runner=$(guix system container gn-guile.scm)
-;;
-;; as root
-;;
-;;   sudo bash -c $runner
-;;   echo $runner
-;;
-;; make a note of pid and
-;;
-;;   sudo bash -c "nsenter -a -t 4050285"
-;;
-;; now you should be inside the container (note bash should be in the container!)
-
-(use-modules (gnu)
-             (guix records)
-             (forge utils))
-
-(define-record-type* <gn-guile-configuration>
-  gn-guile-configuration make-gn-guile-configuration
-  gn-guile-configuration?
-  (gn2-repository gn-guile-configuration-gn2-repository
-                  (default "https://github.com/genenetwork/genenetwork2"))
-  (gn2-port gn-guile-configuration-gn2-port
-            (default 8082)))
-
-
-(define gn-guile-service-type
-  (service-type
-   (name 'gn-guile)
-   (description "gn-guile/GN4 webservice")
-   (extensions '())
-   ))
-
-(operating-system
- (host-name "gn-guile")
- (timezone "UTC")
- (locale "en_US.utf8")
- (bootloader (bootloader-configuration
-              (bootloader grub-bootloader)
-              (targets (list "/dev/sdX"))))
- (file-systems %base-file-systems)
- (users %base-user-accounts)
- (packages %base-packages)
-
- (services (cons
-            (service gn-guile-service-type
-                     (gn-guile-configuration))
-            %base-services)))
diff --git a/services/opensmtpd.scm b/services/opensmtpd.scm
deleted file mode 100644
index 1b1e58f..0000000
--- a/services/opensmtpd.scm
+++ /dev/null
@@ -1,21 +0,0 @@
-(use-modules (gnu)
-             (gnu services mail))
-
-(operating-system
-  (host-name "mail")
-  (timezone "UTC")
-  (locale "en_US.utf8")
-  (bootloader (bootloader-configuration
-               (bootloader grub-bootloader)
-               (targets (list "/dev/sdX"))))
-  (file-systems %base-file-systems)
-  (users %base-user-accounts)
-  (packages %base-packages)
-
-  (services (cons
-             (service opensmtpd-service-type
-                      (opensmtpd-configuration
-                       (config-file %default-opensmtpd-config-file
-                       ; (config-file (local-file "./my-smtpd.conf")))
-                                    )))
-             %base-services)))