aboutsummaryrefslogtreecommitdiff
path: root/gn/services/genome-browser.scm
diff options
context:
space:
mode:
authorEfraim Flashner2021-05-04 07:44:05 -0500
committerEfraim Flashner2021-05-04 07:44:05 -0500
commit4eb09d4fce950181e1726901620f1d67ff4a0d61 (patch)
tree975356121e9e3126461c3f7eb5b5c9f1f8096eb7 /gn/services/genome-browser.scm
parentac63d819bfba8a9a540abe2c91b730cbafe60e6f (diff)
downloadguix-bioinformatics-4eb09d4fce950181e1726901620f1d67ff4a0d61.tar.gz
gn: genome browser tests good
Diffstat (limited to 'gn/services/genome-browser.scm')
-rw-r--r--gn/services/genome-browser.scm81
1 files changed, 58 insertions, 23 deletions
diff --git a/gn/services/genome-browser.scm b/gn/services/genome-browser.scm
index 1a5b678..9da7535 100644
--- a/gn/services/genome-browser.scm
+++ b/gn/services/genome-browser.scm
@@ -4,6 +4,7 @@
(define-module (gn services genome-browser))
(use-modules (gnu)
+ (guix build utils)
(guix packages)
(gn packages bioinformatics))
(use-service-modules
@@ -23,6 +24,7 @@
"db.user=readonly\n"
"db.password=access\n"
"db.trackDb=trackDb\n"
+ "db.port=13306\n"
"gbdbLoc1=/gbdb/\n"
"gbdbLoc2=http://hgdownload.soe.ucsc.edu/gbdb/\n"
;# To disable on-the-fly loading of mysql data, comment out these lines.
@@ -46,8 +48,7 @@
;"hgc.psxyPath=/hive/data/outside/GMT4.3.1/bin/psxy"
;"hgc.ps2rasterPath=""/bin/ps2raster"
"hgc.ghostscriptPath=" ghostscript "/bin/gs\n" ; needed?
- "udc.cacheDir=/var/www/html/trash/udcCache\n" ; default is /tmp/udcCache
- ))
+ "udc.cacheDir=/var/cache/genome/udcCache\n")) ; default is /tmp/udcCache
(define %startup-script
(mixed-text-file "create_databases.sh"
@@ -55,18 +56,37 @@
bash-minimal "/bin/sh " (package-source ucsc-genome-browser) "/src/product/ex.MySQLUserPerms.sh\n"
mariadb "/bin/mysql -e \"create database hgcentral;\" mysql\n"
mariadb "/bin/mysql hgcentral < hgcentral.sql\n"
- coreutils-minimal "/bin/mkdir -p /var/www/html/trash\n"
- coreutils-minimal "/bin/chown -R httpd:httpd /var/www\n"
- ))
+ coreutils-minimal "/bin/mkdir -p /var/cache/genome\n"
+ coreutils-minimal "/bin/chown -R httpd:httpd /var/www\n"))
+
+;; This might be useful as a one-off shepherd job.
+;(define %genome-activation-script
+; #~(begin
+; ;(unless (file-exists? "/var/lib/mysql/hgcentral")
+; ; (invoke #$(file-append wget "/bin/wget") "http://hgdownload.soe.ucsc.edu/admin/hgcentral.sql" "-O" "/var/lib/mysql/hgcentral.sql")
+; ; ;(invoke "sh" #$(file-append (package-source ucsc-genome-browser) "/src/product/ex.MySQLUserPerms.sh"))
+; ; (invoke #$(file-append mariadb "/bin/mysql") "-e" "\"create database hgcentral;\"" "mysql")
+; ; (invoke #$(file-append mariadb "/bin/mysql") "hgcentral" "<" "/var/lib/mysql/hgcentral.sql"))
+; (unless (file-exists? "/var/www/html/trash")
+; (mkdir-p "/var/www/html/trash"))
+; (unless (file-exists? "/var/cache/genome")
+; (mkdir-p "/var/cache/genome"))
+; (for-each (lambda (file)
+; (chown file (passwd:uid "httpd") (passwd:gid "httpd")))
+; (append (find-files "/var/cache/genome" #:directories? #t)
+; (find-files "/var/www/html/trash" #:directories? #t)))
+; (for-each (lambda (file)
+; (chown file (passwd:uid "mysql") (passwd:gid "mysql")))
+; (find-files "/var/lib/mysql" #:directories? #t))))
+
+;(define %one-month-files
+; (let ((%one-month (* 60 60 24 30)))
+; (find-files "/var/cache/genome" (lambda (file stat)
+; (> (stat:atime stat) %one-month)))))
;; TODO:
-;; create 'daily clean' mcron scripts.
-;; move /var/www/html/trash to /gbdb/trash?
-;; Fix from main page:
-;; hgVai
-;; hgIntegrator
-;; from 'more tools'
-;; hgPhyloPlace
+;; create 'daily clean' mcron scripts. Only needed in /var/cache/genome grows too large.
+;; use rsync to make sure mouse genome data is kept up-to-date.
(define ucsc-genome-browser-port 4321)
@@ -81,10 +101,12 @@
(file-systems %base-file-systems)
;; No firmware for VMs
(firmware '())
- (packages (cons* mariadb ; for create-db script
+ (packages (cons* mariadb ; for create-db script, interacting with database if necessary
%base-packages))
(services
- (list (service mysql-service-type)
+ (list (service mysql-service-type
+ (mysql-configuration
+ (port 13306))) ; don't overlap with penguin2's mariadb
(service special-files-service-type
`(("/root/create_hgcentral" ,%startup-script)
("/var/lib/genome/hg.conf" ,%hg.conf)))
@@ -121,19 +143,27 @@
%default-httpd-modules))
(extra-config (list "\
TypesConfig etc/httpd/mime.types
+# More logs for more debugging.
+LogFormat \"%h %l %u %t \\\"%r\\\" %>s %b\" common
+CustomLog /var/log/httpd/combined_log common
+#LogLevel debug
# cgid.sock needs to be creatable, not in the store
ScriptSock /var/run/cgid.sock
+#XBitHack needs to not be inside the VirtualHost block.
+XBitHack On
# 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 # causes cgi scripts to fail to render
+ Alias /favicon.ico " ucsc-genome-browser "/html/faviconRR.ico
Alias /htdocs " ucsc-genome-browser "/htdocs
- #Alias /trash /var/www/html/trash # this is wrong
- Alias /var/www/html/trash /var/www/html/trash
+ #Alias /htdocs " ucsc-genome-browser "/html
+ Alias /var/www/html/trash /var/cache/genome
+ Alias /var/cache/genome /var/cache/genome
<Directory " ucsc-genome-browser "/html>
- Options +Includes +FollowSymLinks +Indexes
+ Options +Includes
+ #Options +Includes +FollowSymLinks +Indexes
AllowOverride None
<IfModule mod_authz_host.c>
Require all granted
@@ -144,13 +174,21 @@ ScriptSock /var/run/cgid.sock
ScriptAlias /cgi-bin " ucsc-genome-browser "/cgi-bin
<Directory " ucsc-genome-browser "/cgi-bin>
AllowOverride None
- Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch +Includes +FollowSymlinks
+ Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
+ #Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch +Includes +FollowSymlinks
Order allow,deny
#SetHandler cgi-script
Require all granted
Allow from all
</Directory>
+ <Directory /var/cache/genome>
+ Options MultiViews
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+ </Directory>
+ # Upstream default location, possibly expected by software
<Directory /var/www/html/trash>
Options MultiViews
AllowOverride None
@@ -159,8 +197,5 @@ ScriptSock /var/run/cgid.sock
</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 --share=/path/to/gbdb=/gbdb
-;; ALSO need to share in the external database?
-;; Probably not, it falls back to http://hgdownload.soe.ucsc.edu/gbdb/
-;; Can skip the %startup-script dance if /var/lib/mysql is stored outside of the container, but might need /var/www/html/trash too then.
+;; guix system container -L /path/to/guix-past/modules/ -L /path/to/guix-bioinformatics/ /path/to/guix-bioinformatics/gn/services/genome-browser.scm --network --share=/export/efraimf/UCSC_Genome/gbdb=/gbdb --share=/export/efraimf/UCSC_Genome/var-lib-mysql=/var/lib/mysql --share=/export/efraimf/UCSC_Genome/var-cache-genome=/var/cache/genome --share=/export/efraimf/UCSC_Genome/var-cache-genome=/var/www/html/trash
;; xdg-open http://localhost:4321