unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Environment of a shepherd service
@ 2021-04-11 19:31 edk
  2021-04-13 20:12 ` Edouard Klein
  2021-04-25 15:36 ` Maxime Devos
  0 siblings, 2 replies; 6+ messages in thread
From: edk @ 2021-04-11 19:31 UTC (permalink / raw)
  To: help-guix

Dear fellow Guixers,

I'm trying to create an operating system declaration, so that I can run
a piece of software of mine in a container with =guix system container=.

I wrote a package for the software. The package works: the tests pass
and when the package is installed I can run the software.

I wrote a shepherd service for the software (it's called requisomatic).
I copied the relevant part at the end of the email.

When I run the container script created by =guix system container=, and
get a shell in the container, I can run the software (I added the software's
package to the globally installed packages in the operating-system definition).

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).

I replaced the software invocation in the shepherd service with just
"env", and saw that the whole env in the service is:

PATH=/run/current-system/profile/bin

whereas in the shell I get when I connect to the container, the env
contains many other variables, including a correctly set PYTHONPATH,
which allows the finding of flask.

So I now know why my software is not starting, but my question is:

Why is the PYTHONPATH (and the other env vars, for that matter) not
propagated from the package to the shepherd service by default ? And how
can I make it so ? I would have expected the shepherd service to run
with the global profile active.

Follow up question, can shepherd services be specified to run in a
specific profile ? So that I can have two services with incompatible
dependencies running at the same time in the same operating-system ?

Thanks in advance,

Cheers,

Edouard.



-----extract from my operating-system declaration file-------
(define requisomatic-shepherd-service
  (match-lambda
    (($ <requisomatic-configuration> user group db-file)
     (list (shepherd-service
            (provision '(requisomatic))
            (requirement '(user-processes networking))
            (documentation "Run the requisomatic server")
            (start #~((make-forkexec-constructor
                    ;;   (append
                    ;;    (if db-file
                    ;;      `("env"
                    ;;        ,(string-append "REQUISOMATIC_DB_FILE=" db-file))
                    ;;      '())
                                        '("gunicorn" "requisomatic:app")
                   ;;   '("env")
                       ;;)
                       #:directory (string-append #$requisomatic "/bin/requisomatic/")
                       #:log-file "/var/log/requisomatic.log")))
            (stop #~(make-kill-destructor)))))))


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-27 20:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-11 19:31 Environment of a shepherd service edk
2021-04-13 20:12 ` Edouard Klein
2021-04-13 20:47   ` Jonathan McHugh
2021-04-14  7:59     ` Edouard Klein
2021-04-25 15:36 ` Maxime Devos
2021-04-27 20:03   ` Edouard Klein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).