Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Add coder agent start #311

Merged
merged 2 commits into from
Apr 7, 2021
Merged

Add coder agent start #311

merged 2 commits into from
Apr 7, 2021

Conversation

f0ssel
Copy link
Contributor

@f0ssel f0ssel commented Apr 6, 2021

Add a command to allow users to start the environment p2p agent. This command is hidden for now while we experiment.

# Uses CODER_AGENT_TOKEN implicitly
coder agent start https://master.cdr.dev
# Or pass as flag
coder agent start https://master.cdr.dev --token xxx-xxx

@f0ssel f0ssel requested review from kylecarbs and deansheather April 6, 2021 17:29
Copy link
Member

@deansheather deansheather left a comment

Choose a reason for hiding this comment

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

I don't know much about RTC stuff so I'm not the best person to review that portion of this PR

return fmt.Errorf("dial: %w", err)
}
nc := websocket.NetConn(context.Background(), conn, websocket.MessageBinary)
session, err := yamux.Server(nc, nil)
Copy link
Member

Choose a reason for hiding this comment

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

nitpicky since it doesn't really matter since yamux is bidirectional, but this should be a client because it's on the client end of a websocket connection

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kylecarbs Any objections? (since this part is your code)

if err != nil {
return fmt.Errorf("dial: %w", err)
}
nc := websocket.NetConn(context.Background(), conn, websocket.MessageBinary)
Copy link
Member

Choose a reason for hiding this comment

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

I know this is an MVP but there's a lot going on in this command so all of this should move into it's own package (or potentially even it's own repo if we want to use it within our monorepo as well).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pinky promise I'll do that if this ends up being a thing we stick with ;)

@f0ssel f0ssel force-pushed the coder-agent-start branch from 8f6fd70 to 14fc0f8 Compare April 6, 2021 17:51
@f0ssel f0ssel force-pushed the coder-agent-start branch from 14fc0f8 to 8876078 Compare April 6, 2021 18:12
@nathanpotter
Copy link

this is incredible 🎉

token string
)
cmd := &cobra.Command{
Use: "start [coderURL] --token=[token]",

Choose a reason for hiding this comment

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

do you think coderURL should be a --url flag? I'm imagining a case where this is defaulted to coder.com in the future for a SaaS offering. However, I know this isn't ideal for now since the coder agent start cmd would fail without the flags specified, so more so opening this up for discussion. Could potentially default coderURL to coder.com in the future as well if it's not specified as another option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this is suuuper mvp just to get a POC working in coder, a real implementation will follow once we get an idea of how scalable and stable this is.

@f0ssel
Copy link
Contributor Author

f0ssel commented Apr 6, 2021

I can't fix the fmt step because when I run make -j fmt on my env there are no changes. I guess @deansheather would you know what I can do?

@f0ssel f0ssel requested a review from deansheather April 6, 2021 21:17
@f0ssel f0ssel merged commit 739c8e4 into master Apr 7, 2021
@f0ssel f0ssel deleted the coder-agent-start branch April 7, 2021 15:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants