[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Environment of a shepherd service
From: |
Maxime Devos |
Subject: |
Re: Environment of a shepherd service |
Date: |
Sun, 25 Apr 2021 17:36:58 +0200 |
User-agent: |
Evolution 3.34.2 |
edk@beaver-labs.com schreef op zo 11-04-2021 om 21:31 [+0200]:
> Dear fellow Guixers,
> [...]
> But, when I try to run it with shepherd, it fails because it can't find
> flask (a dependency of the software, which I've put as a
> propagated-input, and is indeed installed in the container).
Propagated inputs can be inconvenient at times. I would advise
looking where requisomatic is referring to flask, and replacing
flask --> (string-append (assoc-ref inputs "flask") "/bin/flask")
using substitute*.
> But, when I try to run it with shepherd, it fails because it can't find
> flask (a dependency of the software, which I've put as a
> propagated-input, and is indeed installed in the container).
> [...]
Some advice (warning: I'm not familiar with gunicorn or requisomatic at all).
>
> -----extract from my operating-system declaration file-------
> (define requisomatic-shepherd-service
> ([...] (shepherd-service
> [...]
(documentation "Run the requisomatic server")
> (start #~((make-forkexec-constructor
> ;; (append
> ;; (if db-file
> ;; `("env"
> ;; ,(string-append "REQUISOMATIC_DB_FILE="
> db-file))
> ;; '())
> '("gunicorn" "requisomatic:app")
Normally, services refer by absolute path to the binary to run, and not rely
on the PATH (the latter would require polluting the system profile).
Idiomatically, one would write
'(#$(file-append gunicorn "/bin/gunicorn")
#$(file-append requisomatic) "/wherever/the/binary/is")
> #:directory (string-append #$requisomatic
> "/bin/requisomatic/")
Why are you changing the working directory to
(string-append #$requisomatic "/bin/requisomatic/"), and why is
"/bin/requisomatic" a
directory and not an executable? Is that a gunicorn thing?
> Why is the PYTHONPATH (and the other env vars, for that matter) not
> propagated from the package to the shepherd service by default ?
How is the shepherd service supposed to automagically know which packages
to include in the environment variables?
> And how can I make it so ?
Use the #:environment-variables option, see e.g. bitlbee-shepherd-service
Or create a wrapper. See e.g. wrapped-dbus-service.
> Follow up question, can shepherd services be specified to run in a
> specific profile ?
IIUC, currently shepherd services aren't run in *any* profile at all.
It would be useful to have a function manifest->environment-gexp though.
> So that I can have two services with incompatible
> dependencies running at the same time in the same operating-system ?
Yes, it with "dependencies" you mean packages, and not other services.
Greetings,
Maxime.
signature.asc
Description: This is a digitally signed message part