diff options
Diffstat (limited to 'shepherd')
-rw-r--r-- | shepherd/init.d/bnw.scm | 12 | ||||
-rw-r--r-- | shepherd/init.d/gitea.scm | 12 | ||||
-rw-r--r-- | shepherd/init.d/ipfs.scm | 12 | ||||
-rw-r--r-- | shepherd/init.d/mcron.scm | 12 | ||||
-rw-r--r-- | shepherd/init.d/power.scm | 13 | ||||
-rw-r--r-- | shepherd/init.d/rn6app.scm | 13 | ||||
-rw-r--r-- | shepherd/init.d/test-upgrade.scm | 15 | ||||
-rw-r--r-- | shepherd/init.scm | 107 |
8 files changed, 98 insertions, 98 deletions
diff --git a/shepherd/init.d/bnw.scm b/shepherd/init.d/bnw.scm new file mode 100644 index 0000000..ed9bf9d --- /dev/null +++ b/shepherd/init.d/bnw.scm @@ -0,0 +1,12 @@ +(define bnw + (make <service> + #:provides '(bnw) + #:docstring "Run the Beyesian Network Webserver" + #:start (make-forkexec-constructor + '("/usr/bin/sudo" "/home/shepherd/run_bnw.sh") + #:log-file "/home/shepherd/logs/bnw.log") + #:stop (make-kill-destructor) + #:respawn? #t)) +(register-services bnw) + +(start bnw) diff --git a/shepherd/init.d/gitea.scm b/shepherd/init.d/gitea.scm new file mode 100644 index 0000000..b5d77f0 --- /dev/null +++ b/shepherd/init.d/gitea.scm @@ -0,0 +1,12 @@ +(define gitea + (make <service> + #:provides '(gitea) + #:docstring "Run a Gitea instance" + #:start (make-forkexec-constructor + '("/usr/bin/sudo" "/home/shepherd/run_gitea.sh") + #:log-file "/home/shepherd/logs/gitea.log") + #:stop (make-kill-destructor) + #:respawn? #t)) +(register-services gitea) + +(start gitea) diff --git a/shepherd/init.d/ipfs.scm b/shepherd/init.d/ipfs.scm new file mode 100644 index 0000000..1b8d21a --- /dev/null +++ b/shepherd/init.d/ipfs.scm @@ -0,0 +1,12 @@ +(define ipfs + (make <service> + #:provides '(ipfs) + #:docstring "Run the IPFS daemon" + #:start (make-forkexec-constructor + '("/usr/bin/sudo" "/home/shepherd/run_ipfs.sh") + #:log-file "/home/shepherd/logs/ipfs.log") + #:stop (make-kill-destructor) + #:respawn? #t)) +(register-services ipfs) + +(start ipfs) diff --git a/shepherd/init.d/mcron.scm b/shepherd/init.d/mcron.scm new file mode 100644 index 0000000..415e1f0 --- /dev/null +++ b/shepherd/init.d/mcron.scm @@ -0,0 +1,12 @@ +(define mcron + (make <service> + #:provides '(mcron) + #:docstring "Run the mcron daemon" + #:start (make-forkexec-constructor + '("/var/guix/profiles/per-user/shepherd/guix-profile/bin/mcron") + #:log-file "/home/shepherd/logs/mcron.log") + #:stop (make-kill-destructor) + #:respawn? #t)) +(register-services mcron) + +(start mcron) diff --git a/shepherd/init.d/power.scm b/shepherd/init.d/power.scm new file mode 100644 index 0000000..d35230c --- /dev/null +++ b/shepherd/init.d/power.scm @@ -0,0 +1,13 @@ +(define power + (make <service> + #:provides '(power) + #:docstring "Run the BXD Power Calculator app" + #:start (make-forkexec-constructor + ;(system* "/var/guix/profiles/per-user/shepherd/current-guix/bin/guix" "environment" "--ad-hoc" "rn6-assembly-error-app" "--" "/bin/sh -c 'R_LIBS_USER=$GUIX_ENVIRONMENT/site-library/ rn6-assembly-error-app'") + '("/home/shepherd/run_power.sh") + #:log-file "/home/shepherd/logs/power.log") + #:stop (make-kill-destructor) + #:respawn? #t)) +(register-services power) + +(start power) diff --git a/shepherd/init.d/rn6app.scm b/shepherd/init.d/rn6app.scm new file mode 100644 index 0000000..6ae89c6 --- /dev/null +++ b/shepherd/init.d/rn6app.scm @@ -0,0 +1,13 @@ +(define rn6app + (make <service> + #:provides '(rn6app) + #:docstring "Run RN6 Assembly Error app" + #:start (make-forkexec-constructor + ;(system* "/var/guix/profiles/per-user/shepherd/current-guix/bin/guix" "environment" "--ad-hoc" "rn6-assembly-error-app" "--" "/bin/sh -c 'R_LIBS_USER=$GUIX_ENVIRONMENT/site-library/ rn6-assembly-error-app'") + '("/home/shepherd/run_rn6app.sh") + #:log-file "/home/shepherd/logs/rn6app.log") + #:stop (make-kill-destructor) + #:respawn? #t)) +(register-services rn6app) + +(start rn6app) diff --git a/shepherd/init.d/test-upgrade.scm b/shepherd/init.d/test-upgrade.scm new file mode 100644 index 0000000..0c17303 --- /dev/null +++ b/shepherd/init.d/test-upgrade.scm @@ -0,0 +1,15 @@ +(define test-upgrade + (make <service> + #:provides '(test-upgrade) + #:docstring "Build all the services to make sure they work on an upgrade" + #:start (make-forkexec-constructor + ;; First attempt to build all the packages and only afterward attempt to build the containers. + (when (zero? (system* "guix" "build" "-L" "/home/shepherd/guix-bioinformatics" + "--no-grafts" "bnw" "gitea" "go-ipfs" "edirect-gn" + "bxd-power-calculator-app" "rn6-assembly-error-app")) + (zero? (system* "guix" "system" "-L" "/home/shepherd/guix-bioinformatics" + "container" "/home/shepherd/guix-bioinformatics/gn/services/bnw-container.scm" + "--share=/home/shepherd/logs/bnw-server=/var/log" "--network"))) + #:log-file "/home/shepherd/logs/test-upgrade.log") + #:one-shot? #t)) +(register-services test-upgrade) diff --git a/shepherd/init.scm b/shepherd/init.scm index 232af4a..b458e59 100644 --- a/shepherd/init.scm +++ b/shepherd/init.scm @@ -1,102 +1,13 @@ -(use-modules (shepherd service)) +(use-modules (shepherd service) + ((ice-9 ftw) #:select (scandir))) -(define date+%s - (strftime "%s" (gmtime (current-time)))) - -(define bnw - (make <service> - #:provides '(bnw) - #:docstring "Run the Beyesian Network Webserver" - #:start (make-forkexec-constructor - '("/usr/bin/sudo" "/home/shepherd/run_bnw.sh") - #:log-file (string-append "/home/shepherd/logs/bnw-" - date+%s ".log")) - #:stop (make-kill-destructor) - #:respawn? #t)) -(register-services bnw) - -(define gitea - (make <service> - #:provides '(gitea) - #:docstring "Run a Gitea instance" - #:start (make-forkexec-constructor - '("/usr/bin/sudo" "/home/shepherd/run_gitea.sh") - #:log-file (string-append "/home/shepherd/logs/gitea-" - date+%s ".log")) - #:stop (make-kill-destructor) - #:respawn? #t)) -(register-services gitea) - -(define ipfs - (make <service> - #:provides '(ipfs) - #:docstring "Run the IPFS daemon" - #:start (make-forkexec-constructor - '("/usr/bin/sudo" "/home/shepherd/run_ipfs.sh") - #:log-file (string-append "/home/shepherd/logs/ipfs-" - date+%s ".log")) - #:stop (make-kill-destructor) - #:respawn? #t)) -(register-services ipfs) - -(define mcron - (make <service> - #:provides '(mcron) - #:docstring "Run the mcron daemon" - #:start (make-forkexec-constructor - '("/var/guix/profiles/per-user/shepherd/guix-profile/bin/mcron") - #:log-file (string-append "/home/shepherd/logs/mcron-" - date+%s ".log")) - #:stop (make-kill-destructor) - #:respawn? #t)) -(register-services mcron) - -(define power - (make <service> - #:provides '(power) - #:docstring "Run the BXD Power Calculator app" - #:start (make-forkexec-constructor - ;'(system* "/var/guix/profiles/per-user/shepherd/current-guix/bin/guix" "environment" "--ad-hoc" "rn6-assembly-error-app" "--" "/bin/sh -c 'R_LIBS_USER=$GUIX_ENVIRONMENT/site-library/ rn6-assembly-error-app'") - '("/home/shepherd/run_power.sh") - #:log-file (string-append "/home/shepherd/logs/power-" - date+%s ".log")) - #:stop (make-kill-destructor) - #:respawn? #t)) -(register-services power) - -(define rn6app - (make <service> - #:provides '(rn6app) - #:docstring "Run RN6 Assembly Error app" - #:start (make-forkexec-constructor - ;'(system* "/var/guix/profiles/per-user/shepherd/current-guix/bin/guix" "environment" "--ad-hoc" "rn6-assembly-error-app" "--" "/bin/sh -c 'R_LIBS_USER=$GUIX_ENVIRONMENT/site-library/ rn6-assembly-error-app'") - '("/home/shepherd/run_rn6app.sh") - #:log-file (string-append "/home/shepherd/logs/rn6app-" - date+%s ".log")) - #:stop (make-kill-destructor) - #:respawn? #t)) -(register-services rn6app) - -(define test-upgrade - (make <service> - #:provides '(test-upgrade) - #:docstring "Build all the services to make sure they work on an upgrade" - #:start (make-forkexec-constructor - (when (zero? (system* "guix" "build" "-L" "/home/shepherd/guix-bioinformatics" - "--no-grafts" "bnw" "gitea" "go-ipfs" "edirect-gn" - "bxd-power-calculator-app" "rn6-assembly-error-app")) - (zero? (system* "guix" "system" "-L" "/home/shepherd/guix-bioinformatics" - "container" "/home/shepherd/guix-bioinformatics/gn/services/bnw-container.scm" - "--share=/home/shepherd/logs/bnw-server=/var/log" "--network"))) - #:log-file (string-append "/home/shepherd/logs/test-upgrade-" - date+%s ".log")) - #:one-shot? #t)) -(register-services test-upgrade) +;; Load all the files in the directory 'init.d' with a suffix '.scm'. +(for-each + (lambda (file) + (load (string-append "init.d/" file))) + (scandir (string-append (dirname (current-filename)) "/init.d") + (lambda (file) + (string-suffix? ".scm" file)))) ;; Send shepherd into the background (action 'shepherd 'daemonize) - -;; Services to start when shepherd starts: -;; Add the name of each service that should be started to the list -;; below passed to 'for-each'. -(for-each start '(bnw gitea ipfs mcron power rn6app)) |