···4242- **⚙️ Configuration Files**: Define VM settings in a `vmconfig.toml` file for
4343 reproducible setups
4444- **🚀 Image-based VMs**: Run VMs directly from saved or pulled images
4545+- **🌐 HTTP API**: RESTful API for programmatic VM, image, and volume management
4646+ with bearer token authentication
45474648## 📋 Prerequisites
4749···186188dflybsd-up logout ghcr.io
187189```
188190191191+### HTTP API Server
192192+193193+```bash
194194+# Start the HTTP API server (default port: 8893)
195195+dflybsd-up serve
196196+197197+# Start on a custom port
198198+dflybsd-up serve --port 9000
199199+200200+# Set a custom API token via environment variable
201201+export DFLYBSD_UP_API_TOKEN="your-secure-token"
202202+dflybsd-up serve
203203+204204+# If no token is set, a random UUID will be generated and displayed
205205+```
206206+207207+The HTTP API provides RESTful endpoints for:
208208+209209+- **Machines**: List, create, start, stop, restart, inspect, and remove VMs
210210+- **Images**: Create, list and remove VM images
211211+- **Volumes**: List, create, inspect, and remove volumes
212212+213213+All endpoints require bearer token authentication. See the API documentation
214214+section below for detailed endpoint information.
215215+216216+## 🌐 HTTP API
217217+218218+The HTTP API server provides programmatic access to all dflybsd-up functionality
219219+through RESTful endpoints.
220220+221221+### Starting the API Server
222222+223223+```bash
224224+# Start with default settings (port 8893)
225225+dflybsd-up serve
226226+227227+# Custom port
228228+dflybsd-up serve --port 9000
229229+230230+# Set custom token via environment variable
231231+export DFLYBSD_UP_API_TOKEN="your-secure-token"
232232+dflybsd-up serve
233233+```
234234+235235+### Authentication
236236+237237+All API endpoints require bearer token authentication. Include the token in the
238238+`Authorization` header:
239239+240240+```bash
241241+curl -H "Authorization: Bearer your-token" http://localhost:8893/machines
242242+```
243243+244244+### API Endpoints
245245+246246+#### Machines
247247+248248+- **GET `/machines`** - List all machines
249249+ - Query params: `?all=true` to include stopped machines
250250+- **POST `/machines`** - Create a new machine
251251+ - Body:
252252+ `{ "image": "ghcr.io/tsirysndr/dragonflybsd:6.4.2", "cpus": 4, "memory": "4G", "bridge": "br0", "portForward": ["2222:22"], "volume": "volume-name" }`
253253+- **GET `/machines/:id`** - Get machine details
254254+- **POST `/machines/:id/start`** - Start a machine
255255+ - Body (optional):
256256+ `{ "cpus": 4, "memory": "4G", "cpu": "host", "portForward": ["2222:22"] }`
257257+- **POST `/machines/:id/stop`** - Stop a machine
258258+- **POST `/machines/:id/restart`** - Restart a machine
259259+ - Body (optional):
260260+ `{ "cpus": 4, "memory": "4G", "cpu": "host", "portForward": ["2222:22"] }`
261261+- **DELETE `/machines/:id`** - Remove a machine (must be stopped)
262262+263263+#### Images
264264+265265+- **GET `/images`** - List all local images
266266+- **POST `/images/pull`** - Pull an image from registry
267267+ - Body: `{ "image": "ghcr.io/user/image:tag" }`
268268+- **POST `/images/push`** - Push an image to registry
269269+ - Body: `{ "image": "ghcr.io/user/image:tag" }`
270270+- **POST `/images/tag`** - Tag a machine's image
271271+ - Body: `{ "vmName": "machine-name", "image": "ghcr.io/user/image:tag" }`
272272+- **DELETE `/images/:ref`** - Remove an image
273273+ - Path param: URL-encoded image reference
274274+275275+#### Volumes
276276+277277+- **GET `/volumes`** - List all volumes
278278+- **POST `/volumes`** - Create a new volume
279279+ - Body: `{ "name": "volume-name", "size": "20G", "format": "qcow2" }`
280280+- **GET `/volumes/:name`** - Get volume details
281281+- **DELETE `/volumes/:name`** - Remove a volume
282282+283283+### Example API Usage
284284+285285+```bash
286286+# List all machines
287287+curl -H "Authorization: Bearer your-token" \
288288+ http://localhost:8893/machines?all=true
289289+290290+# Create a new machine
291291+curl -X POST \
292292+ -H "Authorization: Bearer your-token" \
293293+ -H "Content-Type: application/json" \
294294+ -d '{"image":"ghcr.io/tsirysndr/dragonflybsd:6.4.2","cpus":4,"memory":"8G"}' \
295295+ http://localhost:8893/machines
296296+297297+# Start a machine
298298+curl -X POST \
299299+ -H "Authorization: Bearer your-token" \
300300+ -H "Content-Type: application/json" \
301301+ -d '{"cpus":8,"memory":"16G"}' \
302302+ http://localhost:8893/machines/clxy1234567890/start
303303+304304+# Pull an image
305305+curl -X POST \
306306+ -H "Authorization: Bearer your-token" \
307307+ -H "Content-Type: application/json" \
308308+ -d '{"image":"ghcr.io/tsirysndr/dragonfly:latest"}' \
309309+ http://localhost:8893/images/pull
310310+311311+# Create a volume
312312+curl -X POST \
313313+ -H "Authorization: Bearer your-token" \
314314+ -H "Content-Type: application/json" \
315315+ -d '{"name":"data-volume","size":"50G","format":"qcow2"}' \
316316+ http://localhost:8893/volumes
317317+```
318318+189319## ⚙️ Options
190320191321| Option | Short | Description | Default |
···232362detach = false
233363```
234364235235-When you run `dflybsd-up` without arguments, it will use the settings from this file. Command-line options override configuration file settings.
365365+When you run `dflybsd-up` without arguments, it will use the settings from this
366366+file. Command-line options override configuration file settings.
236367237368## 🔢 Version Format
238369···292423293424## � OCI Registry Integration
294425295295-The tool supports pushing and pulling VM images to/from OCI-compliant registries like Docker Hub, GitHub Container Registry (ghcr.io), and others.
426426+The tool supports pushing and pulling VM images to/from OCI-compliant registries
427427+like Docker Hub, GitHub Container Registry (ghcr.io), and others.
296428297429### Workflow
298430···329461### Supported Registries
330462331463- **GitHub Container Registry**: `ghcr.io`
332332-- **Docker Hub**: `docker.io` or just the image name (e.g., `username/image:tag`)
464464+- **Docker Hub**: `docker.io` or just the image name (e.g.,
465465+ `username/image:tag`)
333466- Any OCI-compliant registry that supports the OCI Distribution Specification
334467335468## �🗃️ Virtual Machine Management
···419552dflybsd-up 6.4.2 --image dragonfly.qcow2 --disk-format qcow2
420553```
421554422422-The `--install` option ensures that changes made during the VM session are written to the disk image, making them persistent across reboots.
555555+The `--install` option ensures that changes made during the VM session are
556556+written to the disk image, making them persistent across reboots.
423557424558## 🔐 SSH Access
425559