Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container.up() #7399

Open
shykes opened this issue May 17, 2024 · 3 comments
Open

Container.up() #7399

shykes opened this issue May 17, 2024 · 3 comments
Labels

Comments

@shykes
Copy link
Contributor

shykes commented May 17, 2024

Problem

When I call a function returning a Container, to run that container as a service, I have to run:

dagger call <MYFUNC> as-service up

That is 2 extra functions in the chain, which is cumbersome. It's common to write a wrapper function that returns a Service, for the sole purpose of typing:

dagger call <MY_OTHER_FUNCTION> up

But now I have to maintain one more function, with another name. It's also cumbersome and feels unnecessary.

Solution

Implement Container.up() as an alias for Container.asService.up().

This is similar to Container.directory() for example, which is a thin wrapper for Container.rootfs().directory().

@shykes shykes added kind/dx Issue affects the Dagger developer experience: cue syntax, APIs, etc DX+ labels May 17, 2024
@jedevc
Copy link
Member

jedevc commented May 17, 2024

Maybe a separate issue, but Service.Up also has some issues (when calling from code, not from the CLI) compared to the previous dag.Host tunneling API we used to use.

Specifically - it doesn't return a Service type, it returns Void. This is a bit annoying, since there's no way to Stop it anymore.

@vito
Copy link
Contributor

vito commented May 17, 2024

@jedevc My understanding is up is specifically designed for the CLI use case, and from code you should just other service APIs like Start and Stop. It's a little weird that the CLI DX creeped into the API, but pragmatism overrode idealism there

@jedevc
Copy link
Member

jedevc commented May 17, 2024

@vito I don't think you can start a tunnel to the host without up though? So if I wanted to start a service, and then make a request to it without needing to start another container.

This was referenced May 17, 2024
@samalba samalba removed the kind/dx Issue affects the Dagger developer experience: cue syntax, APIs, etc label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants