diff options
Diffstat (limited to 'genenetwork-development.scm')
-rw-r--r-- | genenetwork-development.scm | 82 |
1 files changed, 80 insertions, 2 deletions
diff --git a/genenetwork-development.scm b/genenetwork-development.scm index 4912d11..4f1cc4d 100644 --- a/genenetwork-development.scm +++ b/genenetwork-development.scm @@ -34,7 +34,7 @@ ((gnu packages curl) #:select (curl)) ((gnu packages ci) #:select (laminar)) ((gnu packages compression) #:select (gzip)) - ((gnu packages databases) #:select (mariadb virtuoso-ose)) + ((gnu packages databases) #:select (mariadb virtuoso-ose redis)) ((gnu packages gnupg) #:select (guile-gcrypt)) ((gnu packages graphviz) #:select (graphviz)) ((gnu packages guile) #:select (guile-3.0 guile-git guile-zlib)) @@ -1326,6 +1326,84 @@ gn-auth." ;; Port on which virtuoso's SPARQL endpoint is listening (define %virtuoso-sparql-port 9082) + +;; KLUDGE: There's a bug in shepherd with syslogd that has since been fixed in +;; shepherd 1.0.5. See: +;; https://lists.gnu.org/archive/html/emacs-bug-tracker/2025-03/msg00231.html +;; We can't immediately upgrade to shepherd 1.0.5 since it bumps up Python to +;; 3.11. Delete this after upgrading shepherd. +(define-record-type* <redis-configuration> + redis-configuration make-redis-configuration + redis-configuration? + (redis redis-configuration-redis ;file-like + (default redis)) + (bind redis-configuration-bind + (default "127.0.0.1")) + (port redis-configuration-port + (default 6379)) + (working-directory redis-configuration-working-directory + (default "/var/lib/redis")) + (config-file redis-configuration-config-file + (default #f))) + +(define (default-redis.conf bind port working-directory) + (mixed-text-file "redis.conf" + "bind " bind "\n" + "port " (number->string port) "\n" + "dir " working-directory "\n" + "daemonize no\n")) + +(define %redis-accounts + (list (user-group (name "redis") (system? #t)) + (user-account + (name "redis") + (group "redis") + (system? #t) + (comment "Redis server user") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin"))))) + +(define redis-activation + (match-lambda + (($ <redis-configuration> redis bind port working-directory config-file) + #~(begin + (use-modules (guix build utils) + (ice-9 match)) + (let ((user (getpwnam "redis"))) + (mkdir-p #$working-directory) + (chown #$working-directory (passwd:uid user) (passwd:gid user))))))) + +(define redis-shepherd-service + (match-lambda + (($ <redis-configuration> redis bind port working-directory config-file) + (let ((config-file + (or config-file + (default-redis.conf bind port working-directory)))) + (list (shepherd-service + (provision '(redis)) + (documentation "Run the Redis daemon.") + (requirement '(user-processes)) ; Removed syslogd + (actions (list (shepherd-configuration-action config-file))) + (start #~(make-forkexec-constructor + '(#$(file-append redis "/bin/redis-server") + #$config-file) + #:user "redis" + #:group "redis")) + (stop #~(make-kill-destructor)))))))) + +(define custom-redis-service-type + (service-type + (name 'custom-redis) + (extensions + (list (service-extension shepherd-root-service-type + redis-shepherd-service) + (service-extension activation-service-type + redis-activation) + (service-extension account-service-type + (const %redis-accounts)))) + (default-value (redis-configuration)) + (description "Run a customized Redis daemon without syslogd dependency."))) + (operating-system (host-name "genenetwork-development") (timezone "UTC") @@ -1393,7 +1471,7 @@ gn-auth." (socket (forge-ip-socket (ip "127.0.0.1") (port %webhook-port))))) - (service redis-service-type) + (service custom-redis-service-type) (service virtuoso-service-type (virtuoso-configuration (number-of-buffers 4000000) |