diff options
author | Munyoki Kilyungi | 2025-09-19 17:05:49 +0300 |
---|---|---|
committer | Munyoki Kilyungi | 2025-09-19 17:05:49 +0300 |
commit | 3e93ae2b597b749135417210d12222cf26a08624 (patch) | |
tree | 97ea5edb5be3419092a96be1ffda34eaac9ba7ad | |
parent | 66c9ef215e736ebaddda07fca224456c2a50c934 (diff) | |
download | gn-machines-3e93ae2b597b749135417210d12222cf26a08624.tar.gz |
Use /home/genenetwork for git cloning.
-rwxr-xr-x | genenetwork-development-deploy.sh | 1 | ||||
-rw-r--r-- | genenetwork-development.scm | 84 |
2 files changed, 35 insertions, 50 deletions
diff --git a/genenetwork-development-deploy.sh b/genenetwork-development-deploy.sh index 81d7573..d63dcf0 100755 --- a/genenetwork-development-deploy.sh +++ b/genenetwork-development-deploy.sh @@ -43,7 +43,6 @@ container_script=$(guix system container --network \ --share=/export/data/genenetwork-xapian \ --share=/export/data/genenetwork-sqlite \ --share=/export/data/lmdb \ - --share=/export/data/repositories \ --share=/var/run/mysqld=/run/mysqld \ --share=/export/data/gn-docs/ \ genenetwork-development.scm) diff --git a/genenetwork-development.scm b/genenetwork-development.scm index fe20ec2..abdb694 100644 --- a/genenetwork-development.scm +++ b/genenetwork-development.scm @@ -496,7 +496,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 repositories) + (gn2-repository gn3-repository gn2-port gn3-port gn2-secrets genotype-files gn-guile-port) (with-packages (list coreutils git-minimal gunicorn nss-certs) (with-imported-modules '((guix build utils)) #~(begin @@ -518,17 +518,13 @@ server described by CONFIG, a <genenetwork-configuration> object." ;; Clone the latest genenetwork2 ;; repositories. (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))) + "/home/genenetwork" + (when (file-exists? "/home/genenetwork/genenetwork2") + (delete-file-recursively "/home/genenetwork/genenetwork2")) + (invoke "git" "clone" "--depth" "1" #$gn2-repository)) ;; Override the genenetwork3 used by genenetwork2. - (setenv "GN3_PYTHONPATH" - (string-append #$repositories "/genenetwork3")) + (setenv "GN3_PYTHONPATH" "/home/genenetwork/genenetwork3") ;; Set other environment variables required by ;; genenetwork2. (setenv "GN2_PROFILE" #$(profile @@ -548,7 +544,7 @@ server described by CONFIG, a <genenetwork-configuration> object." (setenv "PLINK_COMMAND" (string-append (getenv "GN2_PROFILE") "/bin/plink2")) (setenv "GEMMA_COMMAND" (string-append (getenv "GN2_PROFILE") "/bin/gemma")) (setenv "GEMMA_WRAPPER_COMMAND" (string-append (getenv "GN2_PROFILE") "/bin/gemma-wrapper")) - (setenv "HOME" "/tmp") + (setenv "HOME" "/home/genenetwork") (setenv "GN2_SETTINGS" #$(mixed-text-file "gn2.conf" @@ -571,21 +567,22 @@ server described by CONFIG, a <genenetwork-configuration> object." ;; Start genenetwork2. (with-directory-excursion - (string-append #$repositories "/genenetwork2") + "/home/genenetwork/genenetwork2" + (show-head-commit) (invoke #$(file-append gunicorn "/bin/gunicorn") - "--bind" (string-append "0.0.0.0:" (number->string #$gn2-port)) - "--workers" "20" - "--keep-alive" "6000" - "--max-requests" "100" - "--max-requests-jitter" "30" - "--timeout" "1200" - "gn2.wsgi"))))))) + "--bind" (string-append "0.0.0.0:" (number->string #$gn2-port)) + "--workers" "20" + "--keep-alive" "6000" + "--max-requests" "100" + "--max-requests-jitter" "30" + "--timeout" "1200" + "gn2.wsgi"))))))) (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 repositories) + (gn3-repository gn3-port gn3-secrets sparql-endpoint data-directory xapian-db-path auth-db-path llm-db-path lmdb-data-path) (with-manifest (package->development-manifest genenetwork3) (with-packages (list git-minimal nss-certs) (with-imported-modules '((guix build utils)) @@ -628,14 +625,14 @@ server described by CONFIG, a <genenetwork-configuration> object." "/bin/Rscript")) (with-directory-excursion - #$repositories + "/home/genenetwork" ;; Clone the latest genenetwork3 repository. - (when (file-exists? (string-append #$repositories "/genenetwork3")) - (delete-file-recursively (string-append #$repositories "/genenetwork3"))) + (when (file-exists? "/home/genenetwork/genenetwork3") + (delete-file-recursively "/home/genenetwork/genenetwork3")) (invoke "git" "clone" "--depth" "1" #$gn3-repository)) (with-directory-excursion - (string-append #$repositories "/genenetwork3") + "/home/genenetwork/genenetwork3" (show-head-commit) ;; Run genenetwork3. (invoke #$(file-append gunicorn "/bin/gunicorn") @@ -651,7 +648,7 @@ server described by CONFIG, a <genenetwork-configuration> object." "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 repositories) + (gn-auth-repository gn-auth-port auth-db-path gn-auth-secrets) (with-manifest (package->development-manifest gn-auth) (with-packages (list git-minimal nss-certs) (with-imported-modules '((guix build utils)) @@ -673,10 +670,10 @@ server described by CONFIG, a <genenetwork-configuration> object." (setenv "GIT_PAGER" #$(file-append coreutils-minimal "/bin/cat")) (with-directory-excursion - #$repositories + "/home/genenetwork/" ;; Clone the latest gn-auth repository. - (when (file-exists? "gn-auth") - (delete-file-recursively "gn-auth")) + (when (file-exists? "/home/genenetwork/gn-auth") + (delete-file-recursively "/home/genenetwork/gn-auth")) (invoke "git" "clone" "--depth" "1" #$gn-auth-repository)) ;; Configure gn-auth. @@ -696,7 +693,7 @@ server described by CONFIG, a <genenetwork-configuration> object." (setenv "HOME" "/tmp") (setenv "AUTHLIB_INSECURE_TRANSPORT" "true") ;; Run gn-auth. - (with-directory-excursion (string-append #$repositories "/gn-auth") + (with-directory-excursion "/home/genenetwork/gn-auth" (show-head-commit) (invoke #$(file-append gunicorn "/bin/gunicorn") "-b" #$(string-append "localhost:" (number->string gn-auth-port)) @@ -741,10 +738,10 @@ server described by CONFIG, a <genenetwork-configuration> object." (setenv "CURL_CA_BUNDLE" (getenv "SSL_CERT_FILE")) (setenv "REQUESTS_CA_BUNDLE" (getenv "SSL_CERT_FILE")) (setenv "GIT_PAGER" #$(file-append coreutils-minimal "/bin/cat")) - (let ((current-repo-path "/export/data/repositories/gn-docs")) + (let ((current-repo-path "/home/genenetwork/gn-docs")) (setenv "CURRENT_REPO_PATH" current-repo-path) (with-directory-excursion - "/export/data/repositories" + "/home/genenetwork/gn-docs" ;; All edits go to the current-repo-path; so we need it to ;; be persistent. (unless (file-exists? current-repo-path) @@ -767,7 +764,7 @@ server described by CONFIG, a <genenetwork-configuration> object." "Return shepherd services to run the genenetwork development server described by CONFIG, a <genenetwork-configuration> object." (match-record config <genenetwork-configuration> - (gn2-port gn3-port gn-auth-port genotype-files data-directory xapian-db-path gn2-secrets auth-db-path gn-auth-secrets llm-db-path lmdb-data-path gn-doc-git-checkout gn-guile-port repositories) + (gn2-port gn3-port gn-auth-port genotype-files data-directory xapian-db-path gn2-secrets auth-db-path gn-auth-secrets llm-db-path lmdb-data-path gn-doc-git-checkout gn-guile-port) (list (shepherd-service (documentation "Run gn-guile server.") (provision '(gn-guile)) @@ -792,7 +789,7 @@ described by CONFIG, a <genenetwork-configuration> object." (target source) (writable? #t)) (file-system-mapping - (source repositories) + (source "/home/genenetwork") (target source) (writable? #t))) #:namespaces (delq 'net %namespaces)) @@ -843,7 +840,7 @@ described by CONFIG, a <genenetwork-configuration> object." (source genotype-files) (target source)) (file-system-mapping - (source repositories) + (source "/home/genenetwork") (target source) (writable? #t)) (file-system-mapping @@ -904,7 +901,7 @@ described by CONFIG, a <genenetwork-configuration> object." (target source) (writable? #t)) (file-system-mapping - (source repositories) + (source "/home/genenetwork") (target source) (writable? #t)) (file-system-mapping @@ -961,7 +958,7 @@ described by CONFIG, a <genenetwork-configuration> object." (target source) (writable? #t)) (file-system-mapping - (source repositories) + (source "/home/genenetwork") (target source) (writable? #t)) (file-system-mapping @@ -996,7 +993,7 @@ described by CONFIG, a <genenetwork-configuration> object." (define (genenetwork-activation config) (match-record config <genenetwork-configuration> - (gn2-secrets gn3-secrets auth-db-path gn-auth-secrets gn-doc-git-checkout repositories) + (gn2-secrets gn3-secrets auth-db-path gn-auth-secrets gn-doc-git-checkout) (with-imported-modules '((guix build utils)) #~(begin (use-modules (guix build utils) @@ -1008,9 +1005,7 @@ described by CONFIG, a <genenetwork-configuration> object." (passwd:uid (getpw "genenetwork")) (passwd:gid (getpw "genenetwork")))) (cons* #$gn3-secrets - (append (find-files #$repositories - #:directories? #t) - (find-files #$gn2-secrets + (append (find-files #$gn2-secrets #:directories? #t) (find-files gn-doc-git-checkout #:directories? #t) @@ -1018,15 +1013,6 @@ described by CONFIG, a <genenetwork-configuration> object." #:directories? #t) (find-files #$gn-auth-secrets #:directories? #t)))) - ;; Here we need to set the top-level directories for the - ;; repositories to 0775 so that they are editable by the - ;; "genenetwork" user/group. Otherwise, we get: - ;; guix/build/syscalls.scm:1231:10: In procedure unshare: - ;; 268566528: Invalid argument - (for-each (lambda (dir) - (chmod dir #o775)) - (scandir #$repositories - (lambda (name) (not (member name '("." "..")))))) ;; Prevent other users from reading secret files. (for-each (lambda (file) |