From 93ff9ed6fd9f2ca15cf6a8930eae26c9f5c65450 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sun, 24 Sep 2023 14:49:53 -0500 Subject: Simple gn-guile system container builds --- genenetwork-development.scm | 33 +++++++++++++++++++++++++++- services/README.md | 17 +++++++++++++++ services/gn-guile.scm | 52 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 services/README.md create mode 100644 services/gn-guile.scm diff --git a/genenetwork-development.scm b/genenetwork-development.scm index e18b317..7f727ca 100644 --- a/genenetwork-development.scm +++ b/genenetwork-development.scm @@ -698,10 +698,41 @@ described by CONFIG, a object." genenetwork-projects))) (default-value (genenetwork-configuration)))) + +;;; +;;; qc +;;; + +(define qc-tests + (with-imported-modules (cons '(guix build lisp-utils) + (source-module-closure '((genenetwork development-helper)) + #:select? import-module?)) + #~(lambda (source) + ((@@ (genenetwork development-helper) + asdf-test-gexp) + source + #$(profile + (content (package->development-manifest sbcl-qc)) + (allow-collisions? #t)) + "qc" (list "qc.asd"))))) + +(define qc-project + (forge-project + (name "qc") + (repository "https://git.genenetwork.org/jgart/qc") + (ci-jobs (list (forge-laminar-job + (name "qc") + (run (derivation-job-gexp + this-forge-project + this-forge-laminar-job + qc-tests + #:guix-daemon-uri %guix-daemon-uri))))) + (ci-jobs-trigger 'webhook))) + ;;; ;;; transform-genenetwork-database -;;; +;;; ;; Path to genenetwork database dump export directory that has lots of ;; free space diff --git a/services/README.md b/services/README.md new file mode 100644 index 0000000..d0d1c01 --- /dev/null +++ b/services/README.md @@ -0,0 +1,17 @@ +# 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 new file mode 100644 index 0000000..2f675a8 --- /dev/null +++ b/services/gn-guile.scm @@ -0,0 +1,52 @@ +;; 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 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))) -- cgit v1.2.3