Open afbjorklund opened 10 months ago
The hardware resources are specified by the user, matching the external:
vmType: ext
arch: "aarch64"
cpus: 4
memory: 512MiB
disk: 32GiB
mounts:
- location: "~"
- location: "/tmp/lima"
writable: true
ssh:
address: raspberrypi.local
The OS installation is supposed to be aligned, but is not using the "images".
e.g. you would use the cloud web interface or the SD card image for Ubuntu
Note that since machine start and stop are handled externally, it only affects the hostagent.
The user is supposed to install and start the guestagent, and to install containerd/buildkitd.
start
INFO[0000] Using the existing instance "raspberrypi"
INFO[0000] Starting the instance "raspberrypi" with VM driver "ext"
INFO[0001] [hostagent] hostagent socket created at /home/anders/.lima/raspberrypi/ha.sock
INFO[0001] SSH Local Port: 22
INFO[0001] [hostagent] Waiting for the essential requirement 1 of 3: "ssh"
INFO[0002] [hostagent] The essential requirement 1 of 3 is satisfied
INFO[0002] [hostagent] Waiting for the essential requirement 2 of 3: "sshfs binary to be installed"
INFO[0003] [hostagent] The essential requirement 2 of 3 is satisfied
INFO[0003] [hostagent] Waiting for the essential requirement 3 of 3: "/etc/fuse.conf (/etc/fuse3.conf) to contain \"user_allow_other\""
INFO[0003] [hostagent] The essential requirement 3 of 3 is satisfied
INFO[0003] [hostagent] Mounting "/home/anders" on "/home/anders"
INFO[0004] [hostagent] Mounting "/tmp/lima" on "/tmp/lima"
INFO[0004] [hostagent] Running system provision 1 of 2
INFO[0005] [hostagent] Running user provision 2 of 2
INFO[0005] [hostagent] Waiting for the optional requirement 1 of 4: "systemd must be available"
INFO[0005] [hostagent] Forwarding "/run/lima-guestagent.sock" (guest) to "/home/anders/.lima/raspberrypi/ga.sock" (host)
INFO[0005] [hostagent] The optional requirement 1 of 4 is satisfied
INFO[0005] [hostagent] Waiting for the optional requirement 2 of 4: "containerd binaries to be installed"
INFO[0005] [hostagent] The optional requirement 2 of 4 is satisfied
INFO[0005] [hostagent] Waiting for the optional requirement 3 of 4: "user probe 1/2"
INFO[0005] [hostagent] The optional requirement 3 of 4 is satisfied
INFO[0005] [hostagent] Waiting for the optional requirement 4 of 4: "user probe 2/2"
INFO[0005] [hostagent] The optional requirement 4 of 4 is satisfied
INFO[0005] [hostagent] Waiting for the guest agent to be running
INFO[0005] [hostagent] Guest agent is running
INFO[0005] READY. Run `limactl shell raspberrypi` to open the shell.
stop
INFO[0000] Sending SIGINT to hostagent process 9881
INFO[0000] Waiting for the host agent and the driver processes to shut down
INFO[0000] [hostagent] Received SIGINT, shutting down the host agent
INFO[0000] [hostagent] Shutting down the host agent
INFO[0000] [hostagent] Stopping forwarding "/run/lima-guestagent.sock" (guest) to "/home/anders/.lima/raspberrypi/ga.sock" (host)
INFO[0000] [hostagent] Unmounting "/home/anders"
INFO[0000] [hostagent] Unmounting "/tmp/lima"
The external server keeps running, including lima-guestagent and friends.
Now also includes support for provisioning, as shown in the above output.
provision:
- mode: system
script: |
#!/bin/sh
touch /tmp/foo
- mode: user
script: |
#!/bin/bash
set -eux -o pipefail
touch /tmp/bar
probes:
- script: |
#!/bin/bash
set -eux -o pipefail
if ! timeout 10 bash -c "until test -e /tmp/foo >/dev/null 2>&1; do sleep 3; done"; then
echo >&2 "foo is not touched yet"
exit 1
fi
- script: |
#!/bin/bash
set -eux -o pipefail
if ! timeout 10 bash -c "until test -e /tmp/bar >/dev/null 2>&1; do sleep 3; done"; then
echo >&2 "bar is not touched yet"
exit 1
fi
Changed output for non-localhost:
INFO[0001] SSH Local Port: 22
Into a slightly more interesting IP:
INFO[0001] SSH IP Address: 192.168.0.113
Description
Add a generic driver for external virtual machines and physical servers.
It is similar to running
ssh
, but includes all the Lima features like agent.The user is supposed to have an existing server, with key-based ssh login.
Previously it was hardcoding
127.0.0.1
as the hostnameHost keys are being used (and should be set up), to verify the external server.
Previously it was hardcoding
StrictHostKeyChecking=no
A
guest-install
command is added, to install lima-guestagent and nerdctl-full.The external machine lifecycle (boot/reboot/etc) is managed outside of Lima.
2000
2028
Tested with Digital Ocean, and with Raspberry Pi.
Note: this driver does not create cloud instances.