mirror of
https://codeberg.org/hako/Rosenthal.git
synced 2026-03-05 01:15:14 +00:00
services: Add conduit-service-type.
* modules/rosenthal/services/web.scm (<conduit-configuration>): New data type. (conduit-activation, conduit-shepherd): New procedures. (conduit-account, conduit-service-type): New variables.
This commit is contained in:
parent
f32dcf69a8
commit
076a8b192f
@ -27,6 +27,9 @@
|
|||||||
#:export (caddy-configuration
|
#:export (caddy-configuration
|
||||||
caddy-service-type
|
caddy-service-type
|
||||||
|
|
||||||
|
conduit-service-type
|
||||||
|
conduit-configuration
|
||||||
|
|
||||||
forgejo-configuration
|
forgejo-configuration
|
||||||
forgejo-service-type
|
forgejo-service-type
|
||||||
|
|
||||||
@ -153,6 +156,82 @@ reload its configuration file."))
|
|||||||
caddy-shepherd-services)))
|
caddy-shepherd-services)))
|
||||||
(description "")))
|
(description "")))
|
||||||
|
|
||||||
|
|
||||||
|
;;;
|
||||||
|
;;; Conduit
|
||||||
|
;;;
|
||||||
|
|
||||||
|
(define-configuration/no-serialization conduit-configuration
|
||||||
|
(conduit
|
||||||
|
(file-like (file-append conduit-bin "/bin/conduit"))
|
||||||
|
"")
|
||||||
|
(database-path
|
||||||
|
(string "/var/lib/conduit")
|
||||||
|
"")
|
||||||
|
(config
|
||||||
|
file-like
|
||||||
|
"")
|
||||||
|
(auto-start?
|
||||||
|
(boolean #t)
|
||||||
|
"")
|
||||||
|
(shepherd-provision
|
||||||
|
(list-of-symbols '(conduit))
|
||||||
|
"")
|
||||||
|
(shepherd-requirement
|
||||||
|
(list-of-symbols '())
|
||||||
|
""))
|
||||||
|
|
||||||
|
(define conduit-account
|
||||||
|
(list (user-group (name "conduit") (system? #t))
|
||||||
|
(user-account
|
||||||
|
(name "conduit")
|
||||||
|
(group "conduit")
|
||||||
|
(system? #t)
|
||||||
|
(comment "Conduit user")
|
||||||
|
(home-directory "/var/empty"))))
|
||||||
|
|
||||||
|
(define conduit-activation
|
||||||
|
(match-record-lambda <conduit-configuration>
|
||||||
|
(database-path)
|
||||||
|
(with-imported-modules (source-module-closure '((guix build utils)))
|
||||||
|
#~(begin
|
||||||
|
(use-modules '((guix build utils)))
|
||||||
|
(let ((user (getpwnam "conduit"))
|
||||||
|
(directory #$database-path))
|
||||||
|
(mkdir-p directory)
|
||||||
|
(chown directory (passwd:uid user) (passwd:gid user))
|
||||||
|
(chmod directory #o750))))))
|
||||||
|
|
||||||
|
(define conduit-shepherd
|
||||||
|
(match-record-lambda <conduit-configuration>
|
||||||
|
(conduit config auto-start? shepherd-provision shepherd-requirement)
|
||||||
|
(list (shepherd-service
|
||||||
|
(provision shepherd-provision)
|
||||||
|
(requirement `(networking user-processes ,@shepherd-requirement))
|
||||||
|
(start
|
||||||
|
#~(make-forkexec-constructor
|
||||||
|
(list #$conduit)
|
||||||
|
#:user "conduit"
|
||||||
|
#:group "conduit"
|
||||||
|
#:log-file "/var/log/conduit.log"
|
||||||
|
#:environment-variables
|
||||||
|
(list (string-append "CONDUIT_CONFIG=" #$config))))
|
||||||
|
(stop #~(make-kill-destructor))
|
||||||
|
(actions
|
||||||
|
(list (shepherd-configuration-action config)))))))
|
||||||
|
|
||||||
|
(define conduit-service-type
|
||||||
|
(service-type
|
||||||
|
(name 'conduit)
|
||||||
|
(extensions
|
||||||
|
(list (service-extension account-service-type
|
||||||
|
(const conduit-account))
|
||||||
|
(service-extension activation-service-type
|
||||||
|
conduit-activation)
|
||||||
|
(service-extension shepherd-root-service-type
|
||||||
|
conduit-shepherd)))
|
||||||
|
(description "Run Conduit.")))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user