try an alternate pod approach
This commit is contained in:
parent
524f13e541
commit
3cfc693b62
4 changed files with 30 additions and 0 deletions
|
@ -5,6 +5,8 @@
|
|||
../../server.nix
|
||||
../../features/systemd-boot.nix
|
||||
../../features/podman.nix
|
||||
|
||||
../../stacks/ps2.live
|
||||
];
|
||||
|
||||
networking.hostName = "blueberry";
|
||||
|
|
5
nixos/stacks/ps2.live/default.nix
Normal file
5
nixos/stacks/ps2.live/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
./saerro.nix
|
||||
];
|
||||
}
|
10
nixos/stacks/ps2.live/saerro.nix
Normal file
10
nixos/stacks/ps2.live/saerro.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ ... }: let
|
||||
podConfig = (import ../stack-utils.nix).pod "saerro" [
|
||||
"saerro_postgres"
|
||||
"saerro_maint"
|
||||
"saerro_api"
|
||||
"saerro_ws"
|
||||
] [ 8003 ];
|
||||
in podConfig // {
|
||||
|
||||
}
|
13
nixos/stacks/stack-utils.nix
Normal file
13
nixos/stacks/stack-utils.nix
Normal 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}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue