diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b7b945..0e0dd97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,33 @@ are taken from its section here. ## [Unreleased] +### Changed +- Quitting DockZ (menu bar Quit, ⌘Q, the Dock, or logout) now shows a "Shutting down + DockZ…" window listing the Docker engine and Linux machines being stopped, with a check + as each one finishes, instead of seeming frozen for the seconds a clean VM shutdown takes. + +- Monitor's disk card shows space used against the disk limit (orange from 80%, red from + 95%) instead of against the filesystem size, with how much space is free on the Mac. + Settings shows the Mac's free space too. + +### Fixed +- The disk limit is now enforced when it is lowered. Before, the VM disk only ever grew, so + a disk created at 64 GB kept using up to 64 GB after the limit was set to 16 GB. Apply & + Restart now stops Docker, shrinks the disk offline to the new limit and starts Docker + again. A safety copy is kept until the shrink succeeds. If the data does not fit, the + disk is left as it is and the message says which limit would fit. `DockZ shrink-disk` + does the same from the terminal while DockZ is closed. +- `docker run` (without `-d`), `docker exec` and other attached commands lost any output + printed more than half a second after they started: `sh -c 'echo start; sleep 3; echo + end'` showed only "start". The VM's socket relay closed the stream half a second after + the docker CLI finished sending input. Existing VMs get the fix at their next start: DockZ + now brings the VM's own DockZ service files up to date with the app on every boot (boot + files excluded), so later fixes to them reach existing disks too. +- Opening DockZ while its menu bar icon is hidden (a crowded menu bar or the notch) did + nothing, so the app looked frozen. Opening it again from Finder, Spotlight or Launchpad + now always shows the dashboard (restoring it if minimised), and a launch you start + yourself opens it too; only Launch at Login still starts quietly in the menu bar. + ## [0.2.2] - 2026-10-07 ### Added diff --git a/README.md b/README.md index 51ad3f1..3a429b3 100644 --- a/README.md +++ b/README.md @@ -337,7 +337,7 @@ Settings): | File / dir | Purpose | | -------------- | -------------------------------------------------------------- | -| `disk.img` | VM disk (sparse; grows up to the configured disk limit) | +| `disk.img` | VM disk (sparse; sized to the disk limit — lowering the limit shrinks it on Apply & Restart, or with `DockZ shrink-disk` while DockZ is closed) | | `docker.sock` | Host-side Docker socket (bridged to the guest over vsock) | | `console.log` | Guest serial console — first stop for boot debugging | | `host.log` | Host-side VM lifecycle log (state changes, stop/poweroff path) | diff --git a/README.vi.md b/README.vi.md index 17b0aa2..e88bb90 100644 --- a/README.vi.md +++ b/README.vi.md @@ -337,7 +337,7 @@ Settings): | Tệp / thư mục | Mục đích | | -------------- | -------------------------------------------------------------- | -| `disk.img` | Ổ đĩa VM (sparse; tăng dần tới giới hạn dung lượng đĩa đã cấu hình) | +| `disk.img` | Ổ đĩa VM (sparse; đúng bằng giới hạn dung lượng — hạ giới hạn thì Apply & Restart sẽ thu nhỏ đĩa, hoặc chạy `DockZ shrink-disk` khi DockZ đang tắt) | | `docker.sock` | Docker socket phía host (bắc cầu tới guest qua vsock) | | `console.log` | Serial console của guest — nơi đầu tiên cần xem khi debug quá trình boot | | `host.log` | Log vòng đời VM phía host (đổi trạng thái, đường stop/poweroff) | diff --git a/guest/rootfs/etc/init.d/dockz-agent b/guest/rootfs/etc/init.d/dockz-agent index ef60778..52c4778 100644 --- a/guest/rootfs/etc/init.d/dockz-agent +++ b/guest/rootfs/etc/init.d/dockz-agent @@ -7,24 +7,32 @@ depend() { use net docker } +# socat ends a connection 0.5 s (its default -t) after either side half-closes. +# The docker CLI half-closes its side of a hijacked stream right after +# attaching (`docker run` without -i), so output arriving later was dropped: +# `sh -c 'echo start; sleep 3; echo end'` printed only "start". Keep the other +# direction open until it ends by itself. 2147483 s (~24 days) is the largest +# value whose milliseconds still fit a 32-bit int in socat's poll timeout. +RELAY_OPTS="-t 2147483" + start() { ebegin "Starting dockz vsock agents" modprobe virtio_vsock 2>/dev/null || true start-stop-daemon --start --background --make-pidfile \ --pidfile /run/dockz-proxy.pid \ - --exec /usr/bin/socat -- \ + --exec /usr/bin/socat -- $RELAY_OPTS \ VSOCK-LISTEN:2375,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sock start-stop-daemon --start --background --make-pidfile \ --pidfile /run/dockz-ip.pid \ - --exec /usr/bin/socat -- \ + --exec /usr/bin/socat -- $RELAY_OPTS \ VSOCK-LISTEN:2376,reuseaddr,fork EXEC:/usr/local/bin/dockz-print-ip start-stop-daemon --start --background --make-pidfile \ --pidfile /run/dockz-power.pid \ - --exec /usr/bin/socat -- \ + --exec /usr/bin/socat -- $RELAY_OPTS \ VSOCK-LISTEN:2377,reuseaddr,fork EXEC:/usr/local/bin/dockz-poweroff start-stop-daemon --start --background --make-pidfile \ --pidfile /run/dockz-shell.pid \ - --exec /usr/bin/socat -- \ + --exec /usr/bin/socat -- $RELAY_OPTS \ VSOCK-LISTEN:2378,reuseaddr,fork EXEC:'/bin/sh -i',stderr eend $? } diff --git a/guest/shrink-disk-inside-vm.sh b/guest/shrink-disk-inside-vm.sh new file mode 100644 index 0000000..aaedc49 --- /dev/null +++ b/guest/shrink-disk-inside-vm.sh @@ -0,0 +1,90 @@ +#!/bin/sh +# Runs INSIDE the Alpine netboot builder VM, driven over the serial console by +# DiskShrinker (sources/dockz/disk-shrinker.swift). Shrinks an existing DockZ +# disk (GPT: vda1 ESP, vda2 ext4 root — the last partition) so the host can +# truncate the image to TARGET_SECTORS. ext4 can only be shrunk unmounted, +# which is why this runs here and not in the guest itself. +# +# Env: TARGET_SECTORS — new disk size in 512-byte sectors +# HEADROOM_BYTES — free space the shrunk filesystem must still have +# +# Markers for the host (one line each): +# DOCKZ-SHRINK-STEP: