aboutsummaryrefslogtreecommitdiff
path: root/gn
diff options
context:
space:
mode:
authorEfraim Flashner2020-06-18 14:55:32 +0300
committerEfraim Flashner2020-06-18 14:55:32 +0300
commitb03c9a3ebe05b697e4fd30e5265853660343e142 (patch)
tree913cd84649383df328c7efc22c1f91117c1b8340 /gn
parente42dc305ecdc2e275b6dc9bb6ad5e4a0cd49fba9 (diff)
downloadguix-bioinformatics-b03c9a3ebe05b697e4fd30e5265853660343e142.tar.gz
rshiny service: more work on containerizing
Diffstat (limited to 'gn')
-rw-r--r--gn/services/rshiny.scm46
1 files changed, 35 insertions, 11 deletions
diff --git a/gn/services/rshiny.scm b/gn/services/rshiny.scm
index 0a947cb..90e4728 100644
--- a/gn/services/rshiny.scm
+++ b/gn/services/rshiny.scm
@@ -31,16 +31,42 @@
(provision (list (symbol-append 'rshiny- (string->symbol
(string-take binary 9)))))
(requirement '(networking))
- ;; This one works:
(start
- #~(lambda _
- (setenv "R_LIBS_USER" "/run/current-system/profile/site-library/")
- (invoke #$(string-append "/run/current-system/profile/bin/" binary))))
- ;; Let's try in a container:
- ;(start #~(make-forkexec-constructor/container
- ; (list #$(file-append package "/bin/" binary))
- ; #:environment-variables
- ; (list "R_LIBS_USER=/run/current-system/profile/site-library/")))
+ #~(exec-command
+ (list
+ #$(string-append "/run/current-system/profile/bin/" binary))
+ ;#:log-file #$(string-append "/var/log/" binary ".log") ; kills shepherd
+ #:environment-variables
+ (list "R_LIBS_USER=/run/current-system/profile/site-library/")))
+ ;; Now lets try it with fork+exec
+ ;; Outcome: shepherd says failed, runs in the background.
+ ;(start
+ ; #~(fork+exec-command
+ ; (list
+ ; #$(string-append "/run/current-system/profile/bin/" binary))
+ ; #:environment-variables
+ ; (list "R_LIBS_USER=/run/current-system/profile/site-library/")))
+ ;; More fork+exec trials, this time with a log file:
+ ;; Outcome: shepherd says failed, runs in the background, log populated.
+ ;(start
+ ; #~(fork+exec-command
+ ; (list
+ ; "/run/current-system/profile/bin/nohup"
+ ; #$(string-append "/run/current-system/profile/bin/" binary) "&")
+ ; #:log-file #$(string-append "/var/log/" binary ".log")
+ ; #:environment-variables
+ ; (list "R_LIBS_USER=/run/current-system/profile/site-library/")))
+ ;; Now lets try it with make-forkexec:
+ ;; Outcome: Kills shepherd, does not run in the background.
+ ;(start
+ ; #~(make-forkexec-command
+ ; (list
+ ; "/run/current-system/profile/bin/nohup"
+ ; #$(string-append "/run/current-system/profile/bin/" binary) "&")
+ ; "/run/current-system/profile/bin/bash" "-c"
+ ; #$(string-append "/run/current-system/profile/bin/" binary))
+ ; #:environment-variables
+ ; (list "R_LIBS_USER=/run/current-system/profile/site-library/")))
(stop #~(make-kill-destructor)))))))
(define rshiny-service-type
@@ -57,6 +83,4 @@
(list
(rshiny-configuration-package config))))))
(description
-; (string-append "Run " (rshiny-configuration-package config) ", an R-Shiny
-;webapp, as a Guix Service.")
"Run an R-Shiny webapp as a Guix Service.")))