aboutsummaryrefslogtreecommitdiff
path: root/containers/db-container.scm
diff options
context:
space:
mode:
authorzsloan2022-09-06 13:32:28 -0500
committerGitHub2022-09-06 13:32:28 -0500
commitd8bc7067b717e0b680d98b7cfcbc26c758a109bf (patch)
tree571677761b3bb464b55bc19f208f135214321ad2 /containers/db-container.scm
parente0626f40d8fe4fa83daba52b82c1b459b34b1849 (diff)
parent363237f11b9eb14f52c4f0c43a931c99c827c496 (diff)
downloadgenenetwork2-d8bc7067b717e0b680d98b7cfcbc26c758a109bf.tar.gz
Merge branch 'testing' into feature/generalize_tables
Diffstat (limited to 'containers/db-container.scm')
-rw-r--r--containers/db-container.scm38
1 files changed, 38 insertions, 0 deletions
diff --git a/containers/db-container.scm b/containers/db-container.scm
new file mode 100644
index 00000000..848b6a2e
--- /dev/null
+++ b/containers/db-container.scm
@@ -0,0 +1,38 @@
+;;; This file describes a Guix system container to run the database
+;;; services required by genenetwork2 locally on your own
+;;; machine. This is to allow a purely offline development setup for
+;;; hacking on genenetwork2. To build and run the container, use
+;;; db-container.sh.
+
+(use-modules (gnu)
+ (gnu packages databases)
+ (gnu services databases))
+
+(define %mariadb-state-directory
+ "/var/lib/mysql")
+
+(define set-permissions-gexp
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+
+ ;; Set ownership of mariadb state directory.
+ (let ((user (getpw "mysql")))
+ (for-each (lambda (file)
+ (chown file (passwd:uid user) (passwd:gid user)))
+ (find-files #$%mariadb-state-directory #:directories? #t))))))
+
+(operating-system
+ (host-name "genenetwork2")
+ (timezone "Etc/UTC")
+ (locale "en_US.utf8")
+ (bootloader (bootloader-configuration
+ (bootloader grub-bootloader)
+ (targets (list "does-not-matter"))))
+ (file-systems %base-file-systems)
+ (services (cons* (service mysql-service-type)
+ (service redis-service-type)
+ (simple-service 'set-permissions
+ activation-service-type
+ set-permissions-gexp)
+ %base-services)))