mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 14:33:17 -10:00
f4fd37343957e25ba11c00a90479dc342cd2ebb2
15
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f4fd373439 |
refactor(backend): remove the smolvm backend
Lima is devvm's only backend. The backend architecture stays (Backend, Caps, Features, Review/Require, the registry, backendtest.Fake), so another backend is an addition. State from a smolvm VM reads as an unknown backend (backend_unknown_vm, gc_orphans_unknown); nothing migrates it. The image keys of layers/docker.sh, layers/nix.sh and features/desktop.sh change, so images rebuild once. Lima's port forwarder moves off smolvm's files first: newForwarderCmd and forwarderMain from internal/cli/smolvmports.go to limaports.go, and assets/container/ports.sh to assets/guest/ports.sh (sent by the forwarder at run time, so no image key changes). Removed: - internal/backend/smolvm (4,070 lines with tests), _smolvm-ports, its registry entry, registry.Experimental and backend_experimental. - The decider: backend.Decider/UsesDecider, Confinement.Decider and DeciderToken, internal/proxy/decider.go and its test, the proxy's -decider, -decider-to and -decider-token-file, netpolicy's KeyDeciderPort, KeyDeciderToken and deciderToken, the decider port in vm's forwarding and UsedPorts. - backend.AgentStarter/AgentUnchosen, vm's checkAgentStart and agent_unchosen_stop. - vmssh/key.go (EnsureKey, Public, HostKey, ServicesArgs, Capped). - paths.Smolvm/SmolvmImage and space's smolvm folders; paths.VM's Record, Key, KnownHosts and ProxyURL; project.Detect, which nothing called (a test helper now). - ubuntu.ContainerRepo/ContainerDigest/ContainerRef/ContainerOrigin and bump.sh's ubuntu_image, with its part of bump.txtar. - assets/smolvm/ and assets/container/; the no-init-system branches of layers/docker.sh, layers/nix.sh and guest/sync.sh, and the notes in features/desktop.sh and guest/ca.sh. - Messages: smolvm_* (14), vm_no_ssh, vm_no_sshd, ports_no_ssh, creating_from_image, packing_image, pack_failed, backend_experimental, agent_unchosen_stop; descriptions naming smolvm reworded. - Tests: smolvm.txtar, the smolvm stub, registry, decider, netpolicy and sshagent cases; gc_backend, gc_skipped, gc_orphans and space test a failing or hanging Lima listing instead (the limactl stub's list-fails and list-hangs); the --backend smolvm examples; e2e's --backend smolvm and its section (about 1,130 lines), the smol_* helpers and the link section's backend switch. - Coverage: internal/backend/smolvm's lines in both baselines. - Docs: backends/smolvm.md, internals/smolvm.md, design.md's smolvm notes (Ports on Lima now holds the forwarder's description), the backends table's smolvm column, every page naming smolvm, the README, the home page's backends art, and AGENTS.md's smolvm rows and gotchas (and the Docker bind-mount gotcha, which nothing refers to). Kept: the docker layer, on Lima; --from's local Docker; --backend, the BACKEND column and setup's backend choice, which the next commit removes. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
1917072228 |
refactor(backend): remove the Docker backend
devvm is about VMs, and Docker's containers aren't VMs: Lima is the default backend and smolvm stays experimental. The backend architecture (Backend, Caps, Require, the registry, backendtest.Fake) stays, so another backend is an addition. Removed: - internal/backend/docker, its registry entry and Names/Experimental's docker half; devvm _docker-connect and _docker-ports (internal/cli/dockerssh.go); assets/docker/unpack.sh. - Test-build overrides DEVVM_DOCKER_KIND, DEVVM_DOCKER_PROC_SYS, DEVVM_LINUX_BUILD_URL/_SHA256, the registry.linuxURL/linuxSHA256 ldflags vars and the CLI tests' Linux-build archive (linux_release). - Interfaces only Docker implemented, with their callers: backend.ProxySocket/ProxySocketOf (the proxy's -listen-unix), DiskUser (ls's and size's disk-over warning, size's disk_used and --json disk_used_gib), Reporter (doctor), LeftoverLister and Leftover (gc --orphans' volumes, networks, containers and images), DockerLayerVM and VMSpec.DockerLayer, SSHTarget.ProxyCommand and vmssh.SSH.Proxy, vmssh.SSH.SessionArgs, CacheEntry.Name. - The docker layer's runtime on a backend that makes VMs for it: vm/dockerlayer.go, KeyDockerLayer, chooseNet's refusal (chooseNet returns a bool now), the refusals at start and devvm network on, ls's "(sysbox)" and --json docker_layer, size_disk_default_unused. - The proxy's relay mode (relay.go, -relay, -relay-to, -listen-unix). - paths.Dirs.Docker and paths.VM.Lifeline. - assets/guest/tools.sh's linked-folder branch; services.sh's DEVVM_LOOP, DEVVM_DOCKERD and DEVVM_SSHD=inetd. - Messages: every docker_* the backend used, docker_layer_runtime, net_docker_layer, net_off_docker_layer, committing_image, pulling_image, unpacking_tools, disk_over, size_disk_default_unused, gc_orphan_volume/_network/_container/_image, docker_connect_failed; gc_orphan_elsewhere reworded. - Tests: docker.txtar, the docker stub's engine (its --from half stays), the ssh stub's login-shell branch; e2e's --backend docker, --engine, the docker host VM and Docker Desktop runs. - Release: one GoReleaser pass, no Linux-build pin in the macOS builds, no Linux devvm in the Homebrew formula's libexec. Linux builds stay. - Docs: backends/docker.md and internals/docker.md, design.md's Docker notes, the Docker column of the feature table, and every page's mentions of the Docker backend, Docker Desktop as one, and Sysbox. Kept: the docker layer in Lima VMs, devcontainer docker-in-docker, --from with images only a local Docker has, Docker Hub references. State written by a Docker VM before this reads as an unknown backend (backend_unknown_vm). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ee8146a5e4 |
fix: scripts and tests work without shasum, and two CLI scripts start Lima outside devvm on bash 5.2's sh
Fedora 43 has sha256sum but no shasum (Perl's Digest::SHA), and its /bin/sh is bash 5.3, which runs the last command of an `a && b` -c string in sh's place. - install.sh's check_host stops with "needs sha256sum or shasum" before downloading; its sha256 already used either. install.txtar covers shasum alone, both, sha256sum alone and neither, with made-up sums. - scripts/release.sh and scripts/bump.sh get a sha256 helper (sha256sum, else shasum -a 256) in place of four shasum calls. - gc_orphans, release, release_head and tools scripts hash with sha256sum, else shasum. tools' old fallback never fell back (the pipeline's status was cut's). - ls and existing_agents restart a VM outside devvm with `sh -c '... && limactl start ...; exit $?'`: without the exit, bash's sh exec'd the stub, whose ha.pid then named the test runner (the pid devvm recorded), so the VM still looked confined. - The install page lists sha256sum or shasum among the script's needs. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
6f9259b514 |
test: give each CLI test script its own coverage folder
The CLI tests' devvm is built with -cover, and every script set one GOCOVERDIR. Go names a run's temporary meta-data file by the time (time.Now().UnixNano(), microseconds on macOS) with no process ID, so two devvm runs from parallel scripts that start together write the same temporary file; the first renames it and the second's rename fails, and devvm prints "coverage meta-data emit failed" on stderr, failing any script that checks stderr (seen in ls.txtar and version.txtar). - script_test.go: scriptCoverDir sets GOCOVERDIR to a folder of the script's own (os.MkdirTemp under CLI_GOCOVERDIR). - scripts/test.sh: covdata merge takes the unit folder and every non-empty script folder as one comma-separated -i list, so percent and the baselines read the same counters as before. - Contributing's Coverage section says each script writes to a folder of its own, and why. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
b5742dca2c |
build: a package's coverage may sit up to a point below its baseline
The same tests can cover a little less from run to run, with timing or the tools a machine has, so mise run test fails a package only when it is more than a point below its baseline (COVERAGE_TOLERANCE, 1 by default). A package within that point passes and keeps its line, so a baseline still never goes down. coverage.txtar covers within, beyond and a tolerance of 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
ddbc377f8f |
test: testscript commands for the scripts' setup, and a coverage baseline per package
script_test.go's sandbox sets DEVVM_MESSAGES=names and DATA, VMS, RUN and CFG by default, and adds stub_reset, catg (the one file a glob matches), vm_name VAR NAME (the folder's VM) and project NAME [git]; script_cmds.txtar checks each. Every script is rewritten onto them, its assertions kept; TestCommandLines leaves the scripts' own commands out. mise run test runs scripts/test.sh: the tests as before, with the CLI tests' devvm built with -cover for every package (CLI_GOCOVERDIR), merged with the Go tests' counters by go tool covdata, then scripts/coverage.sh holds each package to testdata/coverage/<os>.txt. mise run coverage raises the baselines; coverage.txtar checks the comparison. The macOS baseline is recorded from this tree. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
91a429108f |
feat(images): a built-in nix layer with Nix, direnv and nix-direnv, pinned
nix is a layer devvm ships, as docker is: devvm nix, devvm node+nix, devvm build nix, or added to an existing VM in place. A folder with flake.nix, shell.nix or devenv.nix at its top level, or a default.nix that makes a shell (mkShell), gets it after its toolchains, so package.json and flake.nix give node+nix. - assets/layers/nix.sh: Nix 2.35.4's release tarball (releases.nixos.org), its version and SHA-256 per arch at the top, checked against the tarball's .sha256 files and nixos.org/nix/install, fetched with devvm-fetch; 2.35.3 fixes GHSA-hf6w-2rg9-v84g (store ownership in the scripted installer) and CVE-2026-110450 (store corruption through the daemon's repair flag). The tarball's own install --daemon --yes --no-channel-add, with experimental-features = nix-command flakes, trusted-users = root, sandbox = true and sandbox-fallback = false. The installer runs without proxy variables (it writes any it finds into a systemd override for nix-daemon, which would put a build's proxy into the image) and with NIX_SSL_CERT_FILE at the system's bundle. The layer checks the store is root's, adds Nix's default profile to the end of sudo's secure_path (/etc/sudoers.d/devvm-nix, checked with visudo), and appends Nix's profiles to BASH_ENV's PATH. direnv 2.38.2 (per arch) and nix-direnv 3.2.0's direnvrc, pinned the same way; direnv's hook in ~/.bashrc.d/direnv.sh, which loads before mise.sh so direnv's prompt hook runs after mise's and a dev shell's PATH comes first; a direnv lib file puts each project's layout under ~/.cache/direnv/layouts, so nix-direnv writes no .direnv into the project folder. Without systemd the script refuses in one line. - assets/layers/nix.policy: cache.nixos.org, channels.nixos.org, releases.nixos.org (GitHub is in base.policy). - assets/guest/sync.sh: nix-daemon gets a systemd drop-in with the VM's proxy (http_proxy, https_proxy, no_proxy) under network policy, removed when it's off, the daemon restarted when it changed. - image.NixLayer in Builtins; project.Detect's nix marker (a default.nix is read only as a regular file, at most 64 KiB); backend.FeatureNixLayer (nix-layer), needed by a VM of an image with the layer and by building one: Lima native, smolvm and Docker none, so both refuse in one line (backend_lacks); dockerLayers.choice returns every layer feature of the image, so docker+nix on Docker needs nix-layer too. - scripts/bump.sh: nix (the version nixos.org's installer names, the sums Nix publishes; it fails when the installer names no tarball, as Nix's Rust installer will), direnv, nix-direnv. - Docs: using/images (built-in layers, detection), using/toolchains (Nix projects), safety/network (the layer's hosts; source builds' hosts blocked), internals/images (the nix layer), internals/network (the daemons' drop-ins), internals/backends (nix-layer), internals/design (the nix layer beside Instead of Nix), backends, customizing, coding-agents, contributing (the e2e section); the CLI reference; AGENTS.md's assets/ and e2e lines. - Tests: Detect (markers, default.nix with and without a shell, a linked one), layer and environment lists, layer new nix reserved, nix-layer in ImageSpec and ImageFeatures, caps tests, up_checks.txtar (node+nix detected under an agent), docker.txtar (nix refused for a VM and a build). e2e nix section: the layer built behind a company proxy leaves no proxy settings and no password on its image's disk; a node+nix flake VM with network policy: pins, a root-owned store, sandbox without fallback, trusted-users root and an untrusted substituter ignored, the daemon's drop-in, nix run nixpkgs#hello, sudo nix and nix over ssh, the flake's node ahead of the shared node prompt after prompt through direnv, no .direnv in the folder, a blocked fixed-output fetch named by devvm-why, and the drop-in gone after network off. Review (security-audit skill, guidance mode, against the review task's list): the tarball and direnv's files are pinned in devvm's source and checked before tar or install runs; nothing from the host goes into the image (no proxy override, e2e greps the disk); the drop-in holds only the VM's own proxy URL, devvm's value, and goes when policy is off; trusted-users stays root and an untrusted user's substituters are ignored (the VM's user has sudo, so that guards an honest VM and the allowlist is what holds); secure_path gains only the root-owned default profile, last; /nix is on the VM's own disk and nothing mounts a host's or another VM's store. Found and fixed in review: Nix's default sandbox-fallback would build unsandboxed without a word where the kernel can't sandbox, so it's off. No confirmed findings. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
857c0e8c53 |
docs(site): sections in the reader's order, attack vectors and a first-VM page
The docs move into a folder per sidebar section, in the order a new user needs them: getting-started (install, first-vm, commands), using (images, customizing, from, devcontainer, coding-agents, ssh, limits), safety (attack-vectors, network, clone, git-protection, security), backends (backends.md as the section's _index.md, lima, smolvm, docker), internals (design), cli, and contributing (contributing.md as its _index.md, testing, maintaining). Each section has an _index.md listing its pages, and the docs index is grouped the same way. Commands is now Everyday commands, SSH is SSH and editors. New pages: - safety/attack-vectors.md: Staying safe first (seven habits), then common attacks sorted into Blocked, Kept inside the VM, Narrowed, not closed, and Left to you. - getting-started/first-vm.md: making a VM, the first run, what's in it, coding agents, coming back to it. Links to Staying safe from the home page, README, security, install, coding agents and clone. Every relative link, the home page's, the README's, SECURITY.md's, CONTRIBUTING.md's, AGENTS.md's, the proxy and oci READMEs', release.sh's hints and the recording's URL use the new paths. internal/msg/docs.go names pages by path (using/images#...), and checkDoc takes a section's _index.md for its folder (backends#...). contributing/_index.md describes the sections and how links name them. Also carries the docs edits made alongside the forwarder work in the tree (backends, images, limits, security, design, commands and the generated devvm ports page), whose code isn't in this commit. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
cf5a7db974 |
fix(images): pin Lima's Ubuntu cloud image with base's snapshot
Lima's base starts from a pinned dated Ubuntu cloud release (release-20261016) with each architecture's SHA-256, checked against Ubuntu's signed SHA256SUMS; another checksum is refused (ubuntu_checksum_unpinned). The pin is in base's image key (Lima's KeyFiles). scripts/bump.sh apt moves it with the snapshot and container digest: the newest release dated before the snapshot, its SHA256SUMS checked with gpgv against Ubuntu's cloud key. e2e: default tier 146/0, --only from 13/0. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
fcbea2c744 |
feat(docker): network policy, and build confinement on Docker Desktop
A Docker VM with network policy sits alone with a relay container on an internal network of its own (inhibit_ipv4). The relay, devvm's own Linux build in an empty imported image (read-only, every capability dropped), copies the VM's connections to a unix socket of devvm's proxy on the host, so tokens, the Keychain, the CA key and agents' logins never enter Docker. On and off is docker network connect/disconnect at the next start. Desktop builds run on a network and relay of their own, through a host proxy allowing any host on ports 80 and 443. - every Docker VM drops NET_RAW; it's in the config hash, so containers are made again from their commit - confined: the start's ID, the VM alone on its network with the relay by its recorded container ID, the network still internal; a foreign member is docker_network_shared, at start and on removal - proxy: -listen-unix, -relay/-relay-to; a lifeline pid file written after the proxy started whose process has gone ends it - macOS fetches the release's Linux build on first use, checked against a SHA-256 the two-pass release.sh bakes in; builds without the pin use devvm-linux-<arch> beside devvm or refuse - the build proxy is stopped through the process devvm started - reviewed: design notes and threat check in design.md; e2e on the Linux engine and Desktop: dropped capabilities, network members and options, no IPv6 beyond the bridge's link-local, no DNS query leaving (captured, with an unconfined control), direct connections refused Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
2b413028e6 |
fix(images): pin Ubuntu's container image with base's package snapshot
smolvm's and Docker's base start from Ubuntu's container image by a digest pinned in internal/ubuntu (ContainerDigest), not the tag's digest looked up at build time. base's key hashes it (each backend's KeyFiles), and base's record names it. The image is never newer than assets/layers/base.sh's snapshot: an image with newer packages leaves apt unable to install what depends on their exact versions (the docker layer's docker-ce, through systemd's libsystemd0). - internal/ubuntu: ContainerRepo, ContainerDigest, ContainerRef, ContainerOrigin; the backends' Digest fields and UbuntuImage go. - base.sh: apt_snapshot 20261026T000000Z, with the image's digest sha256:19fcd1bf268f (built 2026-10-25). - scripts/bump.sh: apt moves the snapshot and the image's digest together (the index's digest hashed from what the registry sent), and refuses an image built after the snapshot; bump.txtar covers both. - tests/e2e.sh: timings per selection and Docker engines, so an --engine linux run isn't compared with one that included Desktop; the Linux engine's run pulls the pinned Ubuntu image before recording what Docker has without the sandbox's label; base's records are checked against the pin; smolvm's TSI check takes any of this machine's resolvers; the from section allows devvm's labelled VM listing. - docs: smolvm, Docker, images, maintaining, contributing; design.md's smolvm notes describe the reviewed emulations as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
e6681035b2 |
feat(images): a built-in docker layer
Docker is a layer devvm ships, docker, chosen per VM like any layer (devvm node+docker, devvm build docker) and added to an existing VM in place. base installs no Docker. - Built-in layers: image.Builtins (docker) and IsBuiltin; a name is looked up in devvm's assets/layers first, so a user's docker.sh is never read; devvm layer new docker is refused (layer_name_reserved); an image's key hashes the shipped script (own file, must exist); Layers, Environments, completion and unknown_layer/no_image_for list it; Env.LayerData reads either kind's script. - assets/layers/docker.sh: Docker's apt repository (pinned key, pinned package versions; Alpine's own packages, rc-update, the docker group), the daemon started now too (OpenRC, or with no init system as services.sh does) for a VM it's added to in place. scripts/bump.sh's docker pins read it. - assets/layers/docker.policy: Docker's packages and the registries, applied to VMs with the layer (netpolicy.PolicyFiles); base.policy keeps OS packages (Alpine's too), mise and GitHub. - Adding layers in place sets the new image in the VM's state before their scripts run, so a network-policy VM's proxy allows their hosts; a failing script sets it back. - smolvm's sshd.sh keeps the snapshot's package lists, for layers' apt-get install. - Docs: images (base, built-in layers, keys), customizing, commands, network, smolvm, from, install, maintaining, design, coding-agents, contributing; the CLI reference; AGENTS.md's assets/ line. - Tests: key, layers, build, policy files, in-place add (devvm's script, image during the run, set back on failure), layer new docker; e2e: a base VM has no Docker (Lima, smolvm), the docker layer on Debian 12 and Alpine (from), and smolvm's network-policy VM is a docker VM whose Docker pulls through the proxy. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9f24d2639e |
refactor: group devvm's files under assets/
assets/ holds the files devvm ships: base.yaml, layers/, features/, shared-tools/ (mise.toml, build.sh, the tools' policies), guest/ and oci/. devvm reads them from assets/ beside its binary (paths.Root, paths.RootOf); releases, the Homebrew formula, the CLI tests and e2e put them there. Image keys hash them by their names in assets/. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
37d2fa57e4 |
feat(install): install.sh for the per-platform release archives
install.sh picks this host's archive (devvm-<version>-<os>-<arch>.tar.gz: darwin or linux, arm64 or amd64; Apple silicon's under Rosetta, from sysctl hw.optional.arm64), checks SHA256SUMS's minisign signature (an empty key still skips it, with a warning; no minisign prints the command to check by hand), then the archive's checksum, and installs the binary with its data files in <prefix>/lib/devvm/<version>, linked from <prefix>/bin/devvm. Older versions go, except one a running process names in its arguments (a VM's proxy, QEMU's guestfwd on Linux): it's kept until a later install. Then it offers devvm doctor --fixes' fixes, asking first (Homebrew's Lima or Lima's checked release tarball, QEMU, the kvm group), and runs devvm doctor. Downloads are HTTPS only. Its text isn't messages: it runs before devvm is there. release.sh --head now needs install.sh too. Tests: testdata/script/install.txtar sources install.sh (host and archive names, Rosetta, version choice and validation, HTTPS-only fetch, run_fix as words, install and links, reinstall, an older version in use kept (and the real ps), signature good, bad, missing, no minisign, a bad checksum, no archive for this host, Lima's tarball for the host and arch and a bad checksum, the PATH hint, the fixes with --yes, the kvm re-login, no yes, Lima's release once allowed, nothing missing, main's options, and the tests' devvm binary installed and finding its files); release_head.txtar: a HEAD without install.sh is refused. docs: install.md (Homebrew and the install script, upgrading, uninstalling), maintaining.md (trying install.sh on a --head build), README. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f42d436350 |
build(release): release.sh around GoReleaser, bump.sh
scripts/release.sh checks the signed tag (git tag -v) and its signer against this checkout's packaging/release-signer, then runs goreleaser release --skip=publish (--snapshot with --head) in a clone of the commit, so only what's committed goes in. .goreleaser.yaml builds darwin/linux x arm64/amd64 archives with the binary and its data files, a source tarball and SHA256SUMS, with -X github.com/w3cj/devvm/internal/cli.version (VERSION's version, for HEAD too). release.sh checks the host's binary prints the version, signs SHA256SUMS with minisign and verifies it, fills in install.sh (release_version, minisign_key) and the Homebrew formula, which builds from the source tarball with Go (brew audit --strict clean). --head takes DEVVM_MINISIGN_PUB for a test key, and skips a missing install.sh; a tag without one is refused. scripts/bump.sh writes the host mise's pins in internal/tools/mise.go. VERSION and a fresh CHANGELOG.md. docs: maintaining.md (pins, releasing). Tests: testdata/script/release.txtar (unsigned tag, no pin, another signer, the checkout's pin, no install.sh), release_head.txtar (unsigned, signed and verified, install.sh and formula filled in, only committed files, wrong key, wrong version, bad install.sh, bad VERSION), bump.txtar (crane, mise in base.sh and mise.go, hostile and missing values, --check control characters, unknown tool). The sandbox sets DEVVM_REPO. Co-Authored-By: Claude Opus 5.5 <[email protected]> |