From 32302924ec92e6d47d0a3089fe1678269c16a8f6 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 20 Feb 2025 12:44:53 -0600 Subject: Split the tempdirs for various applications. --- genenetwork/services/genenetwork.scm | 39 ++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'genenetwork/services') diff --git a/genenetwork/services/genenetwork.scm b/genenetwork/services/genenetwork.scm index a3c0e73..360a6e3 100644 --- a/genenetwork/services/genenetwork.scm +++ b/genenetwork/services/genenetwork.scm @@ -275,8 +275,6 @@ (find-files #$genotype-files #:directories? #t) (find-files #$gn2-secrets - #:directories? #t) - (find-files #$gn-tmpdir #:directories? #t))) (for-each (lambda (file) (chown file @@ -292,7 +290,23 @@ (find-files #$gn2-secrets #:directories? #f) (find-files #$gn-auth-secrets - #:directories? #f))))))) + #:directories? #f))) + ;; Make sub-directories for various apps under gn-tmpdir and assign + ;; appropriate permissions + (for-each (match-lambda + ((subdir user) + (let ((full-path + (string-append #$gn-tmpdir "/" subdir))) + (unless (file-exists? full-path) + (mkdir full-path #o755)) + (for-each (lambda (file) + (chown file + (passwd:uid (getpw user)) + (passwd:gid (getpw user)))) + (find-files full-path + #:directories? #t))))) + '(("gn2-tmpdir" "gunicorn-genenetwork2") + ("gn3-tmpdir" "gunicorn-genenetwork3"))))))) (define (configuration-file-gexp alist) "Return a G-expression that constructs a configuration file of @@ -374,7 +388,9 @@ object." ("AUTH_DB" ,auth-db) ("SQL_URI" ,sql-uri) ("CLIENTS_SSL_PUBLIC_KEYS_DIR" ,(string-append gn-auth-secrets "/clients-public-keys")) - ("SSL_PRIVATE_KEY" ,(string-append gn-auth-secrets "/gn-auth-ssl-private-key.pem"))))))) + ("SSL_PRIVATE_KEY" ,(string-append gn-auth-secrets "/gn-auth-ssl-private-key.pem")))))) + (gn2-tmpdir (string-append gn-tmpdir "/gn2-tmpdir")) + (gn3-tmpdir (string-append gn-tmpdir "/gn3-tmpdir"))) (list (gunicorn-app (name "genenetwork2") (package genenetwork2) @@ -389,7 +405,7 @@ object." (value gn2-profile)) (environment-variable (name "TMPDIR") - (value gn-tmpdir)) + (value gn2-tmpdir)) (environment-variable (name "GN2_SETTINGS") (value gn2-conf)) @@ -407,8 +423,11 @@ object." (file-system-mapping (source gn-sourcecode-directory) (target source)) - (file-system-mapping ; GN2 and GN3 need to share TMPDIR + (file-system-mapping ; GN2 and GN3 need to communicate via TMPDIR (source gn-tmpdir) + (target source)) + (file-system-mapping + (source gn2-tmpdir) (target source) (writable? #t)) (file-system-mapping @@ -444,7 +463,7 @@ object." (value gn3-conf)) (environment-variable (name "TMPDIR") - (value gn-tmpdir)) + (value gn3-tmpdir)) (environment-variable (name "GN3_SECRETS") (value gn3-secrets)) @@ -470,9 +489,13 @@ object." (file-system-mapping (source gn3-data-directory) (target source)) ; Rqtl usese this - (file-system-mapping ; GN2 and GN3 need to share TMPDIR + (file-system-mapping ; GN2 and GN3 need to communicate via TMPDIR (source gn-tmpdir) (target source)) + (file-system-mapping + (source gn3-tmpdir) + (target source) + (writable? #t)) (file-system-mapping (source xapian-db) (target source)) -- cgit v1.2.3