Skip to content

Commit 4ba6b75

Browse files
Merge branch 'main' into upd-space-and-time
2 parents 992f8fd + 2d73dc8 commit 4ba6b75

13 files changed

Lines changed: 205 additions & 124 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
## What's Kernel?
1313

14-
Kernel provides sandboxed, ready-to-use Chrome browsers for browser automations and web agents. This repo powers our [hosted services](https://docs.onkernel.com/introduction).
14+
Kernel provides sandboxed, ready-to-use Chrome browsers for browser automations and web agents. This repo powers our [hosted services](https://onkernel.com/docs/introduction).
1515

1616
Sign up [here](https://www.onkernel.com/)!
1717

@@ -167,7 +167,7 @@ Note: the recording file is encoded into a H.264/MPEG-4 AVC video file. [QuickTi
167167

168168
## Documentation
169169

170-
This repo powers our managed [browser infrastructure](https://docs.onkernel.com).
170+
This repo powers our managed [browser infrastructure](https://onkernel.com/docs).
171171

172172
## Contributing
173173

images/chromium-headful/run-unikernel.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@ trap 'rm -rf "$FLAGS_DIR"' EXIT
4141

4242

4343
deploy_args=(
44+
--vcpus 4
4445
-M 4096
4546
-p 9222:9222/tls
4647
-p 444:10001/tls
4748
-e DISPLAY_NUM=1
4849
-e HEIGHT=768
4950
-e WIDTH=1024
50-
-e RUN_AS_ROOT="$RUN_AS_ROOT" \
51+
-e RUN_AS_ROOT="$RUN_AS_ROOT"
52+
-e LOG_CDP_MESSAGES=true
5153
-v "$volume_name":/chromium
5254
-n "$NAME"
5355
)

images/chromium-headful/supervisor/services/kernel-images-api.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[program:kernel-images-api]
2-
command=/bin/bash -lc 'mkdir -p "${KERNEL_IMAGES_API_OUTPUT_DIR:-/recordings}" && PORT="${KERNEL_IMAGES_API_PORT:-10001}" FRAME_RATE="${KERNEL_IMAGES_API_FRAME_RATE:-10}" DISPLAY_NUM="${KERNEL_IMAGES_API_DISPLAY_NUM:-${DISPLAY_NUM:-1}}" MAX_SIZE_MB="${KERNEL_IMAGES_API_MAX_SIZE_MB:-500}" OUTPUT_DIR="${KERNEL_IMAGES_API_OUTPUT_DIR:-/recordings}" exec /usr/local/bin/kernel-images-api'
2+
command=/bin/bash -lc 'mkdir -p "${KERNEL_IMAGES_API_OUTPUT_DIR:-/recordings}" && PORT="${KERNEL_IMAGES_API_PORT:-10001}" FRAME_RATE="${KERNEL_IMAGES_API_FRAME_RATE:-10}" DISPLAY_NUM="${KERNEL_IMAGES_API_DISPLAY_NUM:-${DISPLAY_NUM:-1}}" MAX_SIZE_MB="${KERNEL_IMAGES_API_MAX_SIZE_MB:-500}" OUTPUT_DIR="${KERNEL_IMAGES_API_OUTPUT_DIR:-/recordings}" LOG_CDP_MESSAGES="${LOG_CDP_MESSAGES:-false}" exec /usr/local/bin/kernel-images-api'
33
autostart=false
44
autorestart=true
55
startsecs=2

images/chromium-headless/image/supervisor/services/kernel-images-api.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[program:kernel-images-api]
2-
command=/bin/bash -lc 'mkdir -p "${KERNEL_IMAGES_API_OUTPUT_DIR:-/recordings}" && PORT="${KERNEL_IMAGES_API_PORT:-10001}" FRAME_RATE="${KERNEL_IMAGES_API_FRAME_RATE:-10}" DISPLAY_NUM="${KERNEL_IMAGES_API_DISPLAY_NUM:-${DISPLAY_NUM:-1}}" MAX_SIZE_MB="${KERNEL_IMAGES_API_MAX_SIZE_MB:-500}" OUTPUT_DIR="${KERNEL_IMAGES_API_OUTPUT_DIR:-/recordings}" exec /usr/local/bin/kernel-images-api'
2+
command=/bin/bash -lc 'mkdir -p "${KERNEL_IMAGES_API_OUTPUT_DIR:-/recordings}" && PORT="${KERNEL_IMAGES_API_PORT:-10001}" FRAME_RATE="${KERNEL_IMAGES_API_FRAME_RATE:-10}" DISPLAY_NUM="${KERNEL_IMAGES_API_DISPLAY_NUM:-${DISPLAY_NUM:-1}}" MAX_SIZE_MB="${KERNEL_IMAGES_API_MAX_SIZE_MB:-500}" OUTPUT_DIR="${KERNEL_IMAGES_API_OUTPUT_DIR:-/recordings}" LOG_CDP_MESSAGES="${LOG_CDP_MESSAGES:-false}" exec /usr/local/bin/kernel-images-api'
33
autostart=false
44
autorestart=true
55
startsecs=2

images/chromium-headless/run-unikernel.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ deploy_args=(
1515
--scale-to-zero idle
1616
--scale-to-zero-cooldown 3000ms
1717
--scale-to-zero-stateful
18+
--vcpus 1
1819
-M 1024
1920
-e RUN_AS_ROOT="$RUN_AS_ROOT"
21+
-e LOG_CDP_MESSAGES=true \
2022
-p 9222:9222/tls
2123
-p 444:10001/tls
22-
--vcpus 2
2324
-n "$NAME"
2425
)
2526

server/cmd/api/api/process_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestProcessExec(t *testing.T) {
2424
svc := &ApiService{procs: make(map[string]*processHandle)}
2525

2626
cmd := "sh"
27-
args := []string{"-c", "echo -n out; echo -n err 1>&2; exit 3"}
27+
args := []string{"-c", "printf out; printf err 1>&2; exit 3"}
2828
body := &oapi.ProcessExecRequest{Command: cmd, Args: &args}
2929
resp, err := svc.ProcessExec(ctx, oapi.ProcessExecRequestObject{Body: body})
3030
require.NoError(t, err, "ProcessExec error")

server/cmd/api/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func main() {
141141
})
142142
})
143143
rDevtools.Get("/*", func(w http.ResponseWriter, r *http.Request) {
144-
devtoolsproxy.WebSocketProxyHandler(upstreamMgr, slogger).ServeHTTP(w, r)
144+
devtoolsproxy.WebSocketProxyHandler(upstreamMgr, slogger, config.LogCDPMessages, stz).ServeHTTP(w, r)
145145
})
146146

147147
srvDevtools := &http.Server{

server/cmd/config/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ type Config struct {
1919

2020
// Absolute or relative path to the ffmpeg binary. If empty the code falls back to "ffmpeg" on $PATH.
2121
PathToFFmpeg string `envconfig:"FFMPEG_PATH" default:"ffmpeg"`
22+
23+
// DevTools proxy configuration
24+
LogCDPMessages bool `envconfig:"LOG_CDP_MESSAGES" default:"false"`
2225
}
2326

2427
// Load loads configuration from environment variables

server/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ module github.com/onkernel/kernel-images/server
33
go 1.25.0
44

55
require (
6+
github.com/coder/websocket v1.8.14
67
github.com/fsnotify/fsnotify v1.9.0
78
github.com/getkin/kin-openapi v0.132.0
89
github.com/ghodss/yaml v1.0.0
910
github.com/glebarez/sqlite v1.11.0
1011
github.com/go-chi/chi/v5 v5.2.1
1112
github.com/google/uuid v1.5.0
12-
github.com/gorilla/websocket v1.5.3
1313
github.com/kelseyhightower/envconfig v1.4.0
1414
github.com/nrednav/cuid2 v1.1.0
1515
github.com/oapi-codegen/runtime v1.1.1

server/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMz
22
github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ=
33
github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk=
44
github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w=
5+
github.com/coder/websocket v1.8.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9g=
6+
github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
57
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
68
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
79
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -29,8 +31,6 @@ github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbu
2931
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=
3032
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
3133
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
32-
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
33-
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
3434
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
3535
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
3636
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=

0 commit comments

Comments
 (0)