[docs] add local persistent microvm usage
This commit is contained in:
@@ -12,14 +12,44 @@ Use durruti as orientation:
|
|||||||
"10.0.0.5" is the IP assigned to its tap interface.
|
"10.0.0.5" is the IP assigned to its tap interface.
|
||||||
|
|
||||||
### Testing MicroVMs locally
|
### Testing MicroVMs locally
|
||||||
MicroVMs can be built and run easily on your local host.
|
MicroVMs can be built and run easily on your local host, but they are not persistent!
|
||||||
For durruti this is done by:
|
For durruti for example this is done by:
|
||||||
``` bash
|
``` bash
|
||||||
sudo nix run .\#nixosConfigurations.durruti.config.microvm.declaredRunner
|
nix run .\#durruti-vm
|
||||||
|
```
|
||||||
|
|
||||||
|
### Testing persistent microvms
|
||||||
|
In order to test persistent microvms locally we need to create them using the ```microvm``` command.
|
||||||
|
This is necessary to be able to mount persistent /etc and /var volumes on those hosts.
|
||||||
|
Do the following:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# go into our repo and start the default dev shell (or us direnv)
|
||||||
|
nix develop .#
|
||||||
|
|
||||||
|
# create a microvm on your host (on the example of durruti)
|
||||||
|
sudo microvm -c durruti -f git+file:///home/username/path/to/infrastructure/repo
|
||||||
|
|
||||||
|
# start the vm
|
||||||
|
sudo systemctl start microvm@durruti.serivce
|
||||||
|
|
||||||
|
# this may fail, if so we most probably need to create /var /etc manually, then restart
|
||||||
|
sudo mkdir /var/lib/microvms/durruti/{var, etc}
|
||||||
|
|
||||||
|
# now you can for example get the rsa host key from /var/lib/microvms/durruti/etc/ssh/
|
||||||
|
|
||||||
|
# alternatively u can run the vm in interactive mode (maybe stop the microvm@durruti.service first)
|
||||||
|
microvm -r durruti
|
||||||
|
|
||||||
|
# after u made changes to the microvm update and restart the vm
|
||||||
|
microvm -uR durruti
|
||||||
|
|
||||||
|
# deleting the vm again:
|
||||||
|
sudo systemctl stop microvm@durruti.service
|
||||||
|
sudo systemctl stop microvm-virtiofsd@durruti.service
|
||||||
|
sudo rm -rf /var/lib/microvms/durruti
|
||||||
```
|
```
|
||||||
|
|
||||||
It seems to be necessary to run this as root so that the according tap interface can be created.
|
|
||||||
To be able to ping the VM or give Internet Access to the VM your host needs to be setup as described below.
|
|
||||||
|
|
||||||
### Host Setup
|
### Host Setup
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user