* Proposal: auto-instantiate services with a default value
@ 2018-01-09 9:05 Ludovic Courtès
2018-01-09 10:16 ` ng0
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Ludovic Courtès @ 2018-01-09 9:05 UTC (permalink / raw)
To: Guix-devel
Hello Guix!
Currently on GuixSD, users have to explicitly specify all the services
they need, recursively. For instance, if you add:
(service rottlog-service-type)
to your ‘services’ field, you also need to add:
(service mcron-service-type)
because the former happens to require the latter. If you don’t do that,
you get an error message (see ‘fold-services’ in (gnu services)), and
then you go back to your config and add that line.
This was intentional, but it’s annoying, especially when considering
higher-level, complex services—imagine a MediaGoblin service: you
wouldn’t want to manually specify a dozen services that, to you, are an
implementation detail you’d rather ignore.
We discussed some time ago the possibility to automatically instantiate
services. Now that service types have default value, I think it’s a
viable approach: if a service is required, and *if* it provides a
default value, then we can automatically instantiate it.
So in the example above, you’d just specify ‘rottlog-service-type’ and
an ‘mcron-service-type’ would be automatically added if it’s not already
there.
How does that sound?
Ludo’.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Proposal: auto-instantiate services with a default value
2018-01-09 9:05 Proposal: auto-instantiate services with a default value Ludovic Courtès
@ 2018-01-09 10:16 ` ng0
2018-01-09 10:59 ` Danny Milosavljevic
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: ng0 @ 2018-01-09 10:16 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Guix-devel
[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]
Ludovic Courtès transcribed 1.3K bytes:
> Hello Guix!
>
> Currently on GuixSD, users have to explicitly specify all the services
> they need, recursively. For instance, if you add:
>
> (service rottlog-service-type)
>
> to your ‘services’ field, you also need to add:
>
> (service mcron-service-type)
>
> because the former happens to require the latter. If you don’t do that,
> you get an error message (see ‘fold-services’ in (gnu services)), and
> then you go back to your config and add that line.
>
> This was intentional, but it’s annoying, especially when considering
> higher-level, complex services—imagine a MediaGoblin service: you
> wouldn’t want to manually specify a dozen services that, to you, are an
> implementation detail you’d rather ignore.
>
> We discussed some time ago the possibility to automatically instantiate
> services. Now that service types have default value, I think it’s a
> viable approach: if a service is required, and *if* it provides a
> default value, then we can automatically instantiate it.
>
> So in the example above, you’d just specify ‘rottlog-service-type’ and
> an ‘mcron-service-type’ would be automatically added if it’s not already
> there.
>
> How does that sound?
>
> Ludo’.
Sounds alright to me.
--
GnuPG: A88C8ADD129828D7EAC02E52E22F9BBFEE348588
GnuPG: https://c.n0.is/ng0_pubkeys/tree/keys
WWW: https://n0.is/a/ :: https://ea.n0.is
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Proposal: auto-instantiate services with a default value
2018-01-09 9:05 Proposal: auto-instantiate services with a default value Ludovic Courtès
2018-01-09 10:16 ` ng0
@ 2018-01-09 10:59 ` Danny Milosavljevic
2018-01-09 12:25 ` Ludovic Courtès
2018-01-10 6:56 ` Chris Marusich
2018-01-20 23:26 ` Ludovic Courtès
3 siblings, 1 reply; 8+ messages in thread
From: Danny Milosavljevic @ 2018-01-09 10:59 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Guix-devel
Hi Ludo,
On Tue, 09 Jan 2018 10:05:34 +0100
ludo@gnu.org (Ludovic Courtès) wrote:
> We discussed some time ago the possibility to automatically instantiate
> services. Now that service types have default value, I think it’s a
> viable approach: if a service is required, and *if* it provides a
> default value, then we can automatically instantiate it.
>
> So in the example above, you’d just specify ‘rottlog-service-type’ and
> an ‘mcron-service-type’ would be automatically added if it’s not already
> there.
Yes, as long as there's a way for the user to easily see what it instantiated (in the running system).
Also, that means that the instantiated mcron-service would automatically get a rottlog entry even though the mcron-service-types's default job list is empty, right ?
In that case it would be nice to be able to (optionally) override this mcron-service by a custom mcron-service in /etc/config.scm but retain the modified configuration with the implicit job in it. Is that possible?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Proposal: auto-instantiate services with a default value
2018-01-09 10:59 ` Danny Milosavljevic
@ 2018-01-09 12:25 ` Ludovic Courtès
2018-01-09 13:42 ` Ricardo Wurmus
0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2018-01-09 12:25 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: Guix-devel
Hi,
Danny Milosavljevic <dannym@scratchpost.org> skribis:
> On Tue, 09 Jan 2018 10:05:34 +0100
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> We discussed some time ago the possibility to automatically instantiate
>> services. Now that service types have default value, I think it’s a
>> viable approach: if a service is required, and *if* it provides a
>> default value, then we can automatically instantiate it.
>>
>> So in the example above, you’d just specify ‘rottlog-service-type’ and
>> an ‘mcron-service-type’ would be automatically added if it’s not already
>> there.
>
> Yes, as long as there's a way for the user to easily see what it instantiated (in the running system).
‘operating-system-services’ would still only lists services that have
been explicitly specified, but ‘guix system extension-graph’ would show
everything.
> Also, that means that the instantiated mcron-service would automatically get a rottlog entry even though the mcron-service-types's default job list is empty, right ?
Correct.
> In that case it would be nice to be able to (optionally) override this mcron-service by a custom mcron-service in /etc/config.scm but retain the modified configuration with the implicit job in it. Is that possible?
Sure, the current way to do things (which is to explicitly list rottlog
*and* mcron) would remain valid, and you could pass your own mcron
config this way.
Ludo’.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Proposal: auto-instantiate services with a default value
2018-01-09 12:25 ` Ludovic Courtès
@ 2018-01-09 13:42 ` Ricardo Wurmus
2018-01-09 20:42 ` Ludovic Courtès
0 siblings, 1 reply; 8+ messages in thread
From: Ricardo Wurmus @ 2018-01-09 13:42 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Guix-devel
Ludovic Courtès <ludo@gnu.org> writes:
>> Also, that means that the instantiated mcron-service would automatically get a rottlog entry even though the mcron-service-types's default job list is empty, right ?
>
> Correct.
>
>> In that case it would be nice to be able to (optionally) override this mcron-service by a custom mcron-service in /etc/config.scm but retain the modified configuration with the implicit job in it. Is that possible?
>
> Sure, the current way to do things (which is to explicitly list rottlog
> *and* mcron) would remain valid, and you could pass your own mcron
> config this way.
If a user already had an mcron service with a custom configuration,
it would still be extended as needed by adding the rottlog-service — or
am I mistaken?
I think auto-instantiation is great when it all shows up with “guix
system extension-graph” and users can thus figure out why certain
services were instantiated unexpectedly.
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Proposal: auto-instantiate services with a default value
2018-01-09 13:42 ` Ricardo Wurmus
@ 2018-01-09 20:42 ` Ludovic Courtès
0 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2018-01-09 20:42 UTC (permalink / raw)
To: Ricardo Wurmus; +Cc: Guix-devel
Ricardo Wurmus <rekado@elephly.net> skribis:
> Ludovic Courtès <ludo@gnu.org> writes:
>
>>> Also, that means that the instantiated mcron-service would automatically get a rottlog entry even though the mcron-service-types's default job list is empty, right ?
>>
>> Correct.
>>
>>> In that case it would be nice to be able to (optionally) override this mcron-service by a custom mcron-service in /etc/config.scm but retain the modified configuration with the implicit job in it. Is that possible?
>>
>> Sure, the current way to do things (which is to explicitly list rottlog
>> *and* mcron) would remain valid, and you could pass your own mcron
>> config this way.
>
> If a user already had an mcron service with a custom configuration,
> it would still be extended as needed by adding the rottlog-service — or
> am I mistaken?
Yes. Basically an existing currently-working configuration will still
work exactly the same.
The novelty is that one would now be able to omit services that are
indirectly needed.
> I think auto-instantiation is great when it all shows up with “guix
> system extension-graph” and users can thus figure out why certain
> services were instantiated unexpectedly.
Yes. Speaking of which, it’d be great to have an interactive view of
service folding (d3.js?)…
Ludo’.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Proposal: auto-instantiate services with a default value
2018-01-09 9:05 Proposal: auto-instantiate services with a default value Ludovic Courtès
2018-01-09 10:16 ` ng0
2018-01-09 10:59 ` Danny Milosavljevic
@ 2018-01-10 6:56 ` Chris Marusich
2018-01-20 23:26 ` Ludovic Courtès
3 siblings, 0 replies; 8+ messages in thread
From: Chris Marusich @ 2018-01-10 6:56 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Guix-devel
[-- Attachment #1: Type: text/plain, Size: 1815 bytes --]
ludo@gnu.org (Ludovic Courtès) writes:
> Hello Guix!
>
> Currently on GuixSD, users have to explicitly specify all the services
> they need, recursively. For instance, if you add:
>
> (service rottlog-service-type)
>
> to your ‘services’ field, you also need to add:
>
> (service mcron-service-type)
>
> because the former happens to require the latter. If you don’t do that,
> you get an error message (see ‘fold-services’ in (gnu services)), and
> then you go back to your config and add that line.
>
> This was intentional, but it’s annoying, especially when considering
> higher-level, complex services—imagine a MediaGoblin service: you
> wouldn’t want to manually specify a dozen services that, to you, are an
> implementation detail you’d rather ignore.
>
> We discussed some time ago the possibility to automatically instantiate
> services. Now that service types have default value, I think it’s a
> viable approach: if a service is required, and *if* it provides a
> default value, then we can automatically instantiate it.
>
> So in the example above, you’d just specify ‘rottlog-service-type’ and
> an ‘mcron-service-type’ would be automatically added if it’s not already
> there.
>
> How does that sound?
This sounds great to me! It would be quite convenient.
What will we do in the situation where two services S and T both require
a service U, but S and T require different configurations of U? In this
case, it's clear that either S or T (or both) requires a non-default
configuration of U, so maybe this is outside the scope of what you've
proposed.
Is it intended that if I wish to modify a service's dependent services,
I would continue to do so via the usual methods (e.g., modify-services)?
--
Chris
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Proposal: auto-instantiate services with a default value
2018-01-09 9:05 Proposal: auto-instantiate services with a default value Ludovic Courtès
` (2 preceding siblings ...)
2018-01-10 6:56 ` Chris Marusich
@ 2018-01-20 23:26 ` Ludovic Courtès
3 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2018-01-20 23:26 UTC (permalink / raw)
To: Guix-devel
Hello!
ludo@gnu.org (Ludovic Courtès) skribis:
> We discussed some time ago the possibility to automatically instantiate
> services. Now that service types have default value, I think it’s a
> viable approach: if a service is required, and *if* it provides a
> default value, then we can automatically instantiate it.
I’ve implemented this here:
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=d466b1fc8221a6224fe7ded53a828f9c29ed9457
Feedback welcome!
Ludo’.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-01-20 23:26 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-09 9:05 Proposal: auto-instantiate services with a default value Ludovic Courtès
2018-01-09 10:16 ` ng0
2018-01-09 10:59 ` Danny Milosavljevic
2018-01-09 12:25 ` Ludovic Courtès
2018-01-09 13:42 ` Ricardo Wurmus
2018-01-09 20:42 ` Ludovic Courtès
2018-01-10 6:56 ` Chris Marusich
2018-01-20 23:26 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
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).