···17- ๐ฅ **Automatic ISO download**: Downloads NetBSD ISO images from official CDN
18- ๐ท๏ธ **Version-aware**: Specify NetBSD versions and automatically construct
19 download URLs
20-- ๐ **Flexible input**: Support for local ISO files, URLs, version numbers, or OCI registry images
021- โ๏ธ **Configurable VM settings**: Customize CPU, memory, cores, and disk
22 options via CLI or configuration file
23- โก **KVM acceleration**: Automatically enables hardware virtualization for
···33 configurations
34- ๐ท๏ธ **Auto-naming**: Automatic generation of unique VM names
35- ๐ **Bridge networking**: Support for custom network bridges
36-- ๐ฆ **OCI Registry Support**: Pull, push, and tag VM images to/from OCI-compliant registries (GitHub Container Registry, Docker Hub, etc.)
037- ๐ผ๏ธ **Image Management**: List and remove local VM images
38-- ๐ **Configuration File**: Initialize and use `vmconfig.toml` for persistent VM settings
000003940## ๐ Requirements
41···260# Custom port forwarding (SSH on port 2222, HTTP on port 8080)
261netbsd-up --port-forward "2222:22,8080:80"
262000263# Combine multiple options
264netbsd-up --memory 8G --cpus 4 --detach --port-forward "3000:3000"
265```
···279| `--detach` | `-d` | Run VM in the background and print VM name | `false` |
280| `--port-forward` | `-p` | Port forwarding rules (format: hostPort:guestPort) | None |
281| `--install` | | Persist changes to the VM disk image | `false` |
0282283## ๐ง VM Management Commands
284285-| Command | Description |
286-| -------------------------------- | ------------------------------------------------------- |
287-| `netbsd-up init` | Initialize a default VM configuration file |
288-| `netbsd-up ps` | List all running virtual machines |
289-| `netbsd-up ps --all` | List all virtual machines (including stopped) |
290-| `netbsd-up start <name>` | Start a stopped virtual machine |
291-| `netbsd-up start <name> -d` | Start a virtual machine in background (detached) |
292-| `netbsd-up stop <name>` | Stop a running virtual machine |
293-| `netbsd-up restart <name>` | Restart a virtual machine |
294-| `netbsd-up inspect <name>` | Show detailed information about a VM |
295-| `netbsd-up rm <name>` | Remove a virtual machine from database |
296-| `netbsd-up logs <name>` | View logs for a virtual machine |
297-| `netbsd-up logs <name> -f` | Follow logs in real-time |
298-| `netbsd-up pull <image>` | Pull VM image from OCI registry |
299-| `netbsd-up push <image>` | Push VM image to OCI registry |
300-| `netbsd-up tag <vm-name> <image>`| Tag a VM with an image name |
301-| `netbsd-up run <image>` | Create and run a VM from an image |
302-| `netbsd-up images` | List all local VM images |
303-| `netbsd-up rmi <image>` | Remove a local VM image |
304-| `netbsd-up login <registry>` | Authenticate to an OCI registry |
305-| `netbsd-up logout <registry>` | Logout from an OCI registry |
0000000306307## ๐ Examples
308···462netbsd-up logout ghcr.io
463```
464000000000000000000000000000000000000000465## ๐ Networking
466467The VM supports flexible networking configurations:
···514## ๐พ Data Storage
515516NetBSD-UP uses a SQLite database (`~/.netbsd-up/state.sqlite`) to track virtual
517-machine states and configurations. The database stores:
518519- VM names and unique identifiers
520- CPU, memory, and disk configurations
···523- Creation and update timestamps
524- Process IDs for running VMs
525- Log file locations for each VM
0526527### ๐ VM Logging
528···536## ๏ฟฝ OCI Registry Support
537538NetBSD-UP supports pulling and pushing VM images to OCI-compliant registries
539-such as GitHub Container Registry (ghcr.io), Docker Hub (docker.io), and
540-others. This enables sharing and distributing pre-configured NetBSD VMs.
541542### ๐ Authentication
543···587588## ๐ VM Configuration File
589590-NetBSD-UP supports using a `vmconfig.toml` file for persistent VM
591-configuration. This is useful for reproducible VM setups.
592593### Creating a Configuration File
594···620621CLI options will override configuration file settings.
622623-## ๏ฟฝ๐ License
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000624625See [LICENSE](LICENSE) file for details.
626
···17- ๐ฅ **Automatic ISO download**: Downloads NetBSD ISO images from official CDN
18- ๐ท๏ธ **Version-aware**: Specify NetBSD versions and automatically construct
19 download URLs
20+- ๐ **Flexible input**: Support for local ISO files, URLs, version numbers, or
21+ OCI registry images
22- โ๏ธ **Configurable VM settings**: Customize CPU, memory, cores, and disk
23 options via CLI or configuration file
24- โก **KVM acceleration**: Automatically enables hardware virtualization for
···34 configurations
35- ๐ท๏ธ **Auto-naming**: Automatic generation of unique VM names
36- ๐ **Bridge networking**: Support for custom network bridges
37+- ๐ฆ **OCI Registry Support**: Pull, push, and tag VM images to/from
38+ OCI-compliant registries (GitHub Container Registry, Docker Hub, etc.)
39- ๐ผ๏ธ **Image Management**: List and remove local VM images
40+- ๐ **Configuration File**: Initialize and use `vmconfig.toml` for persistent
41+ VM settings
42+- ๐ฝ **Volume Management**: Create, list, inspect, and remove persistent volumes
43+- ๐ **Volume Attachment**: Attach persistent volumes to VMs for data storage
44+- ๐ **HTTP API**: RESTful API for managing machines, images, and volumes
45+ programmatically
4647## ๐ Requirements
48···267# Custom port forwarding (SSH on port 2222, HTTP on port 8080)
268netbsd-up --port-forward "2222:22,8080:80"
269270+# Attach a volume to the VM
271+netbsd-up start my-vm --volume my-data-volume
272+273# Combine multiple options
274netbsd-up --memory 8G --cpus 4 --detach --port-forward "3000:3000"
275```
···289| `--detach` | `-d` | Run VM in the background and print VM name | `false` |
290| `--port-forward` | `-p` | Port forwarding rules (format: hostPort:guestPort) | None |
291| `--install` | | Persist changes to the VM disk image | `false` |
292+| `--volume` | `-v` | Name of the volume to attach to the VM | None |
293294## ๐ง VM Management Commands
295296+| Command | Description |
297+| --------------------------------- | ------------------------------------------------ |
298+| `netbsd-up init` | Initialize a default VM configuration file |
299+| `netbsd-up ps` | List all running virtual machines |
300+| `netbsd-up ps --all` | List all virtual machines (including stopped) |
301+| `netbsd-up start <name>` | Start a stopped virtual machine |
302+| `netbsd-up start <name> -d` | Start a virtual machine in background (detached) |
303+| `netbsd-up start <name> -v <vol>` | Start a VM and attach a volume |
304+| `netbsd-up stop <name>` | Stop a running virtual machine |
305+| `netbsd-up restart <name>` | Restart a virtual machine |
306+| `netbsd-up inspect <name>` | Show detailed information about a VM |
307+| `netbsd-up rm <name>` | Remove a virtual machine from database |
308+| `netbsd-up logs <name>` | View logs for a virtual machine |
309+| `netbsd-up logs <name> -f` | Follow logs in real-time |
310+| `netbsd-up pull <image>` | Pull VM image from OCI registry |
311+| `netbsd-up push <image>` | Push VM image to OCI registry |
312+| `netbsd-up tag <vm-name> <image>` | Tag a VM with an image name |
313+| `netbsd-up run <image>` | Create and run a VM from an image |
314+| `netbsd-up run <image> -v <vol>` | Run a VM from an image with an attached volume |
315+| `netbsd-up images` | List all local VM images |
316+| `netbsd-up rmi <image>` | Remove a local VM image |
317+| `netbsd-up login <registry>` | Authenticate to an OCI registry |
318+| `netbsd-up logout <registry>` | Logout from an OCI registry |
319+| `netbsd-up volumes` | List all volumes |
320+| `netbsd-up volume rm <name>` | Remove a volume |
321+| `netbsd-up volume inspect <name>` | Inspect a volume |
322+| `netbsd-up serve` | Start the HTTP API server |
323+| `netbsd-up serve -p <port>` | Start the HTTP API server on a specific port |
324325## ๐ Examples
326···480netbsd-up logout ghcr.io
481```
482483+### ๐ฝ Volume Management Examples
484+485+```bash
486+# List all volumes
487+netbsd-up volumes
488+489+# Start a VM with a volume attached
490+netbsd-up start my-vm --volume my-data-volume
491+492+# Run a VM from an image with a volume
493+netbsd-up run ghcr.io/tsirysndr/netbsd:10.1 --volume db-storage
494+495+# Inspect a volume
496+netbsd-up volume inspect my-data-volume
497+498+# Remove a volume
499+netbsd-up volume rm my-data-volume
500+```
501+502+### ๐ HTTP API Examples
503+504+```bash
505+# Start the API server
506+netbsd-up serve
507+508+# Start on custom port
509+netbsd-up serve --port 9000
510+511+# List all machines via API
512+curl -H "Authorization: Bearer your-token" http://localhost:8892/machines
513+514+# Start a machine via API
515+curl -X POST -H "Authorization: Bearer your-token" \
516+ http://localhost:8892/machines/my-vm/start
517+518+# List all volumes via API
519+curl -H "Authorization: Bearer your-token" http://localhost:8892/volumes
520+```
521+522## ๐ Networking
523524The VM supports flexible networking configurations:
···571## ๐พ Data Storage
572573NetBSD-UP uses a SQLite database (`~/.netbsd-up/state.sqlite`) to track virtual
574+machine states, configurations, and volumes. The database stores:
575576- VM names and unique identifiers
577- CPU, memory, and disk configurations
···580- Creation and update timestamps
581- Process IDs for running VMs
582- Log file locations for each VM
583+- Volume information and attachments
584585### ๐ VM Logging
586···594## ๏ฟฝ OCI Registry Support
595596NetBSD-UP supports pulling and pushing VM images to OCI-compliant registries
597+such as GitHub Container Registry (ghcr.io), Docker Hub (docker.io), and others.
598+This enables sharing and distributing pre-configured NetBSD VMs.
599600### ๐ Authentication
601···645646## ๐ VM Configuration File
647648+NetBSD-UP supports using a `vmconfig.toml` file for persistent VM configuration.
649+This is useful for reproducible VM setups.
650651### Creating a Configuration File
652···678679CLI options will override configuration file settings.
680681+## ๐ฝ Volume Management
682+683+NetBSD-UP supports persistent volumes that can be attached to VMs for data
684+storage. Volumes are stored as disk images in `~/.netbsd-up/volumes/` and
685+persist independently of VM lifecycles.
686+687+### Creating and Using Volumes
688+689+Volumes are automatically created when you attach them to a VM:
690+691+```bash
692+# Start a VM with a volume (volume is created if it doesn't exist)
693+netbsd-up start my-vm --volume my-data-volume
694+695+# Run a new VM from an image with an attached volume
696+netbsd-up run ghcr.io/tsirysndr/netbsd:10.1 --volume db-storage
697+```
698+699+### Managing Volumes
700+701+```bash
702+# List all volumes
703+netbsd-up volumes
704+705+# Inspect a volume
706+netbsd-up volume inspect my-data-volume
707+708+# Remove a volume
709+netbsd-up volume rm my-data-volume
710+```
711+712+### Volume Features
713+714+- ๐ฆ **Persistent Storage**: Volumes persist independently of VMs
715+- ๐ **Reusable**: Attach the same volume to different VMs
716+- ๐พ **Automatic Creation**: Volumes are created on first use
717+- ๐ **Tracking**: All volumes are tracked in the SQLite database
718+719+## ๐ HTTP API
720+721+NetBSD-UP includes a RESTful HTTP API for programmatic management of machines,
722+images, and volumes. The API is protected by bearer token authentication.
723+724+### Starting the API Server
725+726+```bash
727+# Start on default port (8892)
728+netbsd-up serve
729+730+# Start on custom port
731+netbsd-up serve --port 9000
732+733+# Set API token via environment variable
734+export NETBSD_UP_API_TOKEN="your-secure-token"
735+netbsd-up serve
736+```
737+738+If no `NETBSD_UP_API_TOKEN` is set, a random token will be generated and
739+displayed.
740+741+### API Endpoints
742+743+The API provides the following endpoints:
744+745+#### Machines
746+747+- `GET /machines` - List all machines
748+- `GET /machines/:id` - Get machine details
749+- `POST /machines` - Create a new machine
750+- `POST /machines/:id/start` - Start a machine
751+- `POST /machines/:id/stop` - Stop a machine
752+- `POST /machines/:id/restart` - Restart a machine
753+- `DELETE /machines/:id` - Remove a machine
754+755+#### Images
756+757+- `GET /images` - List all images
758+- `GET /images/:name` - Get image details
759+- `POST /images/pull` - Pull an image from registry
760+- `POST /images/push` - Push an image to registry
761+- `DELETE /images/:name` - Remove an image
762+763+#### Volumes
764+765+- `GET /volumes` - List all volumes
766+- `GET /volumes/:name` - Get volume details
767+- `POST /volumes` - Create a volume
768+- `DELETE /volumes/:name` - Remove a volume
769+770+### API Authentication
771+772+All API endpoints require bearer token authentication:
773+774+```bash
775+# Example API request
776+curl -H "Authorization: Bearer your-token" http://localhost:8892/machines
777+```
778+779+### Environment Variables
780+781+- `NETBSD_UP_API_TOKEN` - Set the API authentication token
782+- `NETBSD_UP_PORT` - Set the default API server port
783+784+## ๐ License
785786See [LICENSE](LICENSE) file for details.
787