make docker swarm persistent using virtiofs share

This commit is contained in:
Pim Kunis 2024-02-05 22:45:09 +01:00
parent 17f110b183
commit cf57391629

View file

@ -81,7 +81,7 @@
type = "virtual"; type = "virtual";
hypervisorName = "lewis"; hypervisorName = "lewis";
nixosModule = { pkgs, lib, ... }: { nixosModule = { pkgs, lib, config, ... }: {
lab.vm = { lab.vm = {
id = 1; id = 1;
staticNetworking = true; staticNetworking = true;
@ -89,6 +89,14 @@
staticIPv6 = "2a0d:6e00:1a77:30::42"; staticIPv6 = "2a0d:6e00:1a77:30::42";
}; };
microvm.shares = [{
source = "/var/lib/microvms/${config.networking.hostName}/shares/docker_swarm";
mountPoint = "/var/lib/docker/swarm";
tag = "docker_swarm";
proto = "virtiofs";
socket = "docker_swarm.sock";
}];
networking = { networking = {
nftables.enable = lib.mkForce false; nftables.enable = lib.mkForce false;
firewall.enable = lib.mkForce false; firewall.enable = lib.mkForce false;
@ -112,9 +120,17 @@
type = "virtual"; type = "virtual";
hypervisorName = "lewis"; hypervisorName = "lewis";
nixosModule = { pkgs, lib, ... }: { nixosModule = { pkgs, lib, config, ... }: {
lab.vm.id = 2; lab.vm.id = 2;
microvm.shares = [{
source = "/var/lib/microvms/${config.networking.hostName}/shares/docker_swarm";
mountPoint = "/var/lib/docker/swarm";
tag = "docker_swarm";
proto = "virtiofs";
socket = "docker_swarm.sock";
}];
networking = { networking = {
nftables.enable = lib.mkForce false; nftables.enable = lib.mkForce false;
firewall.enable = lib.mkForce false; firewall.enable = lib.mkForce false;