diff options
author | Efraim Flashner | 2020-03-01 04:10:04 -0600 |
---|---|---|
committer | Efraim Flashner | 2020-03-01 04:10:04 -0600 |
commit | f843d9c7bb5c3e3e1a6d678b67943231e97a0762 (patch) | |
tree | f487c39165d70f1139d48c0bdcbbb9424aaeb3ce | |
download | gn-shepherd-services-f843d9c7bb5c3e3e1a6d678b67943231e97a0762.tar.gz |
initial commit
-rw-r--r-- | README | 5 | ||||
-rw-r--r-- | cron/gitea-dump.guile | 2 | ||||
-rwxr-xr-x | run_bnw.sh | 2 | ||||
-rwxr-xr-x | run_gitea-dump.sh | 2 | ||||
-rwxr-xr-x | run_gitea.sh | 2 | ||||
-rwxr-xr-x | run_ipfs.sh | 2 | ||||
-rwxr-xr-x | run_power.sh | 2 | ||||
-rwxr-xr-x | run_rn6app.sh | 2 | ||||
-rw-r--r-- | shepherd/init.scm | 102 | ||||
-rwxr-xr-x | update_archive-pubmed.sh | 2 |
10 files changed, 123 insertions, 0 deletions
@@ -0,0 +1,5 @@ +This repo contains the files used to run shepherd services. + +The `shepherd` and `cron` directories go in `.config` + +The shell scripts sit in the home directory. diff --git a/cron/gitea-dump.guile b/cron/gitea-dump.guile new file mode 100644 index 0000000..20a188a --- /dev/null +++ b/cron/gitea-dump.guile @@ -0,0 +1,2 @@ +(job '(next-day) + "/usr/bin/sudo /home/shepherd/run_gitea-dump.sh") diff --git a/run_bnw.sh b/run_bnw.sh new file mode 100755 index 0000000..3c56175 --- /dev/null +++ b/run_bnw.sh @@ -0,0 +1,2 @@ +#!/bin/sh +$(/var/guix/profiles/per-user/shepherd/current-guix/bin/guix system container /home/shepherd/guix-bioinformatics/gn/services/bnw-container.scm --share=/home/shepherd/logs/bnw-server=/var/log --network) diff --git a/run_gitea-dump.sh b/run_gitea-dump.sh new file mode 100755 index 0000000..bcfa660 --- /dev/null +++ b/run_gitea-dump.sh @@ -0,0 +1,2 @@ +#!/bin/sh +bin/su -l gitea -c 'GITEA_WORK_DIR=/var/lib/git/gitea HOME=/var/lib/git/gitea $(/var/guix/profiles/per-user/shepherd/current-guix/bin/guix build gitea)/bin/gitea dump --verbose' diff --git a/run_gitea.sh b/run_gitea.sh new file mode 100755 index 0000000..e5bfe29 --- /dev/null +++ b/run_gitea.sh @@ -0,0 +1,2 @@ +#!/bin/sh +/bin/su -l gitea -c 'GITEA_WORK_DIR=/var/lib/git/gitea HOME=/var/lib/git/gitea $(/var/guix/profiles/per-user/shepherd/current-guix/bin/guix build gitea)/bin/gitea --port 3300' diff --git a/run_ipfs.sh b/run_ipfs.sh new file mode 100755 index 0000000..c8f5d56 --- /dev/null +++ b/run_ipfs.sh @@ -0,0 +1,2 @@ +#!/bin/sh +/bin/su -l ipfs -c 'IPFS_PATH=/export/ipfs $(/var/guix/profiles/per-user/shepherd/current-guix/bin/guix build go-ipfs)/bin/ipfs daemon' diff --git a/run_power.sh b/run_power.sh new file mode 100755 index 0000000..7cfded7 --- /dev/null +++ b/run_power.sh @@ -0,0 +1,2 @@ +#!/bin/sh +/var/guix/profiles/per-user/shepherd/current-guix/bin/guix environment --ad-hoc bxd-power-calculator-app -- sh -c 'R_LIBS_USER=$GUIX_ENVIRONMENT/site-library/ bxd-power-calculator-app' diff --git a/run_rn6app.sh b/run_rn6app.sh new file mode 100755 index 0000000..46343a6 --- /dev/null +++ b/run_rn6app.sh @@ -0,0 +1,2 @@ +#!/bin/sh +/var/guix/profiles/per-user/shepherd/current-guix/bin/guix environment --ad-hoc rn6-assembly-error-app -- sh -c 'R_LIBS_USER=$GUIX_ENVIRONMENT/site-library/ rn6-assembly-error-app' diff --git a/shepherd/init.scm b/shepherd/init.scm new file mode 100644 index 0000000..232af4a --- /dev/null +++ b/shepherd/init.scm @@ -0,0 +1,102 @@ +(use-modules (shepherd service)) + +(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) + +;; 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)) diff --git a/update_archive-pubmed.sh b/update_archive-pubmed.sh new file mode 100755 index 0000000..855ed2d --- /dev/null +++ b/update_archive-pubmed.sh @@ -0,0 +1,2 @@ +#!/bin/sh +/bin/su -l hchen -c 'export EDIRECT_PUBMED_MASTER=/export2/PubMed; export PERL_LWP_SSL_CA_FILE=/etc/ssl/certs/ca-certificates.crt; export NLTK_DATA=/export2/PubMed/nltk_data; export PATH=$(/var/guix/profiles/per-user/shepherd/current-guix/bin/guix build edirect-gn)/bin:$PATH; $(/var/guix/profiles/per-user/shepherd/current-guix/bin/guix build edirect-gn)/bin/archive-pubmed' |