From 6d6653c1ed7c8a247b484bc318f2f33d4a6a1d71 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Thu, 12 Feb 2026 23:13:57 +0100 Subject: [PATCH] docs: migrate "Managing VMs" section to "Quick Start" --- docs/faq.md | 2 +- docs/integrations/packer.md | 41 ++++++++ docs/integrations/vm-management.md | 145 ----------------------------- docs/quick-start.md | 100 ++++++++++++++++++++ mkdocs.yml | 5 +- 5 files changed, 146 insertions(+), 147 deletions(-) create mode 100644 docs/integrations/packer.md delete mode 100644 docs/integrations/vm-management.md diff --git a/docs/faq.md b/docs/faq.md index 74f2912..3c51a90 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -184,7 +184,7 @@ security unlock-keychain login.keychain This command also supports the `-p` command-line argument that allows you to supply a password and unlock non-interactively, which is great for scripts. -Alternatively, you can pass the credentials via the environment variables, see [Registry Authorization](integrations/vm-management.md#registry-authorization) for more details on how to do that. +Alternatively, you can pass the credentials via the environment variables, see [Registry Authorization](quick-start.md#registry-authorization) for more details on how to do that. ## How is Tart different from Anka? diff --git a/docs/integrations/packer.md b/docs/integrations/packer.md new file mode 100644 index 0000000..2de9be3 --- /dev/null +++ b/docs/integrations/packer.md @@ -0,0 +1,41 @@ +--- +title: Automating VM image building with Packer +description: Use Packer to build custom VM images, configure VMs and work with remote OCI registries. +--- + +Please refer to [Tart Packer Plugin repository](https://github.com/cirruslabs/packer-plugin-tart) for setup instructions. +Here is an example of a template to build a local image based of a remote image: + +```hcl +packer { + required_plugins { + tart = { + version = ">= 0.5.3" + source = "github.com/cirruslabs/tart" + } + } +} + +source "tart-cli" "tart" { + vm_base_name = "ghcr.io/cirruslabs/macos-sequoia-base:latest" + vm_name = "my-custom-sequoia" + cpu_count = 4 + memory_gb = 8 + disk_size_gb = 70 + ssh_password = "admin" + ssh_timeout = "120s" + ssh_username = "admin" +} + +build { + sources = ["source.tart-cli.tart"] + + provisioner "shell" { + inline = ["echo 'Disabling spotlight indexing...'", "sudo mdutil -a -i off"] + } + + # more provisioners +} +``` + +Here is a [repository with Packer templates](https://github.com/cirruslabs/macos-image-templates) used to build [all the images managed by us](https://github.com/orgs/cirruslabs/packages?tab=packages&q=macos). diff --git a/docs/integrations/vm-management.md b/docs/integrations/vm-management.md deleted file mode 100644 index 9e85341..0000000 --- a/docs/integrations/vm-management.md +++ /dev/null @@ -1,145 +0,0 @@ ---- -title: Managing Virtual Machine -description: Use Packer to build custom VM images, configure VMs and work with remote OCI registries. ---- - -# Managing Virtual Machine - -## Creating from scratch - -Tart supports macOS and Linux virtual machines. All commands like `run` and `pull` work the same way regardless of the underlying OS a particular VM image has. -The only difference is how such VM images are created. Please check sections below for [macOS](#creating-a-macos-vm-image-from-scratch) and [Linux](#creating-a-linux-vm-image-from-scratch) instructions. - -### Creating a macOS VM image from scratch - -Tart can create VMs from `*.ipsw` files. You can download a specific `*.ipsw` file [here](https://ipsw.me/) or you can -use `latest` instead of a path to `*.ipsw` to download the latest available version: - -```bash -tart create --from-ipsw=latest sequoia-vanilla -tart run sequoia-vanilla -``` - -After the initial booting of the VM, you'll need to manually go through the macOS installation process. As a convention we recommend creating an `admin` user with an `admin` password. After the regular installation please do some additional modifications in the VM: - -1. Enable Auto-Login. Users & Groups -> Login Options -> Automatic login -> admin. -2. Allow SSH. Sharing -> Remote Login -3. Disable Lock Screen. Preferences -> Lock Screen -> disable "Require Password" after 5. -4. Disable Screen Saver. -5. Run `sudo visudo` in Terminal, find `%admin ALL=(ALL) ALL` add `admin ALL=(ALL) NOPASSWD: ALL` to allow sudo without a password. - -### Creating a Linux VM image from scratch - -Linux VMs are supported on hosts running macOS 13.0 (Ventura) or newer. - -```bash -# Create a bare VM -tart create --linux ubuntu - -# Install Ubuntu -tart run --disk focal-desktop-arm64.iso ubuntu - -# Run VM -tart run ubuntu -``` - -After the initial setup please make sure your VM can be SSH-ed into by running the following commands inside your VM: - -```bash -sudo apt update -sudo apt install -y openssh-server -sudo ufw allow ssh -``` - -## Configuring a VM - -By default, a Tart VM uses 2 CPUs and 4 GB of memory with a `1024x768` display. This can be changed after VM creation with `tart set` command. -Please refer to `tart set --help` for additional details. - -## Building with Packer - -Please refer to [Tart Packer Plugin repository](https://github.com/cirruslabs/packer-plugin-tart) for setup instructions. -Here is an example of a template to build a local image based of a remote image: - -```hcl -packer { - required_plugins { - tart = { - version = ">= 0.5.3" - source = "github.com/cirruslabs/tart" - } - } -} - -source "tart-cli" "tart" { - vm_base_name = "ghcr.io/cirruslabs/macos-sequoia-base:latest" - vm_name = "my-custom-sequoia" - cpu_count = 4 - memory_gb = 8 - disk_size_gb = 70 - ssh_password = "admin" - ssh_timeout = "120s" - ssh_username = "admin" -} - -build { - sources = ["source.tart-cli.tart"] - - provisioner "shell" { - inline = ["echo 'Disabling spotlight indexing...'", "sudo mdutil -a -i off"] - } - - # more provisioners -} -``` - -Here is a [repository with Packer templates](https://github.com/cirruslabs/macos-image-templates) used to build [all the images managed by us](https://github.com/orgs/cirruslabs/packages?tab=packages&q=macos). - -## Working with a Remote OCI Container Registry - -Tart supports interacting with Open Container Initiative (OCI) registries, but only runs images created and pushed by Tart. This means images created for container engines, like Docker, can't be pulled. Instead, create a custom image as documented above. - -For example, let's say you want to push/pull images to an OCI registry hosted at `https://acme.io/`. - -### Registry Authorization - -First, you need to login to `acme.io` with the `tart login` command: - -```bash -tart login acme.io -``` - -If you login to your registry with OAuth, you may need to create an access token to use as the password. -Credentials are securely stored in Keychain. - -In addition, Tart supports [Docker credential helpers](https://docs.docker.com/engine/reference/commandline/login/#credential-helpers) -if defined in `~/.docker/config.json`. - -Finally, `TART_REGISTRY_USERNAME` and `TART_REGISTRY_PASSWORD` environment variables allow to override authorization -for all registries, which might be useful for integrating with your CI's secret management. - -You can also set the `TART_REGISTRY_HOSTNAME` environment variable to apply these overrides only to a specific host. - -### Pushing a Local Image - -Once credentials are saved for `acme.io`, run the following command to push a local images remotely with two tags: - -```bash -tart push my-local-vm-name acme.io/remoteorg/name:latest acme.io/remoteorg/name:v1.0.0 -``` - -### Pulling a Remote Image - -You can either pull an image: - -```bash -tart pull acme.io/remoteorg/name:latest -``` - -or create a VM from a remote image: - -```bash -tart clone acme.io/remoteorg/name:latest my-local-vm-name -``` - -If the specified image is not already present, this invocation calls the `tart pull` implicitly before cloning. diff --git a/docs/quick-start.md b/docs/quick-start.md index ec053df..30021b5 100644 --- a/docs/quick-start.md +++ b/docs/quick-start.md @@ -99,6 +99,57 @@ ssh admin@$(tart ip sequoia-base) sshpass -p admin ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null" admin@$(tart ip sequoia-base) < script.sh ``` +## Creating VM images + +Tart supports macOS and Linux virtual machines. All commands like `run` and `pull` work the same way regardless of the underlying OS a particular VM image has. +The only difference is how such VM images are created. Please check sections below for [macOS](#creating-a-macos-vm-image-from-scratch) and [Linux](#creating-a-linux-vm-image-from-scratch) instructions. + +### Creating a macOS VM image from scratch + +Tart can create VMs from `*.ipsw` files. You can download a specific `*.ipsw` file [here](https://ipsw.me/) or you can +use `latest` instead of a path to `*.ipsw` to download the latest available version: + +```bash +tart create --from-ipsw=latest sequoia-vanilla +tart run sequoia-vanilla +``` + +After the initial booting of the VM, you'll need to manually go through the macOS installation process. As a convention we recommend creating an `admin` user with an `admin` password. After the regular installation please do some additional modifications in the VM: + +1. Enable Auto-Login. Users & Groups -> Login Options -> Automatic login -> admin. +2. Allow SSH. Sharing -> Remote Login +3. Disable Lock Screen. Preferences -> Lock Screen -> disable "Require Password" after 5. +4. Disable Screen Saver. +5. Run `sudo visudo` in Terminal, find `%admin ALL=(ALL) ALL` add `admin ALL=(ALL) NOPASSWD: ALL` to allow sudo without a password. + +### Creating a Linux VM image from scratch + +Linux VMs are supported on hosts running macOS 13.0 (Ventura) or newer. + +```bash +# Create a bare VM +tart create --linux ubuntu + +# Install Ubuntu +tart run --disk focal-desktop-arm64.iso ubuntu + +# Run VM +tart run ubuntu +``` + +After the initial setup please make sure your VM can be SSH-ed into by running the following commands inside your VM: + +```bash +sudo apt update +sudo apt install -y openssh-server +sudo ufw allow ssh +``` + +### Configuring a VM + +By default, a Tart VM uses 2 CPUs and 4 GB of memory with a `1024x768` display. This can be changed after VM creation with `tart set` command. +Please refer to `tart set --help` for additional details. + ## Mounting directories To mount a directory, run the VM with the `--dir` argument: @@ -161,3 +212,52 @@ The directory we've mounted above will be accessible from the `/mnt/shared/proje ```shell com.apple.virtio-fs.automount /mnt/shared virtiofs rw,relatime 0 0 ``` + +## Working with a Remote OCI Container Registry + +Tart supports interacting with Open Container Initiative (OCI) registries, but only runs images created and pushed by Tart. This means images created for container engines, like Docker, can't be pulled. Instead, create a custom image as documented above. + +For example, let's say you want to push/pull images to an OCI registry hosted at `https://acme.io/`. + +### Registry Authorization + +First, you need to login to `acme.io` with the `tart login` command: + +```bash +tart login acme.io +``` + +If you login to your registry with OAuth, you may need to create an access token to use as the password. +Credentials are securely stored in Keychain. + +In addition, Tart supports [Docker credential helpers](https://docs.docker.com/engine/reference/commandline/login/#credential-helpers) +if defined in `~/.docker/config.json`. + +Finally, `TART_REGISTRY_USERNAME` and `TART_REGISTRY_PASSWORD` environment variables allow to override authorization +for all registries, which might be useful for integrating with your CI's secret management. + +You can also set the `TART_REGISTRY_HOSTNAME` environment variable to apply these overrides only to a specific host. + +### Pushing a Local Image + +Once credentials are saved for `acme.io`, run the following command to push a local images remotely with two tags: + +```bash +tart push my-local-vm-name acme.io/remoteorg/name:latest acme.io/remoteorg/name:v1.0.0 +``` + +### Pulling a Remote Image + +You can either pull an image: + +```bash +tart pull acme.io/remoteorg/name:latest +``` + +or create a VM from a remote image: + +```bash +tart clone acme.io/remoteorg/name:latest my-local-vm-name +``` + +If the specified image is not already present, this invocation calls the `tart pull` implicitly before cloning. diff --git a/mkdocs.yml b/mkdocs.yml index 0a30a49..c4f9e4f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -53,6 +53,9 @@ plugins: debug: true - search - minify + - redirects: + redirect_maps: + 'integrations/vm-management.md': quick-start.md markdown_extensions: - markdown.extensions.admonition @@ -96,7 +99,7 @@ nav: - "GitHub Actions": https://cirrus-runners.app/ - "GitLab Runner": integrations/gitlab-runner.md - "Buildkite": integrations/buildkite.md - - "Managing VMs": integrations/vm-management.md + - "Packer": integrations/packer.md - "Support & Licensing": licensing.md - "Orchestration": - "Quick Start": orchard/quick-start.md