help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trouble defining a shepherd service


From: Yulran
Subject: Re: trouble defining a shepherd service
Date: Mon, 02 Dec 2024 12:01:25 +0000

Hi,

I hope you found the solution in the meantime, but in case it helps, there's 
also an issue in your service-extension that will indeed cause 'Wrong type to 
apply' or 'Wrong type argument' errors when you try to build your system.

The second argument of service-extension should be a function that takes one 
argument (the configuration passed to openslides-service-type) and returns a 
valid configuration for shepherd-root-service-type, which I assume is a list of 
shepherd services (I only tried with home-shepherd-service-type).

Since you don't need a configuration, you can use 'const' to transform the 
constant list of services into a function. So something like this should work:

--8<---------------cut here---------------start------------->8---
(define-public openslides-service-type
  (service-type
   (name 'openslides)
   (description "The openslides-service-type")
   (extensions
    (list (service-extension shepherd-root-service-type
                             (const (list openslides-shepherd-service)))))
   (default-value '())))
--8<---------------cut here---------------end--------------->8---

On Mon, Oct 21 2024, indieterminacy wrote:

> Hey,
>
> A passing guess is that this line is incorrect:
>
>> #:directory „/var/openslides"
>
> Try redefining it to this incase:
>
> #:directory "/var/openslides"
>
> HTH
>
> On 2024-10-20 23:56, post@bonni.codes wrote:
>> Hello,
>> I am trying to define a shepherd service to add to my system
>> configuration. Reading the docs this is what I came up with:
>> (define openslides-shepherd-service
>>   (shepherd-service
>>    (documentation "Runs the openslides docker-compose.")
>>    (provision '(openslides))
>>    (requirement '(dockerd))
>>    (start #~(make-forkexec-constructor
>>           (list
>>            #$(file-append docker-compose "/bin/docker-compose")
>>            "up")
>>           #:directory „/var/openslides"
>>           #:log-file "/var/log/openslides.log"
>>           #:pid-file "/var/run/openslides.pid"
>>           #:user "openslides")
>>        )
>>    (stop #~(make-kill-destructor))))
>> (define openslides-service-type
>>   (service-type
>>    (name 'openslides)
>>    (description "The openslides-service-type")
>>    (extensions
>>     (list (service-extension shepherd-root-service-type
>> openslides-shepherd-service)))
>>   (default-value '())
>>   ))
>> The service only needs to run the docker-compose program in the
>> directory /var/openslides . There is no need for configuration.
>> If I build my operating system I get the following error:
>> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
>> Wrong type to apply: #<<shepherd-service> documentation: "Runs the
>> openslides docker-compose." provision: (openslides) requirement:
>> (dockerd) one-shot?: #f respawn?: #t respawn-limit: #f
>> respawn-delay: #f free-form: #f start: #<gexp
>> (make-forkexec-constructor (list #<gexp-input #<file-append
>> #<package docker-compose@1.29.2 gnu/packages/docker.scm:109
>> 7ff9068e96e0> "/bin/docker-compose">:out> "up") #:directory
>> "/var/openslides" #:log-file "/var/log/openslides.log" #:pid-file
>> "/var/run/openslides.pid" #:user "openslides")
>> /home/chris/helios-system/config.scm:38:10 7ff8fe625c00> stop:
>> #<gexp (make-kill-destructor)
>> /home/chris/helios-system/config.scm:47:9 7ff8fe625bd0> actions: ()
>> auto-start?: #t modules: ((shepherd service) ((guix build utils)
>> #:hide (delete)) (guix build syscalls))>
>> indicating that there ist something wrong with the value for the
>> start and stop fields.
>> Where am I going wrong?
>> Kind regards
>> bonni
>> -----BEGIN PGP PUBLIC KEY BLOCK-----
>> mDMEZCntaxYJKwYBBAHaRw8BAQdANbpRRBxZVlIewesVvBOh2tlJCuK22g9lL5ZP
>> 9xqJDtS0GGJvbm5pIDxwb3N0QGJvbm5pLmNvZGVzPoiWBBMWCAA+FiEE+lyu2HL6
>> Nk0naPZMGyPeqOa1B/sFAmQp7WsCGwMFCQWjmoAFCwkIBwIGFQoJCAsCBBYCAwEC
>> HgECF4AACgkQGyPeqOa1B/snGAEAzddi9IcK/2EkrqPy2xmmwzLTAexKqZQqa+EE
>> LdtcnNwBANV2xOXW6hASEz0SMz4FEbroFs2kv7by6Wcyy+Fxl0sHuDgEZCntaxIK
>> KwYBBAGXVQEFAQEHQMrBS1fZCE1tuYac2MjA9nZit9leM8zlnyiaY6CdO/cRAwEI
>> B4h+BBgWCAAmFiEE+lyu2HL6Nk0naPZMGyPeqOa1B/sFAmQp7WsCGwwFCQWjmoAA
>> CgkQGyPeqOa1B/v95wD+N/6tRrCX9nqumpXgD3aZ8gcyA1uFSYP02HLyIUIwMY4A
>> /2YC4i2z+G3nzMGBrfID2yXVJg4S4Bby/xOkDxKgYrYD
>> =EEtE
>> -----END PGP PUBLIC KEY BLOCK-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]