feat(runtime): stage VM runtime artifacts and writable drives in per-VM ephemeral storage by default

This commit is contained in:
2026-05-01 15:28:06 +00:00
parent 9cdb8571a4
commit c868d07d29
10 changed files with 237 additions and 8 deletions
+16 -1
View File
@@ -257,9 +257,22 @@ const clonePath = await imageManager.cloneRootfs(rootfsPath, 'ubuntu-clone.ext4'
bin/<version>/jailer
kernels/<name>
rootfs/<name>
sockets/<vmId>.sock
/dev/shm/.smartvm/runtime/<vmId>/
firecracker.sock
drives/<driveId>-<sourceName>
```
Runtime files default to `/dev/shm/.smartvm/runtime` on Linux when available, so sockets and per-VM writable drive copies live on tmpfs and are removed during cleanup. Set `runtimeDir` to override this.
**Ephemeral drives:**
- Writable drives are copied into the per-VM runtime directory before boot by default
- Firecracker receives the staged tmpfs path, so guest writes do not modify cached/base rootfs files
- Per-VM staged drive files are deleted by `vm.cleanup()` / `smartvm.cleanup()`
- Read-only drives are not copied unless `ephemeral: true` is set on the drive
- Set `ephemeral: false` on a drive, or `ephemeralWritableDrives: false` on `SmartVM`, only when persistence is explicitly required
### `BaseImageManager` — Base Images
Downloads known base image bundles into a `/tmp` cache for integration tests and quick local smoke tests. The default preset is `latest`; `lts` maps to a pinned Firecracker CI train (`v1.7`) for a stable fallback. Hosted project-owned manifests are also supported for pinned Alpine/BusyBox-style bundles.
@@ -304,6 +317,7 @@ Example configuration:
```typescript
const smartvm = new SmartVM({
baseImageCacheDir: '/tmp/.smartvm/base-images',
runtimeDir: '/dev/shm/.smartvm/runtime',
maxStoredBaseImages: 4,
baseImageManifestUrl: 'https://assets.example.com/push.rocks/smartvm/base-images/smartvm-minimal-v1/x86_64/manifest.json',
});
@@ -542,6 +556,7 @@ All configuration interfaces are fully exported for type-safe usage:
```typescript
import type {
ISmartVMOptions,
IMicroVMRuntimeOptions,
IMicroVMConfig,
IBootSource,
IMachineConfig,