Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,16 @@ Alternatively, you can run the browser on a Unikraft unikernel.
`curl -sSfL https://get.kraftkit.sh | sh`

### 2. Add Unikraft Secret to Your CLI
`export UKC_METRO=<region> and UKC_TOKEN=<secret>`
`export UKC_METRO=<region>`
`export UKC_TOKEN=<secret>`

### 3. Build the image
`./build-unikernel.sh`
`IMAGE=YOUR_UKC_USERNAME/chromium-headless-test:latest images/chromium-headless/build-unikernel.sh`

### 4. Run it
`./run-unikernel.sh`
`IMAGE=YOUR_UKC_USERNAME/chromium-headless-test:latest images/chromium-headless/run-unikernel.sh`
or
`IMAGE=YOUR_UKC_USERNAME/chromium-headful-test:latest VOLIMPORT_PREFIX=official images/chromium-headful/run-unikernel.sh`

When the deployment finishes successfully, the Kraft CLI will print out something like this:
```
Expand All @@ -91,6 +94,7 @@ Deployed successfully!
- Various services (mutter, tint) take a few seconds to start-up. Once they do, the standby and restart time is extremely fast.
- The Unikraft deployment generates a url. This url is public, meaning _anyone_ can access the remote GUI if they have the url. Only use this for non-sensitive browser interactions, and delete the unikernel instance when you're done.
- You can call `browser.close()` to disconnect to the browser, and the unikernel will go into standby after network activity ends. You can then reconnect to the instance using CDP. `browser.close()` ends the websocket connection but doesn't actually close the browser.
- VCPUS value can be adjusted using the variable: `VCPUS=8`

## Connect to the browser via Chrome DevTools Protocol

Expand Down
1 change: 1 addition & 0 deletions images/chromium-headful/build-unikernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ echo "Image index/name: $UKC_INDEX/$IMAGE"
kraft pkg \
--name $UKC_INDEX/$IMAGE \
--plat kraftcloud \
--rootfs-type erofs \
--arch x86_64 \
--strategy overwrite \
--push \
Expand Down
4 changes: 2 additions & 2 deletions images/chromium-headful/run-unikernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ cat "$FLAGS_DIR/flags"
kraft cloud volume rm "$volume_name" || true
kraft cloud volume create -n "$volume_name" -s 16M
# Import the flags directory into the freshly created volume
kraft cloud volume import --image onkernel/utils/volimport:1.0 -s "$FLAGS_DIR" -v "$volume_name"
kraft cloud volume import --image "${VOLIMPORT_PREFIX:-onkernel}/utils/volimport:1.0" -s "$FLAGS_DIR" -v "$volume_name"

# Ensure the temp directory is cleaned up on exit
trap 'rm -rf "$FLAGS_DIR"' EXIT


deploy_args=(
--vcpus 4
--vcpus ${VCPUS:-4}
-M 4096
-p 9222:9222/tls
-p 444:10001/tls
Expand Down
1 change: 1 addition & 0 deletions images/chromium-headless/build-unikernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ kraft pkg \
--plat kraftcloud \
--arch x86_64 \
--strategy overwrite \
--rootfs-type erofs \
--push \
.
6 changes: 3 additions & 3 deletions images/chromium-headless/run-unikernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ deploy_args=(
--scale-to-zero idle
--scale-to-zero-cooldown 3000ms
--scale-to-zero-stateful
--vcpus 1
-M 1024
--vcpus ${VCPUS:-1}
-M 3072
-e RUN_AS_ROOT="$RUN_AS_ROOT"
-e LOG_CDP_MESSAGES=true \
-e LOG_CDP_MESSAGES=true
-p 9222:9222/tls
-p 444:10001/tls
-n "$NAME"
Expand Down
Loading