aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner2019-10-25 09:09:50 -0500
committerEfraim Flashner2019-10-25 09:09:50 -0500
commit67d99cd7e533fb867aca258175660885793b1481 (patch)
tree21fe9ea361cb51906e9f13f3dbc3619cd16522fa
parent88e218c7f247961cd1dc98f082e178599ed5dfc5 (diff)
downloadguix-bioinformatics-67d99cd7e533fb867aca258175660885793b1481.tar.gz
gn: Add service files for bnw
-rw-r--r--gn/services/bnw-README22
-rw-r--r--gn/services/bnw-container.scm28
-rw-r--r--gn/services/bnw.service10
3 files changed, 60 insertions, 0 deletions
diff --git a/gn/services/bnw-README b/gn/services/bnw-README
new file mode 100644
index 0000000..29cc816
--- /dev/null
+++ b/gn/services/bnw-README
@@ -0,0 +1,22 @@
+SETUP:
+
+The setup process works like this:
+$ guix build bnw
+$ mkdir -p /home/bnw/server/bnw
+$ cp -a $(guix build bnw)/* /home/bnw/server/bnw/
+$ chmod a+w /home/bnw/server -R
+
+for testing changes to the container, you'll want to do the following (or thereabouts):
+$ guix system container gn/services/GN1-container.scm --share=/home/bnw/server=/srv/http --network
+$ sudo -E $(guix system container gn/services/GN1-container.scm --share=/home/bnw/server=/srv/http --network)
+
+for running the service:
+see included bnw.service
+
+for upgrades:
+$ guix pull
+$ rm -rf /home/bnw/server
+$ guix build bnw
+$ mkdir -p /home/bnw/server/bnw
+$ cp -a $(guix build bnw)/* /home/bnw/server/bnw/
+$ chmod a+w /home/bnw/server -R
diff --git a/gn/services/bnw-container.scm b/gn/services/bnw-container.scm
new file mode 100644
index 0000000..eab431f
--- /dev/null
+++ b/gn/services/bnw-container.scm
@@ -0,0 +1,28 @@
+(use-modules (gnu))
+(use-service-modules base networking web)
+
+(operating-system
+ (host-name "bnw")
+ (timezone "Etc/UTC")
+ (locale "en_US.utf8")
+
+ (bootloader (bootloader-configuration
+ (bootloader grub-bootloader)
+ (target "does-not-matter")))
+ (file-systems %base-file-systems)
+ ;; No firmware for VMs
+ (firmware '())
+
+ (services (list (service dhcp-client-service-type)
+ (service php-fpm-service-type)
+ (service nginx-service-type
+ (nginx-configuration
+ (server-blocks
+ (list
+ (nginx-server-configuration
+ (root "/srv/http/bnw")
+ (locations
+ (list (nginx-php-location)))
+ (listen '("8880"))
+ (ssl-certificate #f)
+ (ssl-certificate-key #f)))))))))
diff --git a/gn/services/bnw.service b/gn/services/bnw.service
new file mode 100644
index 0000000..ec7b3f8
--- /dev/null
+++ b/gn/services/bnw.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=BNW web server
+Wants=guix-daemon.service
+
+[Service]
+Environment="BNW_COMMAND=$(/bin/su -l bnw -c '/var/guix/profiles/per-user/bnw/current-guix/bin/guix system container /home/bnw/guix-bioinformatics/gn/services/bnw-container.scm --share=/home/bnw/server=/srv/http --network')"
+ExecStart=/bin/bash -c '${BNW_COMMAND}'
+
+[Install]
+WantedBy=multi-user.target