aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner2021-05-04 07:44:05 -0500
committerEfraim Flashner2021-05-04 07:44:05 -0500
commit4eb09d4fce950181e1726901620f1d67ff4a0d61 (patch)
tree975356121e9e3126461c3f7eb5b5c9f1f8096eb7
parentac63d819bfba8a9a540abe2c91b730cbafe60e6f (diff)
downloadguix-bioinformatics-4eb09d4fce950181e1726901620f1d67ff4a0d61.tar.gz
gn: genome browser tests good
-rw-r--r--gn/packages/bioinformatics.scm25
-rw-r--r--gn/services/genome-browser.scm81
2 files changed, 71 insertions, 35 deletions
diff --git a/gn/packages/bioinformatics.scm b/gn/packages/bioinformatics.scm
index a8ebe68..58110a7 100644
--- a/gn/packages/bioinformatics.scm
+++ b/gn/packages/bioinformatics.scm
@@ -32,6 +32,7 @@
#:use-module (gnu packages elf)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages gcc)
+ #:use-module (gnu packages ghostscript)
#:use-module (gnu packages gtk)
#:use-module (gnu packages image)
#:use-module (gnu packages imagemagick)
@@ -1609,10 +1610,12 @@ multiple sequence alignment.")
(substitute* (cons* "inc/cgi_build_rules.mk"
(find-files "." "makefile"))
(("CGI_BIN\\}-\\$\\{USER") "CGI_BIN_USER"))
+
;; Force linking with freetype.
(substitute* "inc/common.mk"
(("libpng-config --ldflags") "pkg-config --libs libpng freetype2")
(("libpng-config --I_opts") "pkg-config --cflags-only-I libpng freetype2"))
+
;; Force the trash location.
(substitute* (cons*
"utils/qa/showTracks"
@@ -1620,12 +1623,11 @@ multiple sequence alignment.")
"hg/js/hgTracks.js"
(find-files "." "\\.c$"))
;; This line is specifically needed as-is.
- (("\\.\\./trash") "/var/www/html/trash"))
+ (("\\.\\./trash") "/var/cache/genome"))
#t)))
;; Install happens during the 'build phase.
;; Install the website files too
- ;; rsync -avzP rsync://hgdownload.cse.ucsc.edu/htdocs/ /var/www/html/
(replace 'install
(lambda _
(invoke "make" "doc-install")
@@ -1639,15 +1641,13 @@ multiple sequence alignment.")
"include /var/lib/genome/hg.conf\n")))
#t)))
(add-after 'install 'create-symlink
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out")))
- ;; Some trash locations are hardcoded as "../trash"
- ;(symlink "/var/www/html/trash"
- ; (string-append out "/trash"))
- (symlink "../html"
- (string-append out "/htdocs"))
- #t)))
- )))
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p "htdocs")
+ ;; Fallback location for fonts.
+ (symlink (string-append (assoc-ref inputs "gs-fonts")
+ "/share/fonts/type1/ghostscript")
+ "htdocs/urw-fonts")
+ #t)))))
(inputs
`(("freetype" ,freetype)
("libpng" ,libpng)
@@ -1658,7 +1658,8 @@ multiple sequence alignment.")
("python2" ,python-2)
("zlib" ,zlib)))
(native-inputs
- `(("pkg-config" ,pkg-config)
+ `(("gs-fonts" ,gs-fonts)
+ ("pkg-config" ,pkg-config)
("python" ,python)
("rsync" ,rsync) ; For installing js files from the source checkout
("tcl" ,tcl)
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