aboutsummaryrefslogtreecommitdiff
path: root/gn/services
diff options
context:
space:
mode:
Diffstat (limited to 'gn/services')
-rw-r--r--gn/services/bnw-container.scm32
-rw-r--r--gn/services/genome-browser.scm99
-rw-r--r--gn/services/gn1-httpd-config.scm18
3 files changed, 133 insertions, 16 deletions
diff --git a/gn/services/bnw-container.scm b/gn/services/bnw-container.scm
index 39da38d..b121bdb 100644
--- a/gn/services/bnw-container.scm
+++ b/gn/services/bnw-container.scm
@@ -2,9 +2,11 @@
(use-modules (gnu)
(gn packages bnw)
+ (guix build utils)
(guix records)
(ice-9 match))
(use-service-modules networking web)
+(use-package-modules base)
(define-record-type* <bnw-configuration>
bnw-configuration
@@ -15,16 +17,22 @@
(deploy-directory bnw-deploy-directory ; string
(default "/srv/http"))
(port bnw-configuration-port ; list of strings
- (default '("8880"))))
+ (default '("8881"))))
(define bnw-activation
(match-lambda
- (($ <bnw-configuration> package deploy-directory port)
+ (($ <bnw-configuration> package _ port)
#~(begin
- (mkdir-p #$deploy-directory)
- (copy-recursively #$package #$deploy-directory)
- (invoke #$(file-append coreutils "/bin/chmod") "a+w"
- (string-append #$deploy-directory "/sourcecodes/data"))))))
+ (let ((genenet "/var/lib/genenet/bnw")
+ (php-fpm-uid (passwd:uid (getpw "php-fpm")))
+ (php-fpm-gid (passwd:gid (getpw "php-fpm"))))
+ (mkdir-p genenet)
+ (copy-recursively #$(file-append package "/var_lib_genenet_bnw") genenet)
+ (for-each (lambda (file-name)
+ (make-file-writable file-name)
+ (chown file-name php-fpm-uid php-fpm-gid))
+ (find-files genenet
+ #:directories? #t)))))))
(define bnw-nginx-config
(match-lambda
@@ -33,8 +41,8 @@
(nginx-server-configuration
(server-name '("Bayesian Network"))
(listen port)
- ;(root package)
- (root deploy-directory)
+ (root package)
+ ;(root deploy-directory)
(locations
(list
(nginx-php-location)
@@ -74,11 +82,13 @@
;; No firmware for VMs.
(firmware '())
;; We don't need any packages inside the container.
- (packages '())
+ (packages (list coreutils))
(services (list (service dhcp-client-service-type)
(service bnw-service-type
;; The following is for testing:
- ;(bnw-configuration
- ; (port '("8888")))
+ (bnw-configuration
+ (port '("8888")))
))))
+
+;; guix system container -L ~/workspace/guix-past/modules/ -L ~/workspace/guix-bioinformatics/ ~/workspace/guix-bioinformatics/gn/services/bnw-container.scm --network
diff --git a/gn/services/genome-browser.scm b/gn/services/genome-browser.scm
new file mode 100644
index 0000000..58c8e4a
--- /dev/null
+++ b/gn/services/genome-browser.scm
@@ -0,0 +1,99 @@
+;; See dockerfile for some clarification about choices:
+;; https://github.com/icebert/docker_ucsc_genome_browser/blob/master/Dockerfile
+(define-module (gn services genome-browser))
+
+(use-modules (gnu)
+ (gn packages bioinformatics)
+ )
+(use-service-modules web)
+
+(define %hg.conf
+ (mixed-text-file "hg.conf"
+ "browser.documentRoot=" ucsc-genome-browser "/html\n"
+ "db.host=gbdb\n"
+ "db.user=admin\n"
+ "db.password=admin\n"
+ "db.trackDb=trackDb\n"
+ "defaultGenome=Human\n"
+ "central.db=hgcentral\n"
+ "central.host=gbdb\n"
+ "central.user=admin\n"
+ "central.password=admin\n"
+ "central.domain=\n"
+ "backupcentral.db=hgcentral\n"
+ "backupcentral.host=gbdb\n"
+ "backupcentral.user=admin\n"
+ "backupcentral.password=admin\n"
+ "backupcentral.domain=\n"))
+
+;; TODO: create 'daily clean' mcron scripts.
+;; /var/www/html/trash needs to be created and owned by httpd:httpd
+
+(define ucsc-genome-browser-port 4321)
+
+(operating-system
+ (host-name "genome-browser")
+ (timezone "Etc/UTC")
+ (locale "en_US.utf8")
+
+ (bootloader (bootloader-configuration
+ (bootloader grub-bootloader)
+ (target "does-not-matter")))
+ (file-systems %base-file-systems)
+ ;; No firmware for VMs
+ (firmware '())
+ (packages (cons* %base-packages))
+ (services
+ (list (service httpd-service-type
+ (httpd-configuration
+ (config
+ (httpd-config-file
+ (document-root (file-append ucsc-genome-browser "/html"))
+ (listen (list (number->string ucsc-genome-browser-port)))
+ (modules
+ (cons*
+ (httpd-module
+ (name "cgid_module")
+ (file "modules/mod_cgid.so"))
+ (httpd-module
+ (name "include_module")
+ (file "modules/mod_include.so"))
+ %default-httpd-modules))
+ (extra-config (list "\
+TypesConfig etc/httpd/mime.types
+# cgid.sock needs to be creatable, not in the store
+ScriptSock /var/run/cgid.sock
+# same as 'listen' above
+<VirtualHost *:" (number->string ucsc-genome-browser-port) ">
+ XBitHack On
+ DocumentRoot " ucsc-genome-browser "/html
+ Alias /bin " ucsc-genome-browser "/bin
+ Alias /cgi-bin " ucsc-genome-browser "/cgi-bin
+ #Alias /cgi-bin/hg.conf " %hg.conf " # this doesn't seem to work
+ Alias /htdocs " ucsc-genome-browser "/htdocs
+ <Directory " ucsc-genome-browser "/html>
+ Options +Includes
+ SSILegacyExprParser on
+ </Directory>
+
+ ScriptAlias /cgi-bin/ " ucsc-genome-browser "/cgi-bin/
+ <Directory " ucsc-genome-browser "/cgi-bin>
+ AllowOverride None
+ Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
+ #Order allow,deny
+ #Allow from all
+ SetHandler cgi-script
+ Require all granted
+ </Directory>
+
+ <Directory /var/www/html/trash>
+ Options MultiViews
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+ </Directory>
+</VirtualHost>")))))))))
+
+;; guix system container -L /path/to/guix-past/modules/ -L /path/to/guix-bioinformatics/ /path/to/guix-bioinformatics/gn/services/genome-browser.scm --network
+;; ALSO need to share in the external database
+;; xdg-open http://localhost:4321
diff --git a/gn/services/gn1-httpd-config.scm b/gn/services/gn1-httpd-config.scm
index a466097..6b2397d 100644
--- a/gn/services/gn1-httpd-config.scm
+++ b/gn/services/gn1-httpd-config.scm
@@ -62,6 +62,13 @@
("alias_module" "modules/mod_alias.so")
("rewrite_module" "modules/mod_rewrite.so"))))
+; Alternative setup
+; (let* ((gn1-user "wrk")
+; (gn1-source "/home/wrk/gn1-pjotr/gnshare/gn")
+; (gn1-server "gn1-pjotr.genenetwork.org")
+; (gn1-port "8043"))
+
+
(define GN1-httpd-config
(let* ((gn1-user "gn1")
(gn1-source (string-append "/home/" gn1-user "/production/gnshare/gn"))
@@ -117,12 +124,13 @@ NameVirtualHost *:" gn1-port "
PythonHandler " gn1-source "/web/webqtl/main.py
#PythonHandler mod_python.publisher
#PythonHandler mod_python.cgihandler
+ PythonOption mod_python.session.session_type FileSession
# only while debugging:
- PythonOption mod_python.session.session_type MemorySession
PythonDebug On
</Directory>
# only while debugging:
-<Location /mpinfo>
- SetHandler python-program
- PythonHandler mod_python.testhandler
-</Location>")))))
+# <Location /mpinfo>
+# SetHandler python-program
+# PythonHandler mod_python.testhandler
+# </Location>"
+)))))