Use pod instead of network bridge

This commit is contained in:
2023-06-10 17:29:01 +01:00
parent 9fc98e78cd
commit 9c0db7e23f

View File

@ -74,23 +74,17 @@ with lib.my;
wantedBy = [ "default.target" ];
};
systemd.services.init-container-networking = {
description = "Create a network bridge for containers on this host";
systemd.services.podman-create-downloads-pod = {
description = "Create a pod for download-related containers on this host";
after = [ "network.target" ];
wantedBy = [ "default.target" ];
wantedBy = [ "podman-qbittorrent.service" ];
path = [ pkgs.zfs ];
serviceConfig.Type = "oneshot";
script = let
docker = config.virtualisation.oci-containers.backend;
dockerBin = "${pkgs.${docker}}/bin/${docker}";
podmanBin = "${pkgs.podman}/bin/podman";
in ''
check=$(${dockerBin} network ls | grep "library-br" || true)
if [ -z "$check" ]; then
${dockerBin} network create library-br
else
echo "library-br already exists"
fi
${podmanBin} pod exists downloads-pod || ${podmanBin} pod create --name downloads-pod
'';
};
@ -137,7 +131,7 @@ with lib.my;
];
extraOptions = [
"--label=io.containers.autoupdate=registry"
"--network=library-br"
"--pod=downloads-pod"
];
dependsOn = [ "jellyfin" ];
};
@ -155,7 +149,7 @@ with lib.my;
];
extraOptions = [
"--label=io.containers.autoupdate=registry"
"--network=library-br"
"--pod=downloads-pod"
];
};
radarr = {
@ -169,7 +163,7 @@ with lib.my;
extraOptions = [
"--label=io.containers.autoupdate=registry"
"--mount=type=bind,source=/mnt/library/movies,target=/movies"
"--network=library-br"
"--pod=downloads-pod"
];
dependsOn = [ "qbittorrent" ];
};
@ -184,7 +178,7 @@ with lib.my;
extraOptions = [
"--label=io.containers.autoupdate=registry"
"--mount=type=bind,source=/mnt/library/tv,target=/tv"
"--network=library-br"
"--pod=downloads-pod"
];
dependsOn = [ "qbittorrent" ];
};