drone: ensure docker starts before trying to

create docker network drone-net with systemd dependencies
This commit is contained in:
teutat3s 2023-02-25 17:53:47 +01:00
parent 1199820574
commit 94cc00572e
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1

View file

@ -31,12 +31,16 @@
"d '/var/lib/drone-db' 0750 drone drone - -" "d '/var/lib/drone-db' 0750 drone drone - -"
]; ];
system.activationScripts.mkDroneNet = let systemd.services."docker-network-drone" = let
docker = config.virtualisation.oci-containers.backend; docker = config.virtualisation.oci-containers.backend;
dockerBin = "${pkgs.${docker}}/bin/${docker}"; dockerBin = "${pkgs.${docker}}/bin/${docker}";
in '' in {
serviceConfig.Type = "oneshot";
before = ["docker-drone-server.service"];
script = ''
${dockerBin} network inspect drone-net >/dev/null 2>&1 || ${dockerBin} network create drone-net --subnet 172.20.0.0/24 ${dockerBin} network inspect drone-net >/dev/null 2>&1 || ${dockerBin} network create drone-net --subnet 172.20.0.0/24
''; '';
};
virtualisation = { virtualisation = {
docker = { docker = {