mirror of
				https://codeberg.org/hako/Rosenthal.git
				synced 2025-11-04 11:44:48 +00:00 
			
		
		
		
	services: Add iocaine.
* modules/rosenthal/services/web.scm (<iocaine-configuration>): New data type. (iocaine-etc, iocaine-shepherd-service): New procedures. (iocaine-accounts, iocaine-service-type): New variables.
This commit is contained in:
		
							parent
							
								
									62cbfda23d
								
							
						
					
					
						commit
						0050466952
					
				@ -26,6 +26,9 @@
 | 
			
		||||
            forgejo-configuration
 | 
			
		||||
            forgejo-service-type
 | 
			
		||||
 | 
			
		||||
            iocaine-service-type
 | 
			
		||||
            iocaine-configuration
 | 
			
		||||
 | 
			
		||||
            jellyfin-configuration
 | 
			
		||||
            jellyfin-service-type
 | 
			
		||||
 | 
			
		||||
@ -241,6 +244,91 @@ reload its configuration file."))
 | 
			
		||||
   (default-value (forgejo-configuration))
 | 
			
		||||
   (description "Run Forgejo.")))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
;;;
 | 
			
		||||
;;; Iocaine
 | 
			
		||||
;;;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
(define-configuration/no-serialization iocaine-configuration
 | 
			
		||||
  (iocaine
 | 
			
		||||
   (file-like iocaine/dolly)
 | 
			
		||||
   "")
 | 
			
		||||
  (config
 | 
			
		||||
   file-object
 | 
			
		||||
   "")
 | 
			
		||||
  (log-file
 | 
			
		||||
   (string "/var/log/iocaine.log")
 | 
			
		||||
   "")
 | 
			
		||||
  (shepherd-provision
 | 
			
		||||
   (list-of-symbols '(iocaine))
 | 
			
		||||
   "")
 | 
			
		||||
  (shepherd-requirement
 | 
			
		||||
   (list-of-symbols '(loopback))
 | 
			
		||||
   "")
 | 
			
		||||
  (auto-start?
 | 
			
		||||
   (boolean #t)
 | 
			
		||||
   ""))
 | 
			
		||||
 | 
			
		||||
(define iocaine-accounts
 | 
			
		||||
  (list (user-group (name "iocaine") (system? #t))
 | 
			
		||||
        (user-account
 | 
			
		||||
          (name "iocaine")
 | 
			
		||||
          (group "iocaine")
 | 
			
		||||
          (system? #t)
 | 
			
		||||
          (comment "Iocaine user")
 | 
			
		||||
          (home-directory "/var/empty"))))
 | 
			
		||||
 | 
			
		||||
(define iocaine-etc
 | 
			
		||||
  (match-record-lambda <iocaine-configuration>
 | 
			
		||||
      (config)
 | 
			
		||||
    `(("iocaine/iocaine.toml" ,config))))
 | 
			
		||||
 | 
			
		||||
(define iocaine-shepherd-service
 | 
			
		||||
  (match-record-lambda <iocaine-configuration>
 | 
			
		||||
      (iocaine log-file shepherd-provision shepherd-requirement auto-start?)
 | 
			
		||||
    (list (shepherd-service
 | 
			
		||||
            (provision shepherd-provision)
 | 
			
		||||
            (requirement (cons 'user-processes shepherd-requirement))
 | 
			
		||||
            (start
 | 
			
		||||
             #~(make-forkexec-constructor
 | 
			
		||||
                (list #$(file-append iocaine "/bin/iocaine")
 | 
			
		||||
                      "--config-file" "/etc/iocaine/iocaine.toml")
 | 
			
		||||
                #:user "iocaine"
 | 
			
		||||
                #:group "iocaine"
 | 
			
		||||
                #:log-file #$log-file))
 | 
			
		||||
            (stop #~(make-kill-destructor))
 | 
			
		||||
            (actions
 | 
			
		||||
             (list (shepherd-configuration-action "/etc/iocaine/iocaine.toml")
 | 
			
		||||
                   (shepherd-action
 | 
			
		||||
                     (name 'test)
 | 
			
		||||
                     (documentation "Test Iocaine configuration file.")
 | 
			
		||||
                     (procedure
 | 
			
		||||
                      #~(lambda (pid)
 | 
			
		||||
                          (if pid
 | 
			
		||||
                              (begin
 | 
			
		||||
                                (invoke #$(file-append iocaine "/bin/iocaine")
 | 
			
		||||
                                        "--config-file" "/etc/iocaine/iocaine.toml"
 | 
			
		||||
                                        "test")
 | 
			
		||||
                                (display "Service iocaine has been asked to \
 | 
			
		||||
test its configuration file."))
 | 
			
		||||
                              (display "Service iocaine is not running.")))))))
 | 
			
		||||
            (auto-start? auto-start?)))))
 | 
			
		||||
 | 
			
		||||
(define iocaine-service-type
 | 
			
		||||
  (service-type
 | 
			
		||||
   (name 'iocaine)
 | 
			
		||||
   (extensions
 | 
			
		||||
    (list (service-extension account-service-type
 | 
			
		||||
                             (const iocaine-accounts))
 | 
			
		||||
          (service-extension etc-service-type
 | 
			
		||||
                             iocaine-etc)
 | 
			
		||||
          (service-extension shepherd-root-service-type
 | 
			
		||||
                             iocaine-shepherd-service)
 | 
			
		||||
          (service-extension log-rotation-service-type
 | 
			
		||||
                             (compose list iocaine-configuration-log-file))))
 | 
			
		||||
   (description "")))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
;;;
 | 
			
		||||
;;; Jellyfin
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user