about summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-10-04 10:30:20 +0000
committerPjotr <wrk@bosa.lan>2026-10-04 10:30:20 +0000
commitf2d53ea6fb3a273f3169c4ff62d5b1cec2fa5d20 (patch)
tree1233027618cba1b84d3b8373ada1732c10751f80 /bin
parent0e8e605434b37251e6729121c77afa963cebef6a (diff)
downloadgn-guile-f2d53ea6fb3a273f3169c4ff62d5b1cec2fa5d20.tar.gz
Add the stripped branding webserver for aging.genenetwork.org
web/webserver-aging.scm serves only the brand pages (home/aging/...),
css, static images and doc rendering -- the REST API (web/webserver.scm)
stays untouched for the full deployment.  bin/gn-guile-webserver is the
matching entry-point script (a plain guile script with an @GUILE@
shebang that package builds substitute, wrapped with their load paths).

Both are used by the gn-guile system container
(gn-machines/genenetwork/containers/gn-guile-container.scm), which
strips everything but the webserver from the package at build time:
the container serves ONLY aging.genenetwork.org and every REST/API
route is disabled.

Also compute the copyright year at run time: (current-year) in
(web sxml) returns (date-year (current-date)) and the aging/msk
footers render "Copyright © 2005-<current-year>" instead of the
stale hard-coded 2025.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gn-guile-webserver39
1 files changed, 39 insertions, 0 deletions
diff --git a/bin/gn-guile-webserver b/bin/gn-guile-webserver
new file mode 100755
index 0000000..36a924d
--- /dev/null
+++ b/bin/gn-guile-webserver
@@ -0,0 +1,39 @@
+#!/@GUILE@ --no-auto-compile
+!#
+
+;;; gn-guile-webserver --- the stripped branding webserver for
+;;; aging.genenetwork.org.
+;;; Copyright © 2026 Pjotr Prins <pjotr.prins@thebird.nl>
+;;;
+;;; Runs the (web webserver-aging) module.  Used by the gn-guile
+;;; container (gn-machines/genenetwork/containers/
+;;; gn-guile-container.scm); the package build substitutes @GUILE@
+;;; with the store guile and wraps the script with its load paths.
+
+(use-modules (ice-9 match))
+
+(define (parse-port args)
+  (let loop ((args args))
+    (match args
+      (("--port" p . rest) p)
+      (((? string->number p) . rest) p)
+      ((_ . rest) (loop rest))
+      (() "8091"))))
+
+(define (main args)
+  ;; TLS: the views fetch their markdown from raw.githubusercontent.com;
+  ;; point guile/gnutls at the CA bundle (the package build wraps the
+  ;; script with SSL_CERT_FILE from the system profile, but be safe if
+  ;; run from a bare environment).
+  (unless (getenv "SSL_CERT_FILE")
+    (setenv "SSL_CERT_FILE"
+            "/run/current-system/profile/etc/ssl/certs/ca-certificates.crt"))
+  (unless (getenv "GUILE_TLS_CERTIFICATE_DIRECTORY")
+    (setenv "GUILE_TLS_CERTIFICATE_DIRECTORY"
+            "/run/current-system/profile/etc/ssl/certs"))
+  (let ((port (parse-port args)))
+    (let ((webserver (resolve-module '(web webserver-aging) #t)))
+      ((module-ref webserver 'start-web-server)
+       "0.0.0.0" (string->number port)))))
+
+(main (command-line))