Repository navigation
Description
This is something that has come up quite a bit recently, mostly in the context of #8800 (comment), but also around #8766 (comment).
Even when we have a way to configure engine settings, there are a collection of user configurations that would make sense to apply per client-session, without requiring a whole engine reload. For example:
- Registry settings - today these are all only in the engine config, but it makes it very difficult to make changes (requiring an engine restart), and also you might want different settings per project you're on. It also means if you're using a shared engine, the shared engine has to be configured with potentially project-specific registries.
- Build resources/limits (from Dagger build - resource requests/limits #4196) - for the same reasons.
- Network configurations (including DNS, CAs, private git clones, etc).
I think we should have a different config file for these - it's annoying to have a different file, but the other alternatives don't feel right:
engine.json/engine.tomlisn't the right place, since it's global to the engine.dagger.jsonisn't the right place, since those are committed to git, and these settings are potentially machine specific - they might be committed to git, but they shouldn't need to be.- Config environment variables in the client session could work, but these are trickier to document and use (no
.schema.jsonfor example). Also more difficult to copy around and manage. - Explicit flags to every dagger command will end up very repetitive (and potentially even have confidential data then in the case of network configs).
So I'm proposing a dagger.settings.json (let the bikeshedding begin, no idea what the actual file should be). There are two potential places to load this from - one in ~/.config/dagger/dagger.settings.json, next to engine.json from #8800, and another next to dagger.json in your dagger module. We would try and load from both. This allows you to have machine specific, and also project specific session configs.
From the core-api POV, we could introduce a Engine.configure API, which would take optional args that would configure the entire session it's been made from (similar in style to Module.serve, it modifies session state).
Activity
grouville commentedon Nov 20, 2024
I suppose that this is where the user would reference the path to the mounting of the
.gitconfig, for session-scoped git rewrite rules: #7787. Basically, the clean implementation to solve all those issuesshykes commentedon Dec 6, 2024
Agree we need a config file for Dagger that is environment specific, in other words: not
dagger.json, and not checked into the app repo. Somewhere in the home directory makes sense.Really not a fan of further splitting that into multiple files for multiple components, because: a) it's more concepts to learn for the user b) these concepts are mostly implementation details, c) the separation between components might actually move, eg. engine-wide config might shrink over time as we move more to the client. Then there's A config file for my modules #6323 ... would that go in yet another file? Much much better IMO to settle on a single filename and schema, and get on with it.
TLDR: we need one config file for engine, session, and module defaults.
A consequence of this is that yes, we will probably deprecate
engine.jsonin the future (#8800) - we'll just move it to a field in a broader config schema.jedevc commentedon Dec 7, 2024
I'm not sure I agree.
There are 3 very distinct "types" of config, written by different "personas":
dagger call/dagger shellsession. And are written by the person who is actually using dagger (regardless of whether they're a module author, or an operator).I agree some of these might shift over time - but having just one config file makes more more complex dagger deployments significantly harder to manage, which is what this issue is attempting to solve (see #8766). The need is really to move away from just one config for everything, and to have it split up.
If it's just one file, suppose I want a shared engine - with separate configs, my infra team can configure the gc and security of the engine, while my devs can configure the mirrors + network configuration - I think having one config file makes that hard, right?
Potentially having one configuration file and allowing multiple copies could be a way forward? But I still think we then struggle to explain why some settings behave fundamentally differently than others - keeping those in another file helps clarify that.
Edit: if we have a segmented config file with
"module","engine"and"client"keys, to larger config objects, I think that's actually probably okay (as long as we allow multiple configs). But we should definitely not mix top-level keys. I still think it's a bit easier to document and explain with separate config files - but I think I'd defer to whatever users want in this case: as long as we can easily explain the behavior of what we're doing, it's good!shykes commentedon Dec 7, 2024
Module config
I'm torn on this part because it's got a foot in each world:
In a way this is like a more strongly typed
.envfile. Maybe there's a way to piggyback on the convention of .env files?Client & engine config
The distinction between engine config and client config assumes that the current split between client and engine is fixed and permanent, and enshrines it. In reality it is not. See #7466 for the direction we want to go, ie: tighter coupling of cli & engine until they are no longer distinguishable.
Since cli & engine are tightly coupled, "shared engine" is really "shared (engine+cli)".
The operator simply writes their own config for their engine+cli.
This abstraction is already leaking, see for example your suggestion to allow a
engine.jsonon the client machine. The lifecycle of the client & engine are not cleanly decoupled in the way that would justify a strong separation of config files, and never will be.TLDR: client & engine config should be combined. Module config requires more discussion to know where it should go.
jedevc commentedon Dec 7, 2024
No disagreement on where we want the architecture to be eventually - but while we're not there, having the config fused together will be confusing - but I do think we can resolve that in docs.
If that is what we want, one fused file, some settings requiring a manual engine restart, and some not, then should we rename the existing
engine.jsonto something else before we release, to avoid needing to rename it later on?benkeil commentedon Jan 21, 2025
I would love to just use the
Client.connectfunction to specify engine specific stuff.or maybe even better
So I can get my certificates from somewhere (or what ever properties the dagger engine may need) and configure the engine. If the configuration does not match,
connectcreates a new engine with the configured settings.