Skip to content

Commit

Permalink
image update, pause when idle, removed cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
zarkash-aws committed Jan 1, 2025
1 parent c4fa04c commit 266185c
Show file tree
Hide file tree
Showing 7,283 changed files with 164,957 additions and 158,482 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions build/pako.min.js

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions build/xterm.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion build/xterm.js

This file was deleted.

1 change: 1 addition & 0 deletions build/xterm.js.map

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions build/xterm.min.js

Large diffs are not rendered by default.

54 changes: 44 additions & 10 deletions examples/in-browser-valkey.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@

<!-- Scripts -->
<script src="../build/libv86.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/xterm.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js"></script>
<script src="../build/xterm.min.js"></script>
<script src="../build/pako.min.js"></script>
<script src="../src/browser/serial_xterm.js"></script>
<link href='https://fonts.googleapis.com/css?family=Open Sans' rel='stylesheet'>
<!-- Styles -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/xterm.css" />
<link href='https://fonts.googleapis.com/css?family=Open Sans' rel='stylesheet'>
<link rel="stylesheet" href="../build/xterm.css" />
<link rel="stylesheet" href='https://fonts.googleapis.com/css?family=Open Sans'>

<style>
/* General Styles */
Expand Down Expand Up @@ -135,8 +134,7 @@ <h2>This is an in-browser Valkey CLI. Try it out below:</h2>

<script>
"use strict";

const FILE_URL = "../images/try-valkey.bin.gz"; // Path to the .gz file
const FILE_URL = "../images/v8.0.1.bin.gz"; // Path to the .gz file
const CACHE_KEY = "valkey_binary_cache";
const LAST_MODIFIED_KEY = "valkey_last_modified";
let emulator;
Expand Down Expand Up @@ -242,25 +240,61 @@ <h2>This is an in-browser Valkey CLI. Try it out below:</h2>
emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 512 * 1024 * 1024,
vga_memory_size: 8 * 1024 * 1024,
bios: { url: "../bios/seabios.bin" },
vga_bios: { url: "../bios/vgabios.bin" },
filesystem: {
baseurl: "../images/alpine-rootfs-flat-new",
basefs: "../images/alpine-fs-new.json",
basefs: "../images/alpine-rootfs-flat-new.json",
},
autostart: true,
bzimage_initrd_from_filesystem: true,
cmdline: "rw root=host9p rootfstype=9p rootflags=trans=virtio,cache=loose modules=virtio_pci tsc=reliable",
initial_state: { url: imgUrl },
disable_mouse: true,
disable_keyboard: true,
disable_speaker: true,
});

await new Promise(resolve => emulator.add_listener("emulator-ready", resolve));

const serialAdapter = new SerialAdapterXtermJS(document.getElementById('terminal-container'), emulator.bus);
serialAdapter.show();

document.getElementById("loadingContainer").style.display = "none";

if (emulator) {
resetInactivityTimer();
["mousemove", "keydown", "touchstart"].forEach(event => {
window.addEventListener(event, resetInactivityTimer);
});

serialAdapter.term.onKey(() => resetInactivityTimer()); // Typing
serialAdapter.term.onData(() => resetInactivityTimer()); // Sending data
serialAdapter.term.onCursorMove(() => resetInactivityTimer()); // Mouse activity
};
}

let inactivityTimeout;
const INACTIVITY_LIMIT = 60*1000*10 //inactivity limit is 10 minutes

function resetInactivityTimer() {
if (!emulator) {
console.warn("Emulator is not initialized yet.");
return;
}

clearTimeout(inactivityTimeout);

inactivityTimeout = setTimeout(() => {
if (emulator.is_running()) {
console.log("VM paused due to inactivity.");
emulator.stop();
}
}, INACTIVITY_LIMIT);

if (!emulator.is_running()) {
console.log("VM resumed");
emulator.run();
}
}

window.onload = async function () {
Expand Down
66 changes: 51 additions & 15 deletions examples/valkey-cli-with-server.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@

<!-- Scripts -->
<script src="../build/libv86.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/xterm.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js"></script>
<script src="../build/xterm.min.js"></script>
<script src="../build/pako.min.js"></script>
<script src="../src/browser/serial_xterm.js"></script>
<link href='https://fonts.googleapis.com/css?family=Open Sans' rel='stylesheet'>
<!-- Styles -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/xterm.css" />
<link href='https://fonts.googleapis.com/css?family=Open Sans' rel='stylesheet'>

¸ <!-- Styles -->
<link rel="stylesheet" href="../build/xterm.css" />
<link rel="stylesheet" href='https://fonts.googleapis.com/css?family=Open Sans'>

<style>
/* General Styles */
* {
Expand Down Expand Up @@ -58,7 +57,7 @@
flex-direction: row;
padding: 10px;
overflow-y: hidden;
height: 500px;
height: 530px;
}

h1, h2 {
Expand Down Expand Up @@ -105,7 +104,7 @@
#log-terminal-container {
background: #000;
color: #fff;
border: 1px solid #555; /* Optional: add a border to match styling */
border: 1px solid #555;
padding: 10px;
font-family: monospace;
height: 100%;
Expand Down Expand Up @@ -186,7 +185,7 @@ <h2 class="log-description">Server Log:</h2>
<script>
"use strict";

const FILE_URL = "../images/try-valkey.bin.gz"; // Path to the .gz file
const FILE_URL = "../images/v8.0.1.bin.gz"; // Path to the .gz file
const CACHE_KEY = "valkey_binary_cache";
const LAST_MODIFIED_KEY = "valkey_last_modified";
const LOG_FILE_PATH = "/tmp/valkey.log";
Expand Down Expand Up @@ -275,28 +274,65 @@ <h2 class="log-description">Server Log:</h2>
emulator = new V86({
wasm_path: "../build/v86.wasm",
memory_size: 512 * 1024 * 1024,
vga_memory_size: 8 * 1024 * 1024,
vga_memory_size: 0,
bios: { url: "../bios/seabios.bin" },
vga_bios: { url: "../bios/vgabios.bin" },
filesystem: {
baseurl: "../images/alpine-rootfs-flat-new",
basefs: "../images/alpine-fs-new.json",
basefs: "../images/alpine-rootfs-flat-new.json",
},
autostart: true,
bzimage_initrd_from_filesystem: true,
disable_mouse: true,
disable_keyboard: true,
cmdline: "rw root=host9p rootfstype=9p rootflags=trans=virtio,cache=loose modules=virtio_pci tsc=reliable",
initial_state: { url: imgUrl },
disable_mouse: true,
disable_keyboard: true,
disable_speaker: true,
});

await new Promise(resolve => emulator.add_listener("emulator-ready", resolve));

const serialAdapter = new SerialAdapterXtermJS(document.getElementById('terminal-container'), emulator.bus);
serialAdapter.show();

document.getElementById("loadingContainer").style.display = "none";

initLogWindow();
startLogUpdateInterval();

if (emulator) {
resetInactivityTimer();
["mousemove", "keydown", "touchstart"].forEach(event => {
window.addEventListener(event, resetInactivityTimer);
});

serialAdapter.term.onKey(() => resetInactivityTimer()); // Typing
serialAdapter.term.onData(() => resetInactivityTimer()); // Sending data
serialAdapter.term.onCursorMove(() => resetInactivityTimer()); // Mouse activity
};
}

let inactivityTimeout;
const INACTIVITY_LIMIT = 60*1000*10 //inactivity limit is 10 minutes

function resetInactivityTimer() {
if (!emulator) {
console.warn("Emulator is not initialized yet.");
return;
}

clearTimeout(inactivityTimeout);

inactivityTimeout = setTimeout(() => {
if (emulator.is_running()) {
console.log("VM paused due to inactivity.");
emulator.stop();
}
}, INACTIVITY_LIMIT);

if (!emulator.is_running()) {
console.log("VM resumed");
emulator.run();
}
}

function initLogWindow() {
Expand Down
Binary file modified images/.DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion images/alpine-fs-new.json

This file was deleted.

1 change: 1 addition & 0 deletions images/alpine-rootfs-flat-new.json

Large diffs are not rendered by default.

Binary file removed images/alpine-rootfs-flat-new/0001429f.bin
Binary file not shown.
Binary file added images/alpine-rootfs-flat-new/000739f1.bin
Binary file not shown.
Binary file added images/alpine-rootfs-flat-new/00247a6a.bin
Binary file not shown.
Binary file added images/alpine-rootfs-flat-new/003cd8db.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/003e2ceb.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/0040afb5.bin
Binary file not shown.
Binary file added images/alpine-rootfs-flat-new/0041a4a6.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/0052ad4c.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/00561edf.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/00589ac4.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/007b6a93.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/007fc719.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/00898ba3.bin
Binary file not shown.
Binary file added images/alpine-rootfs-flat-new/008d8696.bin
Binary file not shown.
Binary file added images/alpine-rootfs-flat-new/0092a23e.bin
Binary file not shown.
Binary file added images/alpine-rootfs-flat-new/00935d95.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/00b10509.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/00ba9adc.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/00c5dea0.bin
Binary file not shown.
Binary file added images/alpine-rootfs-flat-new/00d236ac.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/00e1a5d6.bin
Binary file not shown.
Binary file added images/alpine-rootfs-flat-new/00e48444.bin
Binary file not shown.
Binary file added images/alpine-rootfs-flat-new/00eac17a.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/00f04e54.bin
Binary file not shown.
Binary file removed images/alpine-rootfs-flat-new/00ff5ffc.bin
Binary file not shown.
Loading

0 comments on commit 266185c

Please sign in to comment.