all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Allan Webber <cwebber@dustycloud.org>
To: guix-devel@gnu.org
Subject: Re: (Exposing?) config files and non-start/stop operations
Date: Sun, 20 Nov 2016 16:34:02 -0600	[thread overview]
Message-ID: <878tsdbx2d.fsf@dustycloud.org> (raw)
In-Reply-To: <87a8cuaszg.fsf@dustycloud.org>

Christopher Allan Webber writes:

> Hello,
>
> I'm writing a service for dirvish, and I realized that if I'm following
> current guix service routes, I might not be able to run all the
> operations I need to.  It seems that the current route for Guix is to
> have your service write out a config that more or less becomes part of
> the environment for starting / stopping a daemon via Shepherd.  But what
> if that's not all you need to do?
>
> Aside from just "running as a daemon", plenty of (especially
> applications which manage state) will need to have other commands that
> are unlikely to be run from shepherd.  For example:
>
>  - Initializing a data store.  For example, in dirvish I need to run
>    a command to initialize a "vault" where I will be storing my data.
>  - Manually invoking a garbage collection utility.
>  - Manually invoking an integrity check utility.
>  - Possibly some side effect involving querying the network.
>  - Running schema migrations.
>
> All sorts of things!  Most of them (all?) involve state or side effects,
> but plenty of our most important services will be "state overlords" of
> some type.
>
> So it seems to me that one of two things will be needed... either:
>
>  - Expose the configuration file directly, possibly by putting in
>    `${profile}/etc/foo'
>  - Expose "wrapped" utilities.  For example, instead of invoking
>    "dirvish" directly, I might invoke a wrapped dirvish.

Talking about this with Ricardo Wurmus on irc, the idea of launching
such a utility from shepherd itself came to mind.

So imagine you want to run a tool like this:

  foo-db --config=/path/to/foodb-config.cfg gc --aggressive

It looks like shepherd has an "action" slot/method:

  https://www.gnu.org/software/shepherd/manual/html_node/Slots-of-services.html#Slots-of-services
  https://www.gnu.org/software/shepherd/manual/html_node/Service-Convenience.html#Service-Convenience

So I wonder if we could add additional actions, and do something like
this:

  herd gc foo-db --aggressive

Or, even more lazy (but maybe not as good?):

  herd run-cmd foo-db gc --aggressive

Anyway, either of these examples would call the appropriate command but
implicitly pass in the --config parameter appropriately.

It looks like (gnu services shepherd) doesn't expose the "actions" slot,
but couldn't we do that?

This seems like the right route.  What do others think?

 - Chris

  reply	other threads:[~2016-11-20 22:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-20 18:47 (Exposing?) config files and non-start/stop operations Christopher Allan Webber
2016-11-20 22:34 ` Christopher Allan Webber [this message]
2016-11-21  4:54   ` Chris Marusich
2016-11-21 16:18     ` Christopher Allan Webber
2016-11-21 16:53       ` Christopher Allan Webber
2016-11-22  4:13         ` Chris Marusich
2016-11-22 17:21           ` Christopher Allan Webber
2016-11-22 22:59             ` Ludovic Courtès
2016-11-23  5:28             ` Chris Marusich
2016-11-22 22:57       ` Ludovic Courtès
2016-11-23 22:03         ` Christopher Allan Webber
2016-11-24 13:31           ` Ludovic Courtès
2016-11-25  7:27             ` Christopher Allan Webber
2016-11-26 12:40               ` Chris Marusich
2016-11-27 15:39                 ` Christopher Allan Webber
2016-11-29  3:06                   ` Chris Marusich
2016-11-26 13:47               ` Ricardo Wurmus
2016-11-26 17:40                 ` Ludovic Courtès
2016-11-27 15:47                   ` Christopher Allan Webber
2016-11-26 17:43               ` Ludovic Courtès
2016-11-27 15:48                 ` Christopher Allan Webber
2016-11-21 14:18   ` Ludovic Courtès
2016-11-21 16:21     ` Christopher Allan Webber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878tsdbx2d.fsf@dustycloud.org \
    --to=cwebber@dustycloud.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.