try an alternate pod approach

This commit is contained in:
41666 2023-12-22 18:26:03 -05:00
parent 524f13e541
commit 3cfc693b62
4 changed files with 30 additions and 0 deletions

View file

@ -5,6 +5,8 @@
../../server.nix
../../features/systemd-boot.nix
../../features/podman.nix
../../stacks/ps2.live
];
networking.hostName = "blueberry";

View file

@ -0,0 +1,5 @@
{...}: {
imports = [
./saerro.nix
];
}

View file

@ -0,0 +1,10 @@
{ ... }: let
podConfig = (import ../stack-utils.nix).pod "saerro" [
"saerro_postgres"
"saerro_maint"
"saerro_api"
"saerro_ws"
] [ 8003 ];
in podConfig // {
}

View file

@ -0,0 +1,13 @@
{
pod = { pkgs, ... }: podName: containers: ports: {
systemd.services."ensure-pod_${podName}" = let
in {
serviceConfig.Type = "oneshot";
wantedBy = map (x: "podman-${x}.service") containers;
script = ''
${pkgs.podman}/bin/podman pod exists ${podName} || \\
${pkgs.podman}/bin/podman pod create -n ${podName} ${map (x: "-p 0.0.0.0:${x}:${x}") portFlags}
'';
};
};
}