* trouble defining a shepherd service
@ 2024-10-20 21:56 post
2024-10-21 7:52 ` indieterminacy
0 siblings, 1 reply; 3+ messages in thread
From: post @ 2024-10-20 21:56 UTC (permalink / raw)
To: help-guix
[-- Attachment #1: Type: text/plain, Size: 2740 bytes --]
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-----
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: trouble defining a shepherd service
2024-10-20 21:56 trouble defining a shepherd service post
@ 2024-10-21 7:52 ` indieterminacy
2024-12-02 12:01 ` Yulran
0 siblings, 1 reply; 3+ messages in thread
From: indieterminacy @ 2024-10-21 7:52 UTC (permalink / raw)
To: post; +Cc: help-guix
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-----
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: trouble defining a shepherd service
2024-10-21 7:52 ` indieterminacy
@ 2024-12-02 12:01 ` Yulran
0 siblings, 0 replies; 3+ messages in thread
From: Yulran @ 2024-12-02 12:01 UTC (permalink / raw)
To: post; +Cc: help-guix
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-----
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-03 0:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-20 21:56 trouble defining a shepherd service post
2024-10-21 7:52 ` indieterminacy
2024-12-02 12:01 ` Yulran
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.