Skip to content

Commit cf8a48b

Browse files
committed
Merge branch 'main' of https://github.com/coder/coder into spike/9165-provisioner-filesystem
2 parents 9762158 + 4bed492 commit cf8a48b

File tree

119 files changed

+1712
-1456
lines changed

Some content is hidden

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

119 files changed

+1712
-1456
lines changed

.github/workflows/ci.yaml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,13 @@ jobs:
188188
189189
- name: Install Protoc
190190
run: |
191-
# protoc must be in lockstep with our dogfood Dockerfile or the
192-
# version in the comments will differ. This is also defined in
193-
# security.yaml
194-
set -x
195-
cd dogfood
196-
DOCKER_BUILDKIT=1 docker build . --target proto -t protoc
197-
protoc_path=/usr/local/bin/protoc
198-
docker run --rm --entrypoint cat protoc /tmp/bin/protoc > $protoc_path
199-
chmod +x $protoc_path
200-
protoc --version
191+
mkdir -p /tmp/proto
192+
pushd /tmp/proto
193+
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
194+
unzip protoc.zip
195+
cp -r ./bin/* /usr/local/bin
196+
cp -r ./include /usr/local/bin/include
197+
popd
201198
202199
- name: make gen
203200
run: "make --output-sync -j -B gen"
@@ -532,15 +529,27 @@ jobs:
532529
- name: Setup Terraform
533530
uses: ./.github/actions/setup-tf
534531

535-
- name: Install Nix
536-
uses: DeterminateSystems/nix-installer-action@v4
532+
- name: go install tools
533+
run: |
534+
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
535+
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
536+
go install golang.org/x/tools/cmd/goimports@latest
537+
go install github.com/mikefarah/yq/v4@v4.30.6
538+
go install github.com/golang/mock/mockgen@v1.6.0
537539
538-
- name: Run the Magic Nix Cache
539-
uses: DeterminateSystems/magic-nix-cache-action@v2
540+
- name: Install Protoc
541+
run: |
542+
mkdir -p /tmp/proto
543+
pushd /tmp/proto
544+
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
545+
unzip protoc.zip
546+
cp -r ./bin/* /usr/local/bin
547+
cp -r ./include /usr/local/bin/include
548+
popd
540549
541550
- name: Build
542551
run: |
543-
nix-shell --command 'make -B site/out/index.html'
552+
make -B site/out/index.html
544553
545554
- run: pnpm playwright:install
546555
working-directory: site

agent/agent.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ func (a *agent) run(ctx context.Context) error {
678678
network := a.network
679679
a.closeMutex.Unlock()
680680
if network == nil {
681-
network, err = a.createTailnet(ctx, manifest.AgentID, manifest.DERPMap, manifest.DisableDirectConnections)
681+
network, err = a.createTailnet(ctx, manifest.AgentID, manifest.DERPMap, manifest.DERPForceWebSockets, manifest.DisableDirectConnections)
682682
if err != nil {
683683
return xerrors.Errorf("create tailnet: %w", err)
684684
}
@@ -701,8 +701,10 @@ func (a *agent) run(ctx context.Context) error {
701701
if err != nil {
702702
a.logger.Error(ctx, "update tailnet addresses", slog.Error(err))
703703
}
704-
// Update the DERP map and allow/disallow direct connections.
704+
// Update the DERP map, force WebSocket setting and allow/disallow
705+
// direct connections.
705706
network.SetDERPMap(manifest.DERPMap)
707+
network.SetDERPForceWebSockets(manifest.DERPForceWebSockets)
706708
network.SetBlockEndpoints(manifest.DisableDirectConnections)
707709
}
708710

@@ -756,14 +758,15 @@ func (a *agent) trackConnGoroutine(fn func()) error {
756758
return nil
757759
}
758760

759-
func (a *agent) createTailnet(ctx context.Context, agentID uuid.UUID, derpMap *tailcfg.DERPMap, disableDirectConnections bool) (_ *tailnet.Conn, err error) {
761+
func (a *agent) createTailnet(ctx context.Context, agentID uuid.UUID, derpMap *tailcfg.DERPMap, derpForceWebSockets, disableDirectConnections bool) (_ *tailnet.Conn, err error) {
760762
network, err := tailnet.NewConn(&tailnet.Options{
761-
ID: agentID,
762-
Addresses: a.wireguardAddresses(agentID),
763-
DERPMap: derpMap,
764-
Logger: a.logger.Named("net.tailnet"),
765-
ListenPort: a.tailnetListenPort,
766-
BlockEndpoints: disableDirectConnections,
763+
ID: agentID,
764+
Addresses: a.wireguardAddresses(agentID),
765+
DERPMap: derpMap,
766+
DERPForceWebSockets: derpForceWebSockets,
767+
Logger: a.logger.Named("net.tailnet"),
768+
ListenPort: a.tailnetListenPort,
769+
BlockEndpoints: disableDirectConnections,
767770
})
768771
if err != nil {
769772
return nil, xerrors.Errorf("create tailnet: %w", err)

cli/netcheck_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestNetcheck(t *testing.T) {
3131
require.NoError(t, json.Unmarshal(b, &report))
3232

3333
assert.True(t, report.Healthy)
34-
require.Len(t, report.Regions, 1+5) // 1 built-in region + 5 STUN regions by default
34+
require.Len(t, report.Regions, 1+1) // 1 built-in region + 1 test-managed STUN region
3535
for _, v := range report.Regions {
3636
require.Len(t, v.NodeReports, len(v.Region.Nodes))
3737
}

cli/templatecreate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func (r *RootCmd) templateCreate() *clibase.Cmd {
134134
VersionID: job.ID,
135135
DefaultTTLMillis: ptr.Ref(defaultTTL.Milliseconds()),
136136
FailureTTLMillis: ptr.Ref(failureTTL.Milliseconds()),
137-
InactivityTTLMillis: ptr.Ref(inactivityTTL.Milliseconds()),
137+
TimeTilDormantMillis: ptr.Ref(inactivityTTL.Milliseconds()),
138138
DisableEveryoneGroupAccess: disableEveryone,
139139
}
140140

cli/templateedit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (r *RootCmd) templateEdit() *clibase.Cmd {
104104
Weeks: restartRequirementWeeks,
105105
},
106106
FailureTTLMillis: failureTTL.Milliseconds(),
107-
InactivityTTLMillis: inactivityTTL.Milliseconds(),
107+
TimeTilDormantMillis: inactivityTTL.Milliseconds(),
108108
AllowUserCancelWorkspaceJobs: allowUserCancelWorkspaceJobs,
109109
AllowUserAutostart: allowUserAutostart,
110110
AllowUserAutostop: allowUserAutostop,

cli/templateedit_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ func TestTemplateEdit(t *testing.T) {
752752
ctr.DefaultTTLMillis = nil
753753
ctr.RestartRequirement = nil
754754
ctr.FailureTTLMillis = nil
755-
ctr.InactivityTTLMillis = nil
755+
ctr.TimeTilDormantMillis = nil
756756
})
757757

758758
// Test the cli command with --allow-user-autostart.
@@ -798,7 +798,7 @@ func TestTemplateEdit(t *testing.T) {
798798
assert.Equal(t, template.AllowUserAutostart, updated.AllowUserAutostart)
799799
assert.Equal(t, template.AllowUserAutostop, updated.AllowUserAutostop)
800800
assert.Equal(t, template.FailureTTLMillis, updated.FailureTTLMillis)
801-
assert.Equal(t, template.InactivityTTLMillis, updated.InactivityTTLMillis)
801+
assert.Equal(t, template.TimeTilDormantMillis, updated.TimeTilDormantMillis)
802802
})
803803

804804
t.Run("BlockedNotEntitled", func(t *testing.T) {
@@ -892,7 +892,7 @@ func TestTemplateEdit(t *testing.T) {
892892
assert.Equal(t, template.AllowUserAutostart, updated.AllowUserAutostart)
893893
assert.Equal(t, template.AllowUserAutostop, updated.AllowUserAutostop)
894894
assert.Equal(t, template.FailureTTLMillis, updated.FailureTTLMillis)
895-
assert.Equal(t, template.InactivityTTLMillis, updated.InactivityTTLMillis)
895+
assert.Equal(t, template.TimeTilDormantMillis, updated.TimeTilDormantMillis)
896896
})
897897
t.Run("Entitled", func(t *testing.T) {
898898
t.Parallel()
@@ -990,7 +990,7 @@ func TestTemplateEdit(t *testing.T) {
990990
assert.Equal(t, template.AllowUserAutostart, updated.AllowUserAutostart)
991991
assert.Equal(t, template.AllowUserAutostop, updated.AllowUserAutostop)
992992
assert.Equal(t, template.FailureTTLMillis, updated.FailureTTLMillis)
993-
assert.Equal(t, template.InactivityTTLMillis, updated.InactivityTTLMillis)
993+
assert.Equal(t, template.TimeTilDormantMillis, updated.TimeTilDormantMillis)
994994
})
995995
})
996996
}

cli/testdata/coder_list_--output_json.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"ttl_ms": 28800000,
5353
"last_used_at": "[timestamp]",
5454
"deleting_at": null,
55-
"locked_at": null,
55+
"dormant_at": null,
5656
"health": {
5757
"healthy": true,
5858
"failing_agents": []

cli/testdata/coder_server_--help.golden

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ backed by Tailscale and WireGuard.
172172
URL to fetch a DERP mapping on startup. See:
173173
https://tailscale.com/kb/1118/custom-derp-servers/.
174174

175+
--derp-force-websockets bool, $CODER_DERP_FORCE_WEBSOCKETS
176+
Force clients and agents to always use WebSocket to connect to DERP
177+
relay servers. By default, DERP uses `Upgrade: derp`, which may cause
178+
issues with some reverse proxies. Clients may automatically fallback
179+
to WebSocket if they detect an issue with `Upgrade: derp`, but this
180+
does not work in all situations.
181+
175182
--derp-server-enable bool, $CODER_DERP_SERVER_ENABLE (default: true)
176183
Whether to enable or disable the embedded DERP relay server.
177184

cli/testdata/server-config.yaml.golden

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ networking:
136136
# this change has been made, but new connections will still be proxied regardless.
137137
# (default: <unset>, type: bool)
138138
blockDirect: false
139+
# Force clients and agents to always use WebSocket to connect to DERP relay
140+
# servers. By default, DERP uses `Upgrade: derp`, which may cause issues with some
141+
# reverse proxies. Clients may automatically fallback to WebSocket if they detect
142+
# an issue with `Upgrade: derp`, but this does not work in all situations.
143+
# (default: <unset>, type: bool)
144+
forceWebSockets: false
139145
# URL to fetch a DERP mapping on startup. See:
140146
# https://tailscale.com/kb/1118/custom-derp-servers/.
141147
# (default: <unset>, type: string)

0 commit comments

Comments
 (0)