Skip to content

Commit 9993a27

Browse files
Fix unikernel deployment (#109)
This PR addresses an issue a user noticed where the instructions resulted in a broken deployment. ### Issue Instances based off the pushed image would do nothing but reboot as shown by the logs. Of note the uploaded image was 37MB. ### Changes * The primary fix is the addition of a flag specifying that the `initrd` filesystem is EROFS. * The headless image memory allocation is increased from 1024MB as it was insufficient. * Variables are added to `run-unikernel.sh` scripts that allow adjusting the `volimport` path prefix and the VCPUS parameter. * The `volimport` prefix environment variable might be unnecessary but was preferred as the original references `onkernel`. The `official` version seems to work and is the default. * The README is improved. Both headless and headful images were built and run. The headful image ran with WebRTC enabled. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Package unikernels with EROFS, increase headless memory, add VCPUS and VOLIMPORT_PREFIX envs, and refine README unikernel instructions. > > - **Unikernel build** > - Add `--rootfs-type erofs` to `images/chromium-headless/build-unikernel.sh` and `images/chromium-headful/build-unikernel.sh`. > - **Unikernel run** > - `images/chromium-headless/run-unikernel.sh`: > - Memory: `-M` increased from `1024` to `3072`. > - vCPUs configurable via `VCPUS` (default `1`). > - `images/chromium-headful/run-unikernel.sh`: > - vCPUs configurable via `VCPUS` (default `4`). > - Volume import image prefix configurable via `VOLIMPORT_PREFIX` (defaults to `onkernel`). > - **Docs** > - `README.md`: Update Unikraft instructions—split secret exports, use explicit `IMAGE=... images/.../{build,run}-unikernel.sh` commands, add headful run alternative with `VOLIMPORT_PREFIX`, and note `VCPUS` tunable. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d390334. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent fd4952c commit 9993a27

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,16 @@ Alternatively, you can run the browser on a Unikraft unikernel.
5858
`curl -sSfL https://get.kraftkit.sh | sh`
5959

6060
### 2. Add Unikraft Secret to Your CLI
61-
`export UKC_METRO=<region> and UKC_TOKEN=<secret>`
61+
`export UKC_METRO=<region>`
62+
`export UKC_TOKEN=<secret>`
6263

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

6667
### 4. Run it
67-
`./run-unikernel.sh`
68+
`IMAGE=YOUR_UKC_USERNAME/chromium-headless-test:latest images/chromium-headless/run-unikernel.sh`
69+
or
70+
`IMAGE=YOUR_UKC_USERNAME/chromium-headful-test:latest VOLIMPORT_PREFIX=official images/chromium-headful/run-unikernel.sh`
6871

6972
When the deployment finishes successfully, the Kraft CLI will print out something like this:
7073
```
@@ -91,6 +94,7 @@ Deployed successfully!
9194
- Various services (mutter, tint) take a few seconds to start-up. Once they do, the standby and restart time is extremely fast.
9295
- 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.
9396
- 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.
97+
- VCPUS value can be adjusted using the variable: `VCPUS=8`
9498

9599
## Connect to the browser via Chrome DevTools Protocol
96100

images/chromium-headful/build-unikernel.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ echo "Image index/name: $UKC_INDEX/$IMAGE"
3131
kraft pkg \
3232
--name $UKC_INDEX/$IMAGE \
3333
--plat kraftcloud \
34+
--rootfs-type erofs \
3435
--arch x86_64 \
3536
--strategy overwrite \
3637
--push \

images/chromium-headful/run-unikernel.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ cat "$FLAGS_DIR/flags"
5959
kraft cloud volume rm "$volume_name" || true
6060
kraft cloud volume create -n "$volume_name" -s 16M
6161
# Import the flags directory into the freshly created volume
62-
kraft cloud volume import --image onkernel/utils/volimport:1.0 -s "$FLAGS_DIR" -v "$volume_name"
62+
kraft cloud volume import --image "${VOLIMPORT_PREFIX:-onkernel}/utils/volimport:1.0" -s "$FLAGS_DIR" -v "$volume_name"
6363

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

6767

6868
deploy_args=(
69-
--vcpus 4
69+
--vcpus ${VCPUS:-4}
7070
-M 4096
7171
-p 9222:9222/tls
7272
-p 444:10001/tls

images/chromium-headless/build-unikernel.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ kraft pkg \
3232
--plat kraftcloud \
3333
--arch x86_64 \
3434
--strategy overwrite \
35+
--rootfs-type erofs \
3536
--push \
3637
.

images/chromium-headless/run-unikernel.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ deploy_args=(
1515
--scale-to-zero idle
1616
--scale-to-zero-cooldown 3000ms
1717
--scale-to-zero-stateful
18-
--vcpus 1
19-
-M 1024
18+
--vcpus ${VCPUS:-1}
19+
-M 3072
2020
-e RUN_AS_ROOT="$RUN_AS_ROOT"
21-
-e LOG_CDP_MESSAGES=true \
21+
-e LOG_CDP_MESSAGES=true
2222
-p 9222:9222/tls
2323
-p 444:10001/tls
2424
-n "$NAME"

0 commit comments

Comments
 (0)