about summary refs log tree commit diff
path: root/genenetwork-development.scm
diff options
context:
space:
mode:
Diffstat (limited to 'genenetwork-development.scm')
-rw-r--r--genenetwork-development.scm107
1 files changed, 62 insertions, 45 deletions
diff --git a/genenetwork-development.scm b/genenetwork-development.scm
index 87d8c20..4d290b1 100644
--- a/genenetwork-development.scm
+++ b/genenetwork-development.scm
@@ -481,7 +481,7 @@ genenetwork3 source from the latest commit of @var{project}."
   "Return a G-expression that runs the latest genenetwork2 development
 server described by CONFIG, a <genenetwork-configuration> object."
   (match-record config <genenetwork-configuration>
-    (gn2-repository gn3-repository gn2-port gn3-port gn2-secrets genotype-files gn-guile-port)
+    (gn2-repository gn3-repository gn2-port gn3-port gn2-secrets genotype-files gn-guile-port repositories)
     (with-packages (list coreutils git-minimal gunicorn nss-certs)
       (with-imported-modules '((guix build utils))
         #~(begin
@@ -499,18 +499,20 @@ server described by CONFIG, a <genenetwork-configuration> object."
               (invoke "git" "log" "--max-count" "1")
               (hline))
 
-            ;; Clone the latest genenetwork2 and genenetwork3
+            ;; Clone the latest genenetwork2
             ;; repositories.
-            (invoke "git" "clone" "--depth" "1" #$gn2-repository)
-            (with-directory-excursion "genenetwork2"
-              (show-head-commit))
-            (invoke "git" "clone" "--depth" "1" #$gn3-repository)
-            (with-directory-excursion "genenetwork3"
-              (show-head-commit))
+	    (with-directory-excursion
+		#$repositories
+	      (when (file-exists? "genenetwork2")
+		(delete-file-recursively "genenetwork2"))
+	      (invoke "git" "clone" "--depth" "1" #$gn2-repository)
+	      (with-directory-excursion
+		  (string-append #$repositories "/genenetwork2")
+		(show-head-commit)))
 
             ;; Override the genenetwork3 used by genenetwork2.
             (setenv "GN3_PYTHONPATH"
-                    (string-append (getcwd) "/genenetwork3"))
+                    (string-append #$repositories "/genenetwork3"))
             ;; Set other environment variables required by
             ;; genenetwork2.
             (setenv "GN2_PROFILE" #$(profile
@@ -540,15 +542,16 @@ server described by CONFIG, a <genenetwork-configuration> object."
                                 "AUTH_SERVER_SSL_PUBLIC_KEY=\"" gn2-secrets "/gn-auth-ssl-public-key.pem\"\n"))
 
             ;; Start genenetwork2.
-            (with-directory-excursion "genenetwork2"
-              (invoke #$(file-append bash "/bin/sh")
-                      "bin/genenetwork2" "gn2/default_settings.py" "-gunicorn-prod")))))))
+            (with-directory-excursion
+		(string-append #$repositories "/genenetwork2")
+	      (invoke #$(file-append bash "/bin/sh")
+		      "bin/genenetwork2" "gn2/default_settings.py" "-gunicorn-dev")))))))
 
 (define (genenetwork3-cd-gexp config)
   "Return a G-expression that runs the latest genenetwork3 development
 server described by CONFIG, a <genenetwork-configuration> object."
   (match-record config <genenetwork-configuration>
-    (gn3-repository gn3-port gn3-secrets sparql-endpoint data-directory xapian-db-path auth-db-path llm-db-path lmdb-data-path)
+    (gn3-repository gn3-port gn3-secrets sparql-endpoint data-directory xapian-db-path auth-db-path llm-db-path lmdb-data-path repositories)
     (with-manifest (package->development-manifest genenetwork3)
       (with-packages (list git-minimal nss-certs)
         (with-imported-modules '((guix build utils))
@@ -567,9 +570,7 @@ server described by CONFIG, a <genenetwork-configuration> object."
                 (invoke "git" "log" "--max-count" "1")
                 (hline))
 
-              ;; Clone the latest genenetwork3 repository.
-              (invoke "git" "clone" "--depth" "1" #$gn3-repository)
-              (setenv "GN3_PROFILE" #$(profile
+	      (setenv "GN3_PROFILE" #$(profile
                                        (content (package->development-manifest genenetwork3))
                                        (allow-collisions? #t)))
               (setenv "REQUESTS_CA_BUNDLE" (string-append
@@ -592,23 +593,32 @@ server described by CONFIG, a <genenetwork-configuration> object."
                                     (content (package->development-manifest genenetwork3))
                                     (allow-collisions? #t))
                                    "/bin/Rscript"))
-              ;; Run genenetwork3.
-              (with-directory-excursion "genenetwork3"
-                (show-head-commit)
-                (invoke #$(file-append gunicorn "/bin/gunicorn")
-                        "-b" #$(string-append "localhost:" (number->string gn3-port))
-                        "--workers" "8"
-                        "gn3.app:create_app()"
-                        ;; gunicorn's default 30 second timeout is
-                        ;; insufficient for Fahamu AI endpoints and
-                        ;; results in worker timeout errors.
-                        "--timeout" "1200"))))))))
+
+	      (with-directory-excursion
+	       #$repositories
+	       ;; Clone the latest genenetwork3 repository.
+	       (when (file-exists? (string-append #$repositories "/genenetwork3"))
+		 (delete-file-recursively (string-append #$repositories "/genenetwork3")))
+	       (invoke "git" "clone" "--depth" "1" #$gn3-repository))
+
+	      (with-directory-excursion
+	       (string-append #$repositories "/genenetwork3")
+	       (show-head-commit)
+	       ;; Run genenetwork3.
+	       (invoke #$(file-append gunicorn "/bin/gunicorn")
+		       "-b" #$(string-append "localhost:" (number->string gn3-port))
+		       "--workers" "8"
+		       "gn3.app:create_app()"
+		       ;; gunicorn's default 30 second timeout is
+		       ;; insufficient for Fahamu AI endpoints and
+		       ;; results in worker timeout errors.
+		       "--timeout" "1200"))))))))
 
 (define (gn-auth-cd-gexp config)
   "Return a G-expression that runs the latest gn-auth development
 server described by CONFIG, a <genenetwork-configuration> object."
   (match-record config <genenetwork-configuration>
-    (gn-auth-repository gn-auth-port auth-db-path gn-auth-secrets)
+    (gn-auth-repository gn-auth-port auth-db-path gn-auth-secrets repositories)
     (with-manifest (package->development-manifest gn-auth)
       (with-packages (list git-minimal nss-certs)
         (with-imported-modules '((guix build utils))
@@ -626,9 +636,13 @@ server described by CONFIG, a <genenetwork-configuration> object."
                 (hline)
                 (invoke "git" "log" "--max-count" "1")
                 (hline))
+	      (with-directory-excursion
+	       #$repositories
+	       ;; Clone the latest gn-auth repository.
+	       (when (file-exists? "gn-auth")
+		 (delete-file-recursively "gn-auth"))
+               (invoke "git" "clone" "--depth" "1" #$gn-auth-repository))
 
-              ;; Clone the latest gn-auth repository.
-              (invoke "git" "clone" "--depth" "1" #$gn-auth-repository)
               ;; Configure gn-auth.
               (setenv "GN_AUTH_PROFILE" #$(profile
                                            (content (package->development-manifest gn-auth))
@@ -646,7 +660,7 @@ server described by CONFIG, a <genenetwork-configuration> object."
               (setenv "HOME" "/tmp")
               (setenv "AUTHLIB_INSECURE_TRANSPORT" "true")
               ;; Run gn-auth.
-              (with-directory-excursion "gn-auth"
+              (with-directory-excursion (string-append #$repositories "/gn-auth")
                 (show-head-commit)
                 (invoke #$(file-append gunicorn "/bin/gunicorn")
                         "-b" #$(string-append "localhost:" (number->string gn-auth-port))
@@ -691,22 +705,25 @@ server described by CONFIG, a <genenetwork-configuration> object."
          (setenv "CURL_CA_BUNDLE" (getenv "SSL_CERT_FILE"))
          (setenv "REQUESTS_CA_BUNDLE" (getenv "SSL_CERT_FILE"))
 
-         (let ((current-repo-path (string-append (getcwd) "/gn-docs")))
+         (let ((current-repo-path "/export/data/repositories/gn-docs"))
            (when (file-exists? current-repo-path)
              (delete-file-recursively current-repo-path))
-           (setenv "CURRENT_REPO_PATH" current-repo-path)
-           (invoke #$(file-append git-minimal "/bin/git")
-                   "clone" "--depth" "1" (getenv "CGIT_REPO_PATH")))
-         (invoke "git" "clone" "--depth" "1" "https://git.genenetwork.org/gn-guile")
-
-         ;; We have a gn-guile-dev wrapper script that sets a "./" in the
-         ;; GN_GUILE_LOAD_PATH hence allowing this to be run from the gn-guile
-         ;; directory.  This allows gn-guile to be run from the latest
-         ;; upstream commits without pinning to guix.
-         (with-directory-excursion "gn-guile"
-           (show-head-commit)
-           (invoke #$(file-append gn-guile "/bin/gn-guile-dev")
-                   (number->string #$gn-guile-port)))))))
+	   (setenv "CURRENT_REPO_PATH" current-repo-path)
+	   (with-directory-excursion
+	       "/export/data/repositories"
+	     (invoke #$(file-append git-minimal "/bin/git")
+                     "clone" "--depth" "1" (getenv "CGIT_REPO_PATH") current-repo-path)
+	     (when (file-exists? "gn-guile")
+               (delete-file-recursively "gn-guile"))
+	     (invoke "git" "clone" "--depth" "1" "https://git.genenetwork.org/gn-guile")
+	     ;; We have a gn-guile-dev wrapper script that sets a "./" in the
+             ;; GN_GUILE_LOAD_PATH hence allowing this to be run from the gn-guile
+             ;; directory.  This allows gn-guile to be run from the latest
+             ;; upstream commits without pinning to guix.
+             (with-directory-excursion "gn-guile"
+	       (show-head-commit)
+	       (invoke #$(file-append gn-guile "/bin/gn-guile-dev")
+		       (number->string #$gn-guile-port)))))))))
 
 (define (genenetwork-shepherd-services config)
   "Return shepherd services to run the genenetwork development server