From f43e156273cbe8d9b14ae05afcf2a0179ed3e23e Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 1 Jul 2022 01:02:44 +0530 Subject: Switch to new tissue configuration file. * genenetwork-development.scm ()[address, port, indexed-repository]: Delete fields. [listen, hosts]: New fields. * genenetwork-development.scm (): New type. (tissue-conf-gexp): New function. (tissue-shepherd-service): Remove --address and --port arguments. Compute and pass tissue.conf configuration file. Create file system mappings for all hosts. (operating-system)[services]: Use new tissue-configuration fields. --- genenetwork-development.scm | 50 +++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/genenetwork-development.scm b/genenetwork-development.scm index a087f01..dbbdfed 100644 --- a/genenetwork-development.scm +++ b/genenetwork-development.scm @@ -690,11 +690,16 @@ command to be executed." (define-record-type* tissue-configuration make-tissue-configuration tissue-configuration? - (address tissue-configuration-address - (default "127.0.0.1")) - (port tissue-configuration-port - (default 8080)) - (indexed-repository tissue-configuration-indexed-repository)) + (listen tissue-configuration-listen + (default "127.0.0.1:8080")) + (hosts tissue-configuration-hosts + (default '()))) + +(define-record-type* + tissue-host make-tissue-host + tissue-host? + (name tissue-host-name) + (indexed-repository tissue-host-indexed-repository)) (define %tissue-accounts (list (user-account @@ -708,6 +713,17 @@ command to be executed." (name "tissue") (system? #t)))) +(define (tissue-conf-gexp config) + #~(begin + (call-with-output-file #$output + (lambda (port) + (write '((listen . #$(tissue-configuration-listen config)) + (hosts . #$(map (lambda (host) + `(,(tissue-host-name host) + (indexed-repository . ,(tissue-host-indexed-repository host)))) + (tissue-configuration-hosts config)))) + port))))) + (define (tissue-shepherd-service config) (shepherd-service (documentation "Run tissue web server.") @@ -721,18 +737,19 @@ command to be executed." #~(make-forkexec-constructor/container (list #$(file-append tissue "/bin/tissue") "run-web" - #$(string-append "--address=" (tissue-configuration-address config)) - #$(string-append "--port=" (number->string (tissue-configuration-port config)))) + #$(computed-file "tissue.conf" (tissue-conf-gexp config))) #:user "tissue" #:group "tissue" - #:directory #$(tissue-configuration-indexed-repository config) - #:mappings (list (file-system-mapping - (source #$(tissue-configuration-indexed-repository config)) - (target source)) - (file-system-mapping + #:mappings (cons (file-system-mapping (source "/var/log/tissue.log") (target source) - (writable? #t))) + (writable? #t)) + (map (lambda (directory) + (file-system-mapping + (source directory) + (target source))) + '#$(map tissue-host-indexed-repository + (tissue-configuration-hosts config)))) #:log-file "/var/log/tissue.log"))) (stop #~(make-kill-destructor)))) @@ -914,8 +931,11 @@ list of channel names for which a channels.scm should be published." #:directories? #t))))) (service tissue-service-type (tissue-configuration - (port 9088) - (indexed-repository "/srv/http/issues-index"))) + (listen "127.0.0.1:9088") + (hosts + (list (tissue-host + (name "issues.genenetwork.org") + (indexed-repository "/srv/http/issues-index")))))) (service nginx-service-type (nginx-configuration (server-blocks -- cgit v1.2.3