Why
I have always liked the idea of re-producible builds and environments, but never had the dicipline to fully lock all of my dependencies so the next best thing is to keep the development environment reasonably fixed except for intentional changes/rebuilds.
Changelog
Trimming the volume images
Every volume is a sparse image on the Mac, attached as a disk that advertises discard but mounted without it, so every block the guest ever wrote stayed allocated on the host: 130 GB for 8.6 GB in use, and the Mac’s disk at 99%. A supervisor program now runs fstrim on each ext4 volume at boot and daily, skipping any volume whose superblock carries the error flag. Those get an offline repair from the Mac side instead: stop the VM, clone the image, e2fsck, trim, restart.
Apple Container Polish
After bodging together much of the container to get it running and swapping over from the web based VS Code to “native” + Remote, I finally got around to:
- Standing up a proper supervisord config and having it as the init
- Migrating the toolchains I use over to mise instead of installs half baked into the image and half resting in my home directory.
- JuiceFS adjustments
- Litestream backups for JuiceFS SQLite metadata
- Local + Remote (in-homelab) Buildkit configuration
Move from Docker Desktop to Apple Containers
Apple semi-recently produced an open source tool called container which allows one to run Linux containers. I have been interested in an alternative to Docker Desktop because it always “felt” heavy, but that could have been because I was using the localized/built-in Kubernetes deployment as well. I was originally prompted to look at it through the announcement of “Container Machines” but eventually I settled on a long-lived container. It’s a long command but does the job.
container run "$@" --name dev --cpus 6 --memory 24G --network default,mtu=1500 --detach --cap-add ALL -p 127.0.0.1:5555:22 --env TAILSCALE_ROUTES="" --env TAILSCALE_ROUTES6="" --env HOMELAB_LAN_ROUTES="" --mount type=volume,source=homedir,target=/home/coder --mount type=volume,source=sshkeys,target=/etc/ssh/hostkeys --mount type=bind,source=/Users/dmf/ide-cache,target=/juice/cache --mount type=bind,source=/Users/dmf/ide-metadata,target=/juice/meta localdev:latest