This repo contains the files used to run shepherd services.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

103 lines
3.5 KiB

  1. (use-modules (shepherd service))
  2. (define date+%s
  3. (strftime "%s" (gmtime (current-time))))
  4. (define bnw
  5. (make <service>
  6. #:provides '(bnw)
  7. #:docstring "Run the Beyesian Network Webserver"
  8. #:start (make-forkexec-constructor
  9. '("/usr/bin/sudo" "/home/shepherd/run_bnw.sh")
  10. #:log-file (string-append "/home/shepherd/logs/bnw-"
  11. date+%s ".log"))
  12. #:stop (make-kill-destructor)
  13. #:respawn? #t))
  14. (register-services bnw)
  15. (define gitea
  16. (make <service>
  17. #:provides '(gitea)
  18. #:docstring "Run a Gitea instance"
  19. #:start (make-forkexec-constructor
  20. '("/usr/bin/sudo" "/home/shepherd/run_gitea.sh")
  21. #:log-file (string-append "/home/shepherd/logs/gitea-"
  22. date+%s ".log"))
  23. #:stop (make-kill-destructor)
  24. #:respawn? #t))
  25. (register-services gitea)
  26. (define ipfs
  27. (make <service>
  28. #:provides '(ipfs)
  29. #:docstring "Run the IPFS daemon"
  30. #:start (make-forkexec-constructor
  31. '("/usr/bin/sudo" "/home/shepherd/run_ipfs.sh")
  32. #:log-file (string-append "/home/shepherd/logs/ipfs-"
  33. date+%s ".log"))
  34. #:stop (make-kill-destructor)
  35. #:respawn? #t))
  36. (register-services ipfs)
  37. (define mcron
  38. (make <service>
  39. #:provides '(mcron)
  40. #:docstring "Run the mcron daemon"
  41. #:start (make-forkexec-constructor
  42. '("/var/guix/profiles/per-user/shepherd/guix-profile/bin/mcron")
  43. #:log-file (string-append "/home/shepherd/logs/mcron-"
  44. date+%s ".log"))
  45. #:stop (make-kill-destructor)
  46. #:respawn? #t))
  47. (register-services mcron)
  48. (define power
  49. (make <service>
  50. #:provides '(power)
  51. #:docstring "Run the BXD Power Calculator app"
  52. #:start (make-forkexec-constructor
  53. ;'(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'")
  54. '("/home/shepherd/run_power.sh")
  55. #:log-file (string-append "/home/shepherd/logs/power-"
  56. date+%s ".log"))
  57. #:stop (make-kill-destructor)
  58. #:respawn? #t))
  59. (register-services power)
  60. (define rn6app
  61. (make <service>
  62. #:provides '(rn6app)
  63. #:docstring "Run RN6 Assembly Error app"
  64. #:start (make-forkexec-constructor
  65. ;'(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'")
  66. '("/home/shepherd/run_rn6app.sh")
  67. #:log-file (string-append "/home/shepherd/logs/rn6app-"
  68. date+%s ".log"))
  69. #:stop (make-kill-destructor)
  70. #:respawn? #t))
  71. (register-services rn6app)
  72. (define test-upgrade
  73. (make <service>
  74. #:provides '(test-upgrade)
  75. #:docstring "Build all the services to make sure they work on an upgrade"
  76. #:start (make-forkexec-constructor
  77. (when (zero? (system* "guix" "build" "-L" "/home/shepherd/guix-bioinformatics"
  78. "--no-grafts" "bnw" "gitea" "go-ipfs" "edirect-gn"
  79. "bxd-power-calculator-app" "rn6-assembly-error-app"))
  80. (zero? (system* "guix" "system" "-L" "/home/shepherd/guix-bioinformatics"
  81. "container" "/home/shepherd/guix-bioinformatics/gn/services/bnw-container.scm"
  82. "--share=/home/shepherd/logs/bnw-server=/var/log" "--network")))
  83. #:log-file (string-append "/home/shepherd/logs/test-upgrade-"
  84. date+%s ".log"))
  85. #:one-shot? #t))
  86. (register-services test-upgrade)
  87. ;; Send shepherd into the background
  88. (action 'shepherd 'daemonize)
  89. ;; Services to start when shepherd starts:
  90. ;; Add the name of each service that should be started to the list
  91. ;; below passed to 'for-each'.
  92. (for-each start '(bnw gitea ipfs mcron power rn6app))