Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Jun 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
bdfa61a
feat: Add app support
kylecarbs May 6, 2022
8b2f6c4
Merge branch 'main' into devurls
kylecarbs May 15, 2022
e3cf488
Merge branch 'main' into devurls
kylecarbs May 24, 2022
e3ff8ad
Compare fields in apps test
kylecarbs May 24, 2022
b6e1ea6
Update Terraform provider to use relative path
kylecarbs May 25, 2022
430cfe7
Add some basic structure for routing
kylecarbs May 26, 2022
6ef781c
chore: Remove interface from coderd and lift API surface
kylecarbs May 26, 2022
f70dd17
Merge branch 'routeclean' into devurls
kylecarbs May 26, 2022
0805250
Merge branch 'main' into devurls
kylecarbs May 26, 2022
934b1ff
Add basic proxy logic
kylecarbs May 26, 2022
866eeed
Add proxying based on path
kylecarbs May 27, 2022
4b73034
Merge branch 'main' into apps
kylecarbs May 27, 2022
b4f9615
Add app proxying for wildcards
kylecarbs May 27, 2022
c88df46
Add wsconncache
kylecarbs May 31, 2022
d327df7
fix: Race when writing to a closed pipe
kylecarbs May 31, 2022
f84f5ea
Merge branch 'readclose' into apps
kylecarbs May 31, 2022
cec2de3
fix: Race when writing to a closed pipe
kylecarbs May 31, 2022
c57f8dd
Merge branch 'readclose' into apps
kylecarbs May 31, 2022
8e61cac
fix: Race when writing to a closed pipe
kylecarbs May 31, 2022
b6e6d7b
Merge branch 'readclose' into apps
kylecarbs May 31, 2022
46b24f7
fix: Race when writing to a closed pipe
kylecarbs May 31, 2022
4d8b257
Merge branch 'readclose' into apps
kylecarbs Jun 1, 2022
e9b7463
Add workspace route proxying endpoint
kylecarbs Jun 3, 2022
80b5600
Add embed errors
kylecarbs Jun 3, 2022
8b81c35
chore: Refactor site to improve testing
kylecarbs Jun 3, 2022
60ad881
Merge branch 'refactorsite' into apps
kylecarbs Jun 3, 2022
0a63bec
Add test for error handler
kylecarbs Jun 3, 2022
d3b9ab5
Remove unused access url
kylecarbs Jun 3, 2022
7a1ae15
Add RBAC tests
kylecarbs Jun 3, 2022
5b9194f
Merge branch 'main' into apps
kylecarbs Jun 3, 2022
cd2d12e
Merge branch 'main' into apps
kylecarbs Jun 3, 2022
b056400
Fix dial agent syntax
kylecarbs Jun 3, 2022
fe3aecc
Merge branch 'main' into apps
kylecarbs Jun 3, 2022
2018cdc
Fix linting errors
kylecarbs Jun 3, 2022
2d5261f
Fix gen
kylecarbs Jun 3, 2022
856f17d
Fix icon required
kylecarbs Jun 3, 2022
1a21f94
Merge branch 'main' into apps
kylecarbs Jun 3, 2022
ad90bcb
Adjust migration number
kylecarbs Jun 3, 2022
38abbb5
Fix proxy error status code
kylecarbs Jun 4, 2022
4f89642
Fix empty db lookup
kylecarbs Jun 4, 2022
637be3e
Merge branch 'main' into apps
kylecarbs Jun 4, 2022
50da4fb
Merge branch 'main' into apps
kylecarbs Jun 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: Refactor site to improve testing
It was difficult to develop this package due to the
embed build tag being mandatory on the tests. The logic
to test doesn't require any embedded files.
  • Loading branch information
kylecarbs committed Jun 3, 2022
commit 8b81c35c31a297231041b69d9265935e6490d1a3
2 changes: 1 addition & 1 deletion coderd/coderd.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func New(options *Options) *API {
r.Get("/state", api.workspaceBuildState)
})
})
r.NotFound(site.DefaultHandler().ServeHTTP)
r.NotFound(site.Handler(site.FS()).ServeHTTP)

return api
}
Expand Down
12 changes: 0 additions & 12 deletions site/embed_slim.go

This file was deleted.

24 changes: 0 additions & 24 deletions site/embed.go → site/site.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
//go:build embed
// +build embed

package site

import (
"bytes"
"embed"
"fmt"
"io"
"io/fs"
Expand All @@ -21,26 +17,6 @@ import (
"golang.org/x/xerrors"
)

// The `embed` package ignores recursively including directories
// that prefix with `_`. Wildcarding nested is janky, but seems to
// work quite well for edge-cases.
//go:embed out
//go:embed out/bin/*
var site embed.FS

func DefaultHandler() http.Handler {
// the out directory is where webpack builds are created. It is in the same
// directory as this file (package site).
siteFS, err := fs.Sub(site, "out")

if err != nil {
// This can't happen... Go would throw a compilation error.
panic(err)
}

return Handler(siteFS)
}

// Handler returns an HTTP handler for serving the static site.
func Handler(fileSystem fs.FS) http.Handler {
// html files are handled by a text/template. Non-html files
Expand Down
24 changes: 24 additions & 0 deletions site/site_embed.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//go:build embed
// +build embed

package site

import (
"embed"
"io/fs"
)

//go:embed out
//go:embed out/bin/*
var site embed.FS

func FS() fs.FS {
// the out directory is where webpack builds are created. It is in the same
// directory as this file (package site).
out, err := fs.Sub(site, "out")
if err != nil {
// This can't happen... Go would throw a compilation error.
panic(err)
}
return out
}
15 changes: 15 additions & 0 deletions site/site_slim.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//go:build !embed
// +build !embed

package site

import (
"embed"
"io/fs"
)

var slim embed.FS

func FS() fs.FS {
return slim
}
3 changes: 0 additions & 3 deletions site/embed_test.go → site/site_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build embed
// +build embed

package site_test

import (
Expand Down