-
Notifications
You must be signed in to change notification settings - Fork 35
Integrate api server #19
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
Sayan-
merged 8 commits into
main
from
sayan/kernel-26-browser-replay-support--integrate
Jul 1, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
22b4c3d
create and use a shutdown context with a timeout
Sayan- 2c0ec73
tweak wait delays
Sayan- eb32f19
build script
Sayan- 97f3c31
integrate into unikernels
Sayan- 32e65de
integrate into containers
Sayan- 0368aae
vibe coding cargo cult
Sayan- 60e8f02
whups
Sayan- 7b6d249
fixups for graceful termination
Sayan- File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| bin/ | ||
| recordings/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #!/usr/bin/env bash | ||
| set -ex -o pipefail | ||
|
|
||
| # Move to the script's directory so relative paths work regardless of the caller CWD | ||
| SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) | ||
| cd "$SCRIPT_DIR" | ||
|
|
||
| IMAGE="${IMAGE:-onkernel/kernel-cu-test:latest}" | ||
|
|
||
| source ../../shared/start-buildkit.sh | ||
|
|
||
| # Build the kernel-images API binary and place it into ./bin for Docker build context | ||
| source ../../shared/build-server.sh "$(pwd)/bin" | ||
|
|
||
| # Build (and optionally push) the Docker image. | ||
| docker build -t "$IMAGE" . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #!/usr/bin/env bash | ||
| set -ex -o pipefail | ||
|
|
||
| # Move to the script's directory so relative paths work regardless of the caller CWD | ||
| SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) | ||
| cd "$SCRIPT_DIR" | ||
|
|
||
| IMAGE="${IMAGE:-onkernel/kernel-cu-test:latest}" | ||
| NAME="${NAME:-kernel-cu-test}" | ||
|
|
||
| # Directory on host where recordings will be saved | ||
| HOST_RECORDINGS_DIR="$SCRIPT_DIR/recordings" | ||
| mkdir -p "$HOST_RECORDINGS_DIR" | ||
|
|
||
| # Build docker run argument list | ||
| RUN_ARGS=( | ||
| --name "$NAME" | ||
| --privileged | ||
| --tmpfs /dev/shm:size=2g | ||
| -v "$HOST_RECORDINGS_DIR:/recordings" | ||
| --memory 8192m | ||
| -p 9222:9222 \ | ||
| -e DISPLAY_NUM=1 \ | ||
| -e HEIGHT=768 \ | ||
| -e WIDTH=1024 \ | ||
| -e CHROMIUM_FLAGS="--no-sandbox --disable-dev-shm-usage --disable-gpu --start-maximized --disable-software-rasterizer --remote-allow-origins=* --no-zygote" | ||
| ) | ||
|
|
||
| if [[ "${WITH_KERNEL_IMAGES_API:-}" == "true" ]]; then | ||
| RUN_ARGS+=( -p 444:10001 ) | ||
| RUN_ARGS+=( -e WITH_KERNEL_IMAGES_API=true ) | ||
| fi | ||
|
|
||
| # noVNC vs WebRTC port mapping | ||
| if [[ "${ENABLE_WEBRTC:-}" == "true" ]]; then | ||
| echo "Running container with WebRTC" | ||
| RUN_ARGS+=( -p 443:8080 ) | ||
| RUN_ARGS+=( -e ENABLE_WEBRTC=true ) | ||
| [[ -n "${NEKO_ICESERVERS:-}" ]] && RUN_ARGS+=( -e NEKO_ICESERVERS="$NEKO_ICESERVERS" ) | ||
| else | ||
| echo "Running container with noVNC" | ||
| RUN_ARGS+=( -p 443:6080 ) | ||
| fi | ||
|
|
||
| docker rm -f "$NAME" 2>/dev/null || true | ||
| docker run -d "${RUN_ARGS[@]}" "$IMAGE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # build-server.sh | ||
| # ------------------------- | ||
| # Usage (source or execute): | ||
| # build-recording-server.sh [dest-dir] [goos] [goarch] | ||
| # | ||
| # dest-dir (optional) Directory to place the resulting binary. Defaults to ./bin | ||
| # goos (optional) Target GOOS for cross-compilation. Defaults to linux | ||
| # goarch (optional) Target GOARCH for cross-compilation. Defaults to amd64 | ||
| # | ||
| # Examples | ||
| # source ../../shared/build-recording-server.sh # → ./bin, linux/amd64 | ||
| # ../../shared/build-recording-server.sh ./bin arm64 # → linux/arm64 | ||
| # ../../shared/build-recording-server.sh ./out darwin arm64 # → darwin/arm64 | ||
| set -euo pipefail | ||
|
|
||
| DEST_DIR="${1:-./bin}" | ||
| # Optional os/arch parameters | ||
| TARGET_OS="${2:-linux}" | ||
| TARGET_ARCH="${3:-amd64}" | ||
|
|
||
| # Resolve repo root as the parent directory of this script's directory | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" | ||
|
|
||
| # 1. Build the binary in the server module | ||
| pushd "$REPO_ROOT/server" >/dev/null | ||
| GOOS="$TARGET_OS" GOARCH="$TARGET_ARCH" CGO_ENABLED=0 make build | ||
| popd >/dev/null | ||
|
|
||
| # 2. Copy to destination | ||
| mkdir -p "$DEST_DIR" | ||
| cp "$REPO_ROOT/server/bin/api" "$DEST_DIR/kernel-images-api" | ||
|
|
||
| echo "✅ kernel-images-api binary copied to $DEST_DIR/kernel-images-api" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| bin/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.