Repository navigation
Description
Problem
In the documentation, we talk about the Dagger Engine in these terms:
Using the SDK, your program opens a new session to a Dagger Engine: either by connecting to an existing engine, or by provisioning one on-the-fly.
Loadinggraph LR; subgraph program["Your Go program"] lib["Go library"] end engine["Dagger Engine"] oci["OCI container runtime"] subgraph A["your build pipeline"] A1[" "] -.-> A2[" "] -.-> A3[" "] end subgraph B["your test pipeline"] B1[" "] -.-> B2[" "] -.-> B3[" "] -.-> B4[" "] end subgraph C["your deployment pipeline"] C1[" "] -.-> C2[" "] -.-> C3[" "] -.-> C4[" "] end lib -..-> engine -..-> oci -..-> A1 & B1 & C1
But, to quote "ADustyOldMuffin" on discord:
no where is it defined what the "engine" is. You get pictures of where it's at in the flow (attached). This makes me think something is running constantly listening for calls
And "peder2911" says:
Just one quick question that could perhaps be elaborated a bit in the documentation: Dagger has a client-server architecture, but I am not sure that I understand what the implications of this are. Is it possible, for example, to have a build agent running remotely somewhere that you can then run stuff on with a client? When is the server started?
This is because we made a decision to be intentionally vague about the architecture of the engine, in anticipation of upcoming changes to its architecture. Better not to draw attention on an architecture that will change soon anyway.
I think this was the right decision: most developers can get started with Dagger without needing to know the internals of the Dagger Engine architecture.
However, if someone asks for more details (as "ADustOldMuffin" did), we should have a clear answer with clearly defined terminology. Then we can use that terminology to more productively discuss future improvements.
Solution
I propose using the following terminology to explain the current architecture of the engine:
graph LR;
subgraph program["Your program"]
lib["Dagger SDK"]
end
subgraph engine
router["API router"]
runner["runner"]
end
oci["OCI container runtime"]
subgraph A["your build pipeline"]
A1[" "] -.-> A2[" "] -.-> A3[" "]
end
subgraph B["your test pipeline"]
B1[" "] -.-> B2[" "] -.-> B3[" "] -.-> B4[" "]
end
subgraph C["your deploy pipeline"]
C1[" "] -.-> C2[" "] -.-> C3[" "] -.-> C4[" "]
end
lib -..-> router -..-> runner -..-> oci -..-> A1 & B1 & C1
The engine is made of 2 parts: an API router, and a runner.
- The router serves API queries and dispatches individual operations to the runner.
- The runner talks to your OCI runtime to execute actual operations. This is basically a buildkit daemon + some glue
The router currently runs on the client machine, whereas the runner is on a worker machine that will run the containers. This could be the same machine but typically isn’t.
Current architecture with client-side router:
graph LR;
subgraph clientMachineA["Client machine"]
clientA["client library or CLI"]
routerA["API router"]
clientA --> routerA
end
subgraph clientMachineB["Client machine"]
clientB["client library or CLI"]
routerB["API router"]
clientB --> routerB
end
subgraph clientMachineC["Client machine"]
clientC["client library or CLI"]
routerC["API router"]
clientC --> routerC
end
subgraph workerMachine["Worker machine"]
runner["Runner"]
oci["OCI runtime"]
end
routerA & routerB & routerC -..-> runner --> oci
The SDK takes care of running both router and runner - each in a different way because they run in different machines and have different lifecycles.
Eventually we will move the router to a server-side component, tightly coupled and co-located with the runner. This will be shipped as an OCI image which you will be able to provision, administer and upgrade yourself to your heart’s content. This requires non-trivial engineering work, in order to make the API router accessible remotely, and multi-tenant.
Future architecture with server-side router:
graph LR;
subgraph clientMachineA["Client machine"]
clientA["client library or CLI"]
end
subgraph clientMachineB["Client machine"]
clientB["client library or CLI"]
end
subgraph clientMachineC["Client machine"]
clientC["client library or CLI"]
end
subgraph workerMachine["Worker machine"]
subgraph engine["Dagger Engine"]
router["API router"]
runner["Runner"]
end
oci["OCI runtime"]
end
clientA & clientB & clientC -..-> router --> runner --> oci
Activity
docs: Add FAQ entries for Dagger Engine
mircubed commentedon Jun 27, 2023
added to linear
TomChv commentedon Aug 10, 2023
@sipsma Should we wait for Zenith before working on this issue?
TomChv commentedon Aug 31, 2023
I'll open a PR based on #3648 today :)
TomChv commentedon Sep 1, 2023
@gerhard PR closed, we shall wait for all the discussion to be resolved before continuing this one, should I move it back to
stuck? Or just in the backlog?