diff options
Diffstat (limited to 'gn/services/bnw-container.scm')
-rw-r--r-- | gn/services/bnw-container.scm | 32 |
1 files changed, 21 insertions, 11 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 |