Skip to content

Commit 2a66395

Browse files
authored
feat: use app wildcards for apps if configured (coder#4263)
* feat: use app wildcards for apps if configured * feat: relative_path -> subdomain - rename relative_path -> subdomain when referring to apps - migrate workspace_apps.relative_path to workspace_apps.subdomain - upgrade coder/coder terraform module to 0.5.0
1 parent 4f3958c commit 2a66395

File tree

57 files changed

+577
-505
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+577
-505
lines changed

coderd/database/databasefake/databasefake.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2069,7 +2069,7 @@ func (q *fakeQuerier) InsertWorkspaceApp(_ context.Context, arg database.InsertW
20692069
Icon: arg.Icon,
20702070
Command: arg.Command,
20712071
Url: arg.Url,
2072-
RelativePath: arg.RelativePath,
2072+
Subdomain: arg.Subdomain,
20732073
HealthcheckUrl: arg.HealthcheckUrl,
20742074
HealthcheckInterval: arg.HealthcheckInterval,
20752075
HealthcheckThreshold: arg.HealthcheckThreshold,

coderd/database/dump.sql

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Add column relative_path of type bool to workspace_apps
2+
ALTER TABLE "workspace_apps" ADD COLUMN "relative_path" bool NOT NULL DEFAULT false;
3+
4+
-- Set column relative_path to the opposite of subdomain
5+
UPDATE "workspace_apps" SET "relative_path" = NOT "subdomain";
6+
7+
-- Drop column subdomain
8+
ALTER TABLE "workspace_apps" DROP COLUMN "subdomain";
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Add column subdomain of type bool to workspace_apps
2+
ALTER TABLE "workspace_apps" ADD COLUMN "subdomain" bool NOT NULL DEFAULT false;
3+
4+
-- Set column subdomain to the opposite of relative_path
5+
UPDATE "workspace_apps" SET "subdomain" = NOT "relative_path";
6+
7+
-- Drop column relative_path
8+
ALTER TABLE "workspace_apps" DROP COLUMN "relative_path";

coderd/database/models.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaceapps.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ INSERT INTO
2020
icon,
2121
command,
2222
url,
23-
relative_path,
23+
subdomain,
2424
healthcheck_url,
2525
healthcheck_interval,
2626
healthcheck_threshold,

coderd/provisionerdaemons.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ func insertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
828828
String: app.Url,
829829
Valid: app.Url != "",
830830
},
831-
RelativePath: app.RelativePath,
831+
Subdomain: app.Subdomain,
832832
HealthcheckUrl: app.Healthcheck.Url,
833833
HealthcheckInterval: app.Healthcheck.Interval,
834834
HealthcheckThreshold: app.Healthcheck.Threshold,

coderd/telemetry/telemetry.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -528,11 +528,11 @@ func ConvertWorkspaceAgent(agent database.WorkspaceAgent) WorkspaceAgent {
528528
// ConvertWorkspaceApp anonymizes a workspace app.
529529
func ConvertWorkspaceApp(app database.WorkspaceApp) WorkspaceApp {
530530
return WorkspaceApp{
531-
ID: app.ID,
532-
CreatedAt: app.CreatedAt,
533-
AgentID: app.AgentID,
534-
Icon: app.Icon,
535-
RelativePath: app.RelativePath,
531+
ID: app.ID,
532+
CreatedAt: app.CreatedAt,
533+
AgentID: app.AgentID,
534+
Icon: app.Icon,
535+
Subdomain: app.Subdomain,
536536
}
537537
}
538538

@@ -692,11 +692,11 @@ type WorkspaceAgent struct {
692692
}
693693

694694
type WorkspaceApp struct {
695-
ID uuid.UUID `json:"id"`
696-
CreatedAt time.Time `json:"created_at"`
697-
AgentID uuid.UUID `json:"agent_id"`
698-
Icon string `json:"icon"`
699-
RelativePath bool `json:"relative_path"`
695+
ID uuid.UUID `json:"id"`
696+
CreatedAt time.Time `json:"created_at"`
697+
AgentID uuid.UUID `json:"agent_id"`
698+
Icon string `json:"icon"`
699+
Subdomain bool `json:"subdomain"`
700700
}
701701

702702
type WorkspaceBuild struct {

coderd/workspaceagents.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,11 @@ func convertApps(dbApps []database.WorkspaceApp) []codersdk.WorkspaceApp {
494494
apps := make([]codersdk.WorkspaceApp, 0)
495495
for _, dbApp := range dbApps {
496496
apps = append(apps, codersdk.WorkspaceApp{
497-
ID: dbApp.ID,
498-
Name: dbApp.Name,
499-
Command: dbApp.Command.String,
500-
Icon: dbApp.Icon,
497+
ID: dbApp.ID,
498+
Name: dbApp.Name,
499+
Command: dbApp.Command.String,
500+
Icon: dbApp.Icon,
501+
Subdomain: dbApp.Subdomain,
501502
Healthcheck: codersdk.Healthcheck{
502503
URL: dbApp.HealthcheckUrl,
503504
Interval: dbApp.HealthcheckInterval,

codersdk/workspaceapps.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ type WorkspaceApp struct {
2121
// Icon is a relative path or external URL that specifies
2222
// an icon to be displayed in the dashboard.
2323
Icon string `json:"icon,omitempty"`
24+
// Subdomain denotes whether the app should be accessed via a path on the
25+
// `coder server` or via a hostname-based dev URL. If this is set to true
26+
// and there is no app wildcard configured on the server, the app will not
27+
// be accessible in the UI.
28+
Subdomain bool `json:"subdomain"`
2429
// Healthcheck specifies the configuration for checking app health.
2530
Healthcheck Healthcheck `json:"healthcheck"`
2631
Health WorkspaceAppHealth `json:"health"`

dogfood/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
coder = {
44
source = "coder/coder"
5-
version = "0.4.15"
5+
version = "0.5.0"
66
}
77
docker = {
88
source = "kreuzwerker/docker"

examples/templates/aws-ecs-container/main.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ terraform {
66
}
77
coder = {
88
source = "coder/coder"
9-
version = "0.4.15"
9+
version = "0.5.0"
1010
}
1111
}
1212
}
@@ -105,11 +105,11 @@ resource "coder_agent" "coder" {
105105
}
106106

107107
resource "coder_app" "code-server" {
108-
agent_id = coder_agent.coder.id
109-
name = "code-server"
110-
icon = "/icon/code.svg"
111-
url = "http://localhost:13337?folder=/home/coder"
112-
relative_path = true
108+
agent_id = coder_agent.coder.id
109+
name = "code-server"
110+
icon = "/icon/code.svg"
111+
url = "http://localhost:13337?folder=/home/coder"
112+
subdomain = false
113113

114114
healthcheck {
115115
url = "http://localhost:1337/healthz"

examples/templates/aws-linux/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
coder = {
44
source = "coder/coder"
5-
version = "0.4.15"
5+
version = "0.5.0"
66
}
77
}
88
}

examples/templates/aws-windows/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
coder = {
44
source = "coder/coder"
5-
version = "0.4.15"
5+
version = "0.5.0"
66
}
77
}
88
}

examples/templates/azure-linux/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
coder = {
44
source = "coder/coder"
5-
version = "0.4.15"
5+
version = "0.5.0"
66
}
77
azurerm = {
88
source = "hashicorp/azurerm"

examples/templates/do-linux/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
coder = {
44
source = "coder/coder"
5-
version = "0.4.15"
5+
version = "0.5.0"
66
}
77
digitalocean = {
88
source = "digitalocean/digitalocean"

examples/templates/docker-code-server/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
coder = {
44
source = "coder/coder"
5-
version = "0.4.15"
5+
version = "0.5.0"
66
}
77
docker = {
88
source = "kreuzwerker/docker"

examples/templates/docker-image-builds/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ terraform {
33
required_providers {
44
coder = {
55
source = "coder/coder"
6-
version = "0.4.15"
6+
version = "0.5.0"
77
}
88
docker = {
99
source = "kreuzwerker/docker"

examples/templates/docker-with-dotfiles/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ terraform {
99
required_providers {
1010
coder = {
1111
source = "coder/coder"
12-
version = "0.4.15"
12+
version = "0.5.0"
1313
}
1414
docker = {
1515
source = "kreuzwerker/docker"

examples/templates/docker/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
coder = {
44
source = "coder/coder"
5-
version = "0.4.15"
5+
version = "0.5.0"
66
}
77
docker = {
88
source = "kreuzwerker/docker"

0 commit comments

Comments
 (0)