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

feat: Add workspace application support#1773

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
kylecarbs merged 42 commits intomainfromapps
Jun 4, 2022
Merged

feat: Add workspace application support#1773

kylecarbs merged 42 commits intomainfromapps
Jun 4, 2022

Conversation

kylecarbs
Copy link
Member

@kylecarbskylecarbs commentedMay 26, 2022
edited
Loading

This adds applications as a property to a workspace agent.

The resource is added to the Terraform provider here:
coder/terraform-provider-coder#17

Apps will be opened in the dashboard or via the CLI
withcoder open <name>. Ifcommand is specified, a
terminal will appear locally and on the web. Iftarget
is specified, the browser will open to an exposed instance
of that target.

  • Fix odd context cancel bug on HTTP transport.

This adds apps as a property to a workspace agent.The resource is added to the Terraform provider here:coder/terraform-provider-coder#17Apps will be opened in the dashboard or via the CLIwith `coder open <name>`. If `command` is specified, aterminal will appear locally and in the web. If `target`is specified, the browser will open to an exposed instanceof that target.
Abstracting coderd into an interface added misdirection becausethe interface was never intended to be fulfilled outside of a singleimplementation.This lifts the abstraction, and attaches all handlers to a root structnamed `*coderd.API`.
@kylecarbskylecarbs self-assigned thisMay 26, 2022
CREATE TABLE workspace_apps (
id uuid NOT NULL,
created_at timestamp with time zone NOT NULL,
agent_id uuid NOT NULL REFERENCES workspace_agents (id) ON DELETE CASCADE,
Copy link
Contributor

Choose a reason for hiding this comment

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

I am unfamiliar with the schemas around agents, builds, templates, etc. I would expect this to be in lifecycle with the template version I think. Why is it related to the agent?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Workspace agents are attached to a template version too.

A workspace build can contain different agents than a template version based on variables. This introduces complexity for us, but is something we unfortunately need to account for.

f0ssel reacted with thumbs up emoji
@kylecarbskylecarbs linked an issueMay 31, 2022 that may beclosed by this pull request
3 tasks
This is such an intermittent race it's difficult to track,but regardless this is an improvement to the code.
This is such an intermittent race it's difficult to track,but regardless this is an improvement to the code.
This is such an intermittent race it's difficult to track,but regardless this is an improvement to the code.
This is such an intermittent race it's difficult to track,but regardless this is an improvement to the code.
oneof auth {
string token = 8;
string instance_id = 9;
string token = 9;
Copy link
Contributor

Choose a reason for hiding this comment

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

generally a no-no to change field indexes. Any reason it's particularly important here?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It's nicer structurally from my perspective.

message App {
string name = 1;
string command = 2;
string url = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

in the terraform provider docs you say command or url but not both can be set. Should these be in aoneof?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Good catch.

@spikecurtis
Copy link
Contributor

At a high level, I also find it a bit strange that we're having coderd negotiate a WebRTC connection to the agent, when the agent isalready connected to coderd via the channel that the ICE negotiation is happening over.

@spikecurtis
Copy link
Contributor

Also missing from this (Ok if being tracked in other issues)

  • Authorization checks
  • Support forcommand apps (I'm only seeing URLs supported)

@kylecarbskylecarbs marked this pull request as ready for reviewJune 3, 2022 05:11
@kylecarbskylecarbs requested a review froma team as acode ownerJune 3, 2022 05:11
// %40 is the encoded character of the @ symbol. VS Code Web does
// not handle character encoding properly, so it's safe to assume
// other applications might not as well.
r.Route("/%40{user}/{workspacename}/apps/{workspaceapp}", apps)
Copy link
Contributor

@greyscaledgreyscaledJun 3, 2022
edited
Loading

Choose a reason for hiding this comment

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

Does this mean the FE should useencodeURIComponent ?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent

so like

async (username: string, workspaceName: string, app: string) => {  encoderURIComponent(`/api/v0/@{username}/{workspaceName}/apps/{app}`)}

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Nah, we should always use@ if possible. This is an edge-case for where certain client-side applications don't handle the@ properly.

greyscaled reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

TY!!

// metadata in error pages.
func WithAPIResponse(ctx context.Context, apiResponse APIResponse) context.Context {
return context.WithValue(ctx, apiResponseContextKey{}, apiResponse)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this dev url specific or is it related to the error message discussion from yesterday?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Specific to this. The content can be changed trivially too, I intentionally kept it pretty loose while we hash that out.

presleyp reacted with thumbs up emoji
export interface WorkspaceApp {
readonly id: string
readonly name: string
readonly command?: string
Copy link
Contributor

Choose a reason for hiding this comment

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

what iscommand?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It will open a command inside of a terminal. I'll be opening a subsequent PR to add this in. An issue to track it is here:#2023

Copy link
Contributor

@greyscaledgreyscaled left a comment

Choose a reason for hiding this comment

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

FE = ✔️

Copy link
Contributor

@f0sself0ssel left a comment

Choose a reason for hiding this comment

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

Generally everything looks good to me. A little long so I didn't dive in super hard but the tests seem to cover enough bases to give me confidence.

@@ -51,7 +51,7 @@ This can be represented by the following truth table, where Y represents *positi

## Example Permissions

- `+site.*.*.read`: allowed to perform the `read` action against all objects of type `devurl` in a given Coder deployment.
Copy link
Contributor

Choose a reason for hiding this comment

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

kill it with 🔥

readonly name: string
readonly command?: string
readonly access_url?: string
readonly icon: string
Copy link
Contributor

Choose a reason for hiding this comment

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

Is icon required? I think we should have some fallback on the frontend and make it optional in terraform if it isn't already.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

True. I shall fix

@kylecarbskylecarbs merged commit013f028 intomainJun 4, 2022
@kylecarbskylecarbs deleted the apps branchJune 4, 2022 20:13
kylecarbs added a commit that referenced this pull requestJun 10, 2022
* feat: Add app supportThis adds apps as a property to a workspace agent.The resource is added to the Terraform provider here:coder/terraform-provider-coder#17Apps will be opened in the dashboard or via the CLIwith `coder open <name>`. If `command` is specified, aterminal will appear locally and in the web. If `target`is specified, the browser will open to an exposed instanceof that target.* Compare fields in apps test* Update Terraform provider to use relative path* Add some basic structure for routing* chore: Remove interface from coderd and lift API surfaceAbstracting coderd into an interface added misdirection becausethe interface was never intended to be fulfilled outside of a singleimplementation.This lifts the abstraction, and attaches all handlers to a root structnamed `*coderd.API`.* Add basic proxy logic* Add proxying based on path* Add app proxying for wildcards* Add wsconncache* fix: Race when writing to a closed pipeThis is such an intermittent race it's difficult to track,but regardless this is an improvement to the code.* fix: Race when writing to a closed pipeThis is such an intermittent race it's difficult to track,but regardless this is an improvement to the code.* fix: Race when writing to a closed pipeThis is such an intermittent race it's difficult to track,but regardless this is an improvement to the code.* fix: Race when writing to a closed pipeThis is such an intermittent race it's difficult to track,but regardless this is an improvement to the code.* Add workspace route proxying endpoint- Makes the workspace conn cache concurrency-safe- Reduces unnecessary open checks in `peer.Channel`- Fixes the use of a temporary context when dialing a workspace agent* Add embed errors* chore: Refactor site to improve testingIt was difficult to develop this package due to theembed build tag being mandatory on the tests. The logicto test doesn't require any embedded files.* Add test for error handler* Remove unused access url* Add RBAC tests* Fix dial agent syntax* Fix linting errors* Fix gen* Fix icon required* Adjust migration number* Fix proxy error status code* Fix empty db lookup
@kylecarbskylecarbs mentioned this pull requestJun 16, 2022
4 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@spikecurtisspikecurtisspikecurtis left review comments

@f0sself0sself0ssel approved these changes

+2 more reviewers

@presleyppresleyppresleyp left review comments

@greyscaledgreyscaledgreyscaled left review comments

Reviewers whose approvals may not affect merge requirements
Assignees

@kylecarbskylecarbs

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Workspace apps support
5 participants
@kylecarbs@spikecurtis@presleyp@greyscaled@f0ssel

[8]ページ先頭

©2009-2025 Movatter.jp