Skip to content

Explain the engine architecture #3595

Closed

Description

@shykes

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.

graph 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
Loading

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
Loading

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
Loading

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
Loading

Activity

  1. added
    area/documentation
    on Oct 28, 2022
  2. added this to the milestone on Nov 3, 2022
  3. modified the milestones: , on Nov 22, 2022
  4. added a commit that references this issue on Dec 1, 2022
  5. mircubed commented on Jun 27, 2023

    @mircubed
    Contributor

    added to linear

  6. removed this from the milestone on Jul 18, 2023
  7. TomChv commented on Aug 10, 2023

    @TomChv
    Member

    @sipsma Should we wait for Zenith before working on this issue?

  8. self-assigned this
    on Aug 31, 2023
  9. TomChv commented on Aug 31, 2023

    @TomChv
    Member

    I'll open a PR based on #3648 today :)

  10. TomChv commented on Sep 1, 2023

    @TomChv
    Member

    @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?

    Excellent initiative, but unfortunately bad timing, after 8 months on this architecture we decided to change it based on user feedback. See #5484

  11. locked and limited conversation to collaborators on Mar 24, 2026
  12. converted this issue into a discussion #12085 on Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/documentation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions