Skip to content

Commit ac99525

Browse files
committed
progress
1 parent eae4c3a commit ac99525

23 files changed

+232
-48
lines changed

coderd/apidoc/docs.go

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

coderd/apidoc/swagger.json

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

coderd/database/dbfake/databasefake.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5206,6 +5206,7 @@ func (q *fakeQuerier) InsertWorkspaceProxy(_ context.Context, arg database.Inser
52065206
Name: arg.Name,
52075207
DisplayName: arg.DisplayName,
52085208
Icon: arg.Icon,
5209+
DerpEnabled: arg.DerpEnabled,
52095210
TokenHashedSecret: arg.TokenHashedSecret,
52105211
CreatedAt: arg.CreatedAt,
52115212
UpdatedAt: arg.UpdatedAt,
@@ -5223,6 +5224,7 @@ func (q *fakeQuerier) RegisterWorkspaceProxy(_ context.Context, arg database.Reg
52235224
if p.ID == arg.ID {
52245225
p.Url = arg.Url
52255226
p.WildcardHostname = arg.WildcardHostname
5227+
p.DerpEnabled = arg.DerpEnabled
52265228
p.UpdatedAt = database.Now()
52275229
q.workspaceProxies[i] = p
52285230
return p, nil

coderd/database/dump.sql

Lines changed: 18 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ALTER TABLE workspace_proxies
2+
DROP CONSTRAINT workspace_proxies_region_id_unique,
3+
DROP COLUMN region_id,
4+
DROP COLUMN derp_enabled;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ALTER TABLE workspace_proxies
2+
-- adding a serial to a table without a default value will be filled as you
3+
-- would expect
4+
ADD COLUMN region_id serial NOT NULL,
5+
ADD COLUMN derp_enabled boolean NOT NULL DEFAULT true,
6+
ADD CONSTRAINT workspace_proxies_region_id_unique UNIQUE (region_id);

coderd/database/models.go

Lines changed: 2 additions & 0 deletions
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: 32 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/proxies.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,22 @@ INSERT INTO
77
name,
88
display_name,
99
icon,
10+
derp_enabled,
1011
token_hashed_secret,
1112
created_at,
1213
updated_at,
1314
deleted
1415
)
1516
VALUES
16-
($1, '', '', $2, $3, $4, $5, $6, $7, false) RETURNING *;
17+
($1, '', '', $2, $3, $4, $5, $6, $7, $8, false) RETURNING *;
1718

1819
-- name: RegisterWorkspaceProxy :one
1920
UPDATE
2021
workspace_proxies
2122
SET
22-
url = @url,
23-
wildcard_hostname = @wildcard_hostname,
23+
url = @url :: text,
24+
wildcard_hostname = @wildcard_hostname :: text,
25+
derp_enabled = @derp_enabled :: boolean,
2426
updated_at = Now()
2527
WHERE
2628
id = @id

coderd/database/unique_constraint.go

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

codersdk/deployment.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ when required by your organization's security policy.`,
657657
Value: &c.DERP.Server.Enable,
658658
Group: &deploymentGroupNetworkingDERP,
659659
YAML: "enable",
660+
Annotations: clibase.Annotations{}.Mark(annotationExternalProxies, "true"),
660661
},
661662
{
662663
Name: "DERP Server Region ID",
@@ -667,6 +668,7 @@ when required by your organization's security policy.`,
667668
Value: &c.DERP.Server.RegionID,
668669
Group: &deploymentGroupNetworkingDERP,
669670
YAML: "regionID",
671+
// Does not apply to external proxies as this value is generated.
670672
},
671673
{
672674
Name: "DERP Server Region Code",
@@ -677,6 +679,7 @@ when required by your organization's security policy.`,
677679
Value: &c.DERP.Server.RegionCode,
678680
Group: &deploymentGroupNetworkingDERP,
679681
YAML: "regionCode",
682+
// Does not apply to external proxies as we use the proxy name.
680683
},
681684
{
682685
Name: "DERP Server Region Name",
@@ -687,6 +690,7 @@ when required by your organization's security policy.`,
687690
Value: &c.DERP.Server.RegionName,
688691
Group: &deploymentGroupNetworkingDERP,
689692
YAML: "regionName",
693+
// Does not apply to external proxies as we use the proxy name.
690694
},
691695
{
692696
Name: "DERP Server STUN Addresses",
@@ -703,10 +707,12 @@ when required by your organization's security policy.`,
703707
Description: "An HTTP URL that is accessible by other replicas to relay DERP traffic. Required for high availability.",
704708
Flag: "derp-server-relay-url",
705709
Env: "CODER_DERP_SERVER_RELAY_URL",
706-
Annotations: clibase.Annotations{}.Mark(annotationEnterpriseKey, "true"),
707710
Value: &c.DERP.Server.RelayURL,
708711
Group: &deploymentGroupNetworkingDERP,
709712
YAML: "relayURL",
713+
Annotations: clibase.Annotations{}.
714+
Mark(annotationEnterpriseKey, "true").
715+
Mark(annotationExternalProxies, "true"),
710716
},
711717
{
712718
Name: "DERP Config URL",

codersdk/workspaceproxy.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ type ProxyHealthReport struct {
4646
}
4747

4848
type WorkspaceProxy struct {
49-
ID uuid.UUID `json:"id" format:"uuid" table:"id"`
50-
Name string `json:"name" table:"name,default_sort"`
51-
Icon string `json:"icon" table:"icon"`
49+
ID uuid.UUID `json:"id" format:"uuid" table:"id"`
50+
Name string `json:"name" table:"name,default_sort"`
51+
DisplayName string `json:"display_name" table:"display_name"`
52+
Icon string `json:"icon" table:"icon"`
5253
// Full url including scheme of the proxy api url: https://us.example.com
5354
URL string `json:"url" table:"url"`
5455
// WildcardHostname with the wildcard for subdomain based app hosting: *.us.example.com
5556
WildcardHostname string `json:"wildcard_hostname" table:"wildcard_hostname"`
57+
DerpEnabled bool `json:"derp_enabled" table:"derp_enabled"`
5658
CreatedAt time.Time `json:"created_at" format:"date-time" table:"created_at"`
5759
UpdatedAt time.Time `json:"updated_at" format:"date-time" table:"updated_at"`
5860
Deleted bool `json:"deleted" table:"deleted"`

0 commit comments

Comments
 (0)