about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-10-21 14:18:27 -0500
committerArun Isaac2024-10-24 18:31:28 +0100
commit3f24e49b577e23a34c047740f1c2cd224fdf18e8 (patch)
tree2ef0782f069731acd4fb49f386bad11dae4721b3
parent243ad178cbaae9524a0c29672c285999db4e2c8b (diff)
downloadgn-machines-3f24e49b577e23a34c047740f1c2cd224fdf18e8.tar.gz
Add GN3 alias server to genenetwork service.
*
genenetwork/services/genenetwork.scm (<genenetwork-configuration>)[gn3-alias-server-port]:
New field.
(genenetwork-nginx-server-blocks): Rewrite URLs for the GN3 alias
server.

Signed-off-by: Arun Isaac <arunisaac@systemreboot.net>
-rw-r--r--genenetwork/services/genenetwork.scm15
1 files changed, 13 insertions, 2 deletions
diff --git a/genenetwork/services/genenetwork.scm b/genenetwork/services/genenetwork.scm
index 022eeda..c5f460c 100644
--- a/genenetwork/services/genenetwork.scm
+++ b/genenetwork/services/genenetwork.scm
@@ -85,6 +85,8 @@
             (default 8083))
   (gn-auth-port genenetwork-configuration-gn-auth-port
                 (default 8084))
+  (gn3-alias-server-port genenetwork-gn3-alias-server-port
+                         (default 8000))
   (sql-uri genenetwork-configuration-sql-uri
            (default "mysql://username:password@localhost/database"))
   (auth-db genenetwork-configuration-auth-db
@@ -467,7 +469,7 @@ object."
 reverse proxies for the genenetwork service described by @var{config},
 a @code{<genenetwork-configuration>} record."
   (match-record config <genenetwork-configuration>
-    (server-name gn-auth-server-name gn2-port gn3-port gn-auth-port)
+    (server-name gn-auth-server-name gn2-port gn3-port gn-auth-port gn3-alias-server-port)
     (list (nginx-server-configuration
            (server-name (list server-name))
            (locations
@@ -483,7 +485,16 @@ a @code{<genenetwork-configuration>} record."
                    (body (list "rewrite /api3/(.*) /api/$1 break;"
                                (string-append "proxy_pass http://localhost:"
                                               (number->string gn3-port) ";")
-                               "proxy_set_header Host $host;"))))))
+                               "proxy_set_header Host $host;")))
+                  (nginx-location-configuration
+                   (uri "/gn3/")
+                   (body
+                    (list "rewrite /gn3/(.*) /$1 break;"
+                          (string-append "proxy_pass http://localhost:"
+                                         (number->string gn3-alias-server-port)
+                                         ";")
+                          "proxy_redirect off;"
+                          "proxy_set_header Host $host;"))))))
           (nginx-server-configuration
            (server-name (list gn-auth-server-name))
            (locations