diff --git a/nixos/hosts/asxpio-ops/apps.nix b/nixos/hosts/asxpio-ops/apps.nix index f93c1b0..c3a282c 100644 --- a/nixos/hosts/asxpio-ops/apps.nix +++ b/nixos/hosts/asxpio-ops/apps.nix @@ -2,53 +2,15 @@ # repository: CI copies a compose file and a .env to /opt/ and runs # `docker compose up -d` as user deploy. blog, czsk, datacenterbingo and # asxpio run on asxpio-services from their flakes (apps.nix there). -# -# Their compose files still expect the Docker-era storage stack: a -# network named "storage" and the hosts "postgres" and "garage" on it. -# Postgres and Garage are native services now, so every container on -# this host resolves those two names to the host, and the network exists -# empty. Nothing in the app repositories has to change for the move; -# dropping the storage network from their compose files is a later -# clean-up. -{ config, pkgs, ... }: -let - hosts = pkgs.writeText "container-hosts" '' - 10.10.0.10 postgres garage - ''; -in +{ ... }: { - virtualisation.containers.containersConf.settings.containers.base_hosts_file = "${hosts}"; - # The API service (the socket the Docker CLI and Traefik use) reads it - # at start only - systemd.services.podman.restartTriggers = [ hosts ]; - - # After a reboot the apps come back once their networks, database and - # object store are there + # After a reboot the containers come back once their network is there systemd.services.podman-restart = { - after = [ - "podman-network-traefik.service" - "podman-network-storage.service" - "postgresql.service" - "garage.service" - ]; - wants = [ - "podman-network-traefik.service" - "podman-network-storage.service" - ]; + after = [ "podman-network-traefik.service" ]; + wants = [ "podman-network-traefik.service" ]; }; # `docker compose up --build` (vhpbot-prod builds on the host) starts # BuildKit in a privileged container asxpio.security.containers."buildx_buildkit_.*" = [ "privileged" ]; - - systemd.services.podman-network-storage = { - description = "Podman network storage (empty; see apps.nix)"; - wantedBy = [ "multi-user.target" ]; - path = [ config.virtualisation.podman.package ]; - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - }; - script = "podman network exists storage || podman network create storage"; - }; } diff --git a/nixos/hosts/asxpio-ops/garage.nix b/nixos/hosts/asxpio-ops/garage.nix index 56beef6..5e430c2 100644 --- a/nixos/hosts/asxpio-ops/garage.nix +++ b/nixos/hosts/asxpio-ops/garage.nix @@ -79,7 +79,6 @@ in ExecStart = lib.mkForce "${garage}/bin/garage server --single-node"; }; }; - networking.firewall.interfaces."podman*".allowedTCPPorts = [ 3900 ]; asxpio.security.ports = [ "tcp/3900-3902/garage" ]; # `garage` for root, e.g. garage status, garage bucket list diff --git a/nixos/hosts/asxpio-ops/postgres.nix b/nixos/hosts/asxpio-ops/postgres.nix index 49a821f..f01ce98 100644 --- a/nixos/hosts/asxpio-ops/postgres.nix +++ b/nixos/hosts/asxpio-ops/postgres.nix @@ -20,16 +20,13 @@ in services.postgresql = { enable = true; package = pkgs.postgresql_18; - # App containers connect from Podman's networks; the firewall decides - # who reaches the port + # The apps on asxpio-services connect over the private network; the + # firewall admits only the private networks to the port enableTCPIP = true; authentication = '' - host all all 10.88.0.0/16 scram-sha-256 - host all all 10.89.0.0/16 scram-sha-256 host asxpio bingo,asxpio 10.10.0.20/32 scram-sha-256 ''; }; - networking.firewall.interfaces."podman*".allowedTCPPorts = [ 5432 ]; asxpio.security.loginUsers = [ "postgres" ]; asxpio.security.ports = [ "tcp/5432/.postgres-wrapp" ];