Skip to content

Project Zenith design branch - #5378

Closed
shykes wants to merge 1 commit into
dagger:mainfrom
shykes:zenith
Closed

shykes wants to merge 1 commit into
dagger:mainfrom
shykes:zenith

Conversation

@shykes

@shykes shykes commented Jun 30, 2023 •

Copy link
Copy Markdown
Contributor

This is not even close to finished... It is meant to start discussions on the design and marketing of Project Zenith - an initiative to reinvent the Dagger user experience around the CLI, to make it more approachable.

This draft PR contains the following drafts:

  • README
  • GraphQL schema
  • Examples

Notable design topics

Standalone environments

One important aspect of the Zenith design: you use Dagger/zenith to develop environments, and environments have their own source code repository.

This is different from the current best practice, where environment code is embedded into the repository that will be used as its working directory. From the point of view of the environment's programmer, this mixes data and code. In the Zenith design, the environment's code will be cleanly separate from its data.

Note by @tiborvass (from discord)

To me, it's very analogous to where Dockerfiles are: some dockerized repos will want to have their Dockerfile, while for other repos that don't or are unlikely to ever have Dockerfiles (think source code of gcc or binutils), there are dockerfile-only repos pointing to the external source code.

Note that even if you have a dockerfile you can always build the repo with another dockerfile of your choosing.

I'm not exactly sure how zenith wants to separate in practice the source code and the environment.
What I think is important is that the average user who just wants to contribute to a project and wants to run the jobs, they should have as little friction as possible. So I hope they don't have to specify both the source and the environment.

Note by Conor at Airbyte:

agree with [Tibor] , I think that solving for the "platform engineer" usecase is important, but lots of people just want to bundle their build logic and repository together, so it should be painless for them to do that while also unlocking all of this extra great functionality. I feel like that is totally doable under this proposal, but might just take some iteration to get right

From me addressing the questions:

We have discussed this point at length in person 🙂 Where we have (roughly) settled:

A resounding YES to supporting both the "advanced platform team" and "I just want an easy repeatable way to build and test my simple software" use cases

In theory we could achieve this by supporting both "embedded environment code" and "separate environment code". In practice though: we end up only the embedded pattern, and "separate" falls by the wayside. I know this, because that's the situation we're in today.

Instead we think we can support both use cases by sticking to always separating the environment code, and still making it very easy to support the "easy" use case. Just because "embed in the app repo" is familiar, doesn't mean it's the only possible pattern, or even the best.

One way we can avoid having to specify the env + app source each time, is with git remote mapping.

@shykes shykes changed the title First draft of Zenith README and GraphQL schema Project Zenith design branch Jul 3, 2023
Comment thread zenith/environment.graphqls Outdated

@shykes shykes Jul 3, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am torn on this.

On the one hand, I kind of feel like this should happen in a static, declarative config file (dagger.json in the environment source, basically).

  • I love that I can programmatically load and execute environments from anywhere - github, universe etc.
  • But I also would like an easy way to add, remove and generally manage my extensions without having to write code. For example in a GUI. Also dependency management is a feature that users expect to have access to directly - to wrap it in code would probably be surprising and confusing to most.

On the other hand, a config file will have to choose between being very constrained (no arbitrary pipelines to produce the environment directory), or "shadow code" with an increasingly complex DSL. I don't see a good solution to this.

@sipsma sipsma Jul 3, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or "shadow code" with an increasingly complex DSL.

Agree we should avoid this at all costs. I'm okay with simple stuff like URIs (local://, git://, universe://, etc.), but we should cut it off at that level of complexity.

But I also would like an easy way to add, remove and generally manage my extensions without having to write code. For example in a GUI. Also dependency management is a feature that users expect to have access to directly - to wrap it in code would probably be surprising and confusing to most.

I think this sort of approach would be viable:

  1. The default is to put it in dagger.json, we support only simple URIs as mentioned above.
    • This would either be automatically included in your environment or we could require an explicit WithExtensionsFromConfig type of call. Automatic inclusion is probably my preference atm.
  2. Very advanced use cases that need on-the-fly customization of the extension can still use the explicit WithExtension call.
    • This loses the simplicity of the static config, but it would only be needed for advanced users, so I think it's okay to make that tradeoff.
    • Also, if you ever need to do this, it means you are customizing an environment on the fly, which means you could instead just define a new environment that wraps the existing one with your customizations and then load that from your config instead.

tl;dr default to simple config, explicit withExtension is reserved for unblocking advanced use cases and has a clear pattern for migrating to the simple config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another possibility, perhaps too crazy: what if we assumed that with the advent of LLMs, software tools can be programmed to query and modify code as easily as a config file. And therefore we don’t need a “dumbed down” version of that code in a simplified json dsl: just regular code for everybody.

Maybe too radical?

@vito vito Jul 6, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tl;dr default to simple config, explicit withExtension is reserved for unblocking advanced use cases and has a clear pattern for migrating to the simple config.

Sounds good to me! Placing environments in a static file also seems like it would make codegen easier. If we needed to run the code to just to learn the environments to codegen, you could get stuck if/when the new codegen introduces compiler errors. Compared to dagger.json which can be processed statically.

Can we have commands for modifying the dagger.json file?

Some ideas: (edit: new PR for CLI feedback: #5420)

# shorthand for git:// + setting a branch (otherwise uses remote default branch)
dagger use github.com/vito/progrock@main 

# shorthand for local://./ci
dagger use ./ci # shorthand for local://./ci

# shorthand for universe?
dagger use go

Side note: this is also a good reason to have a lock file of some kind. Might make sense to have dagger.json refs update the same .lock file as everything else.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have static file + code, how do we deal with possible conflicts between them?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have commands for modifying the dagger.json file?

Yeah we currently have dagger project for creating/reading dagger.json, but in the old incarnation of dagger project last year it also had commands for adding/updating dependencies.

Will take a closer look at the CLI PR soon, but at a first glance looks great!

If we have static file + code, how do we deal with possible conflicts between them?

Same way that we deal with conflicts within the static file or conflicts within the code, error out.

I normally don't like two sources of truth, but as long as the static file is the "standard blessed way" and the code approach is reserved for our "Advanced Use Cases FAQ" type of documentation, I think it's totally fine. Express as much as you can in the file, if you are the 1% of users who need more flexibility, write some code too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean to save in dagger.json the environment schema when doing dagger use github.com/vito/progrock@main ? I was thinking that would just save the URL in that file instead.

I get the performance benefits of having a "pre-loaded" schema though but it opens a can of worms in my mind so I need to catch up a bit more to have a more solid idea.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One example for an advanced usage of WithExtension in code is to load extensions dynamically based on what's in the project. Like buildpacks.

Project Zenith is a reinvention of the Dagger UX to make it more approachable.

* Draft README
* Draft GraphQL schema
* Mockup examples

Signed-off-by: Solomon Hykes <[email protected]>
Comment thread zenith/README.md

## What kind of environments?

In theory, any software environment can be daggerized, as long as its individual components can run in a container. In practice, Dagger is most commonly used for non-production environments, such as:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dagger is most commonly used for non-production environments

I don't think this is accurate. Do you mean "outside the application runtime" instead of "non-prod environments"? In practice, a release process or a CI systems are both production environments where Dagger is used.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this means that CI is part of the development environment and that it isn't a separate entity that sits in limbo between development and production.

@vito vito Jul 6, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the disconnect here is that some folks consider CI/CD "production" if it implements (especially if continuously/automated) the "path to production" whereas this comment is more saying that you don't literally use Dagger to run your actual production environments (like the running webserver etc).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most people use "production environment" in a sense that does not include their CI. So I used the terminology in that way. But we can make it work either way, it's not core to Dagger or Zenith. We just need to make sure we use the words in a way that doesn't confuse our audience.

Container
}

type Checks {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type Checks {
type Check {

Comment on lines +65 to +67
type EnvironmentGraph {
# This type will be extended by an environment-specific graphql schema
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give examples on how this can be used?

commands: [ToolCommand!]!
}

type ToolCommand {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bikeshed: simplify to Command?

name: String!
description: String
subcommands: [ToolCommand!]
# invocation?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the question about wether to have it or how to design it? +1 for having it. I also wonder how the environment author can easily run another command from a command.

Comment on lines +22 to +30
// Add env-specific data to the graph,
// for scripting, inspection and composition
WithGraph(
Biome,
Generate,
Nixpkgs,
NixBase,
NixDerivation,
).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before, not sure how this is meant to be used.

Comment on lines +37 to +41
WithWarmup(
func(ctx dagger.Context, area string) error {
Biome.Sync(ctx)
},
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions

Copy link
Copy Markdown
Contributor

This PR was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions Bot closed this Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants