Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: Add workspace proxy enterprise cli commands#7176

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 21 commits intomainfromdreamteam/external_proxy_cli_cmd_rebased
Apr 20, 2023

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedApr 17, 2023
edited
Loading

What this does

Makes a cli command to spin up external workspace proxies!

coder proxy create # ....coder proxy server # ....

This is just the start to get an external workspace proxy up for manual testing/verification. All commands are hidden right now by default.

Future work

  • Exchange app key over api route, not flags.
  • Better way to make proxy only options?
  • Workspace proxy implementations (healthz, apis, etc)
  • /terminal endpoint requires static files.

Testing/Development

This givesdevelop.sh an option--use-proxy which will spin up the devserver with an external workspace proxy. This should allow easier manual validation.

develop.sh --use-proxy -- --experiments="*,moons"

Features added to make this work

  • Cli command to delete workspace proxies.
  • clibase.Optionset filter to filter out options that do not pertain to the workspace proxy.
  • Ability to hard codeapp-security-key

Logs

Run./develop.sh --use-proxy

======================================================================                                                                ====            Coder is now running in development mode.           ====                  API:    http://localhost:3000                 ====                  API:    http://127.0.0.1:3000                 ====                  API:    http://192.168.1.17:3000              ====                  API:    http://192.168.1.18:3000              ====                  API:    http://172.25.0.1:3000                ====                  Web UI: http://localhost:8080                 ====                  Web UI: http://127.0.0.1:8080                 ====                  Web UI: http://192.168.1.17:8080              ====                  Web UI: http://192.168.1.18:8080              ====                  Web UI: http://172.25.0.1:8080                ====                  Proxy:  http://localhost:3010                 ====                  Proxy:  http://127.0.0.1:3010                 ====                  Proxy:  http://192.168.1.17:3010              ====                  Proxy:  http://192.168.1.18:3010              ====                  Proxy:  http://172.25.0.1:3010                ====                                                                ====      Use ./scripts/coder-dev.sh to talk to this instance!      ====       alias cdr=/home/steven/go/src/github.com/cdr/coder/scripts/coder-dev.sh              ======================================================================

Video

Peek.2023-04-18.10-02.webm

Add primary access urlInclude app security keyAdd output formats for registering a proxyFix formatsAdd cli cmd to get app security keyAdd deleting proxiesfeat: Allow workspace proxy spawn in develop.shMake genImport ordeRQuote shell varImportsFix lintTabs vs spacesremove unused commandFix compile and make genFix slim cmd to include extra proxy cmdsImport orderImport orderFix commentFix compile with name
@EmyrkEmyrk marked this pull request as ready for reviewApril 18, 2023 13:58
cli/server.go Outdated
Comment on lines 624 to 633
ifcfg.Dangerous.DevAppSecurityKey.Value()!="" {
_,err:=workspaceapps.KeyFromString(cfg.Dangerous.DevAppSecurityKey.Value())
iferr!=nil {
returnxerrors.Errorf("invalid dev app security key: %w",err)
}
err=tx.UpsertAppSecurityKey(ctx,cfg.Dangerous.DevAppSecurityKey.Value())
iferr!=nil {
returnxerrors.Errorf("Insert dev app security key: %w",err)
}
}
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This will be removed when we do this over an authenticated api

Comment on lines 60 to 101
opts.Add(
// Options only for external workspace proxies

clibase.Option{
Name:"Proxy Session Token",
Description:"Authentication token for the workspace proxy to communicate with coderd.",
Flag:"proxy-session-token",
Env:"CODER_PROXY_SESSION_TOKEN",
YAML:"proxySessionToken",
Default:"",
Value:&proxySessionToken,
Group:&externalProxyOptionGroup,
Hidden:false,
},

clibase.Option{
Name:"Coderd (Primary) Access URL",
Description:"URL to communicate with coderd. This should match the access URL of the Coder deployment.",
Flag:"primary-access-url",
Env:"CODER_PRIMARY_ACCESS_URL",
YAML:"primaryAccessURL",
Default:"",
Value:&primaryAccessURL,
Group:&externalProxyOptionGroup,
Hidden:false,
},

// TODO: Make sure this is kept secret. Idk if a flag is the best option
clibase.Option{
Name:"App Security Key",
Description:"App security key used for decrypting/verifying app tokens sent from coderd.",
Flag:"app-security-key",
Env:"CODER_APP_SECURITY_KEY",
YAML:"appSecurityKey",
Default:"",
Value:&appSecuritYKey,
Group:&externalProxyOptionGroup,
Hidden:false,
Annotations: clibase.Annotations{}.Mark("secret","true"),
},
)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Until we have a better way, this is how I add options that areonly for workspace proxies.

@EmyrkEmyrk requested a review fromkylecarbsApril 18, 2023 15:03
r.InitClient(client),
),
Handler:func(inv*clibase.Invocation)error {
if!(primaryAccessURL.Scheme=="http"||primaryAccessURL.Scheme=="https") {
Copy link
Member

Choose a reason for hiding this comment

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

it'd be nice if deployment options can be validated in the option definition but alas

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Interesting idea...@ammario ? Is a "Validate" func field on an option reasonable?

Copy link
Member

Choose a reason for hiding this comment

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

I like that idea

Emyrk reacted with heart emoji
Comment on lines +149 to +153
clibase.Option{
Flag:"only-token",
Description:"Only print the token. This is useful for scripting.",
Value:clibase.BoolOf(&onlyToken),
},
Copy link
Member

Choose a reason for hiding this comment

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

Honestly seems unnecessary given you support JSON output.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This is so easy:

proxy_session_token=$(coder proxy create --only-token)

Otherwise I need to chain with jq. This is just nice imo.

deansheather reacted with thumbs up emoji
Copy link
Collaborator

@sreyasreya left a comment

Choose a reason for hiding this comment

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

Honestly LGTM 👍

@EmyrkEmyrk merged commita5a5c4d intomainApr 20, 2023
@EmyrkEmyrk deleted the dreamteam/external_proxy_cli_cmd_rebased branchApril 20, 2023 14:48
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsApr 20, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@ammarioammarioammario left review comments

@deansheatherdeansheatherdeansheather left review comments

@sreyasreyasreya approved these changes

@kylecarbskylecarbsAwaiting requested review from kylecarbs

Assignees

@EmyrkEmyrk

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@Emyrk@sreya@ammario@deansheather

[8]ページ先頭

©2009-2025 Movatter.jp