diff --git a/README.md b/README.md index afc3f236..313573dd 100644 --- a/README.md +++ b/README.md @@ -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= and UKC_TOKEN=` +`export UKC_METRO=` +`export UKC_TOKEN=` ### 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: ``` @@ -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 diff --git a/images/chromium-headful/build-unikernel.sh b/images/chromium-headful/build-unikernel.sh index 7730468a..0112f1d7 100755 --- a/images/chromium-headful/build-unikernel.sh +++ b/images/chromium-headful/build-unikernel.sh @@ -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 \ diff --git a/images/chromium-headful/run-unikernel.sh b/images/chromium-headful/run-unikernel.sh index 4c21c70e..7a528f85 100755 --- a/images/chromium-headful/run-unikernel.sh +++ b/images/chromium-headful/run-unikernel.sh @@ -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 diff --git a/images/chromium-headless/build-unikernel.sh b/images/chromium-headless/build-unikernel.sh index 3843a8b7..983dcc64 100755 --- a/images/chromium-headless/build-unikernel.sh +++ b/images/chromium-headless/build-unikernel.sh @@ -32,5 +32,6 @@ kraft pkg \ --plat kraftcloud \ --arch x86_64 \ --strategy overwrite \ + --rootfs-type erofs \ --push \ . diff --git a/images/chromium-headless/run-unikernel.sh b/images/chromium-headless/run-unikernel.sh index 93bab450..3b2b18c9 100755 --- a/images/chromium-headless/run-unikernel.sh +++ b/images/chromium-headless/run-unikernel.sh @@ -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"