dixie: use script attr for dropsonde-pg-setup (ExecStart heredoc+bash path broken)

This commit is contained in:
2026-09-25 00:51:32 -07:00
parent c402c1c599
commit 0ac90515bf
+3 -4
View File
@@ -154,6 +154,7 @@ in
description = "dropsonde2: set dropsonde role password + create extensions"; description = "dropsonde2: set dropsonde role password + create extensions";
wants = [ "postgresql-setup.service" ]; wants = [ "postgresql-setup.service" ];
after = [ "postgresql-setup.service" "postgresql.service" ]; after = [ "postgresql-setup.service" "postgresql.service" ];
path = [ config.services.postgresql.package ];
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; RemainAfterExit = true;
@@ -162,8 +163,8 @@ in
Restart = "on-failure"; Restart = "on-failure";
RestartSec = "10s"; RestartSec = "10s";
LoadCredential = [ "dropsonde-pg-password:/root/dropsonde-pg" ]; LoadCredential = [ "dropsonde-pg-password:/root/dropsonde-pg" ];
ExecStart = ''${pkgs.coreutils}/bin/bash <<'BASH' };
set -euo pipefail script = ''
pw=$(cat "$CREDENTIALS_DIRECTORY/dropsonde-pg-password") pw=$(cat "$CREDENTIALS_DIRECTORY/dropsonde-pg-password")
psql -v ON_ERROR_STOP=1 -v pw="$pw" -d postgres <<'SQL' psql -v ON_ERROR_STOP=1 -v pw="$pw" -d postgres <<'SQL'
ALTER ROLE dropsonde WITH LOGIN PASSWORD :'pw'; ALTER ROLE dropsonde WITH LOGIN PASSWORD :'pw';
@@ -174,9 +175,7 @@ CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS h3; CREATE EXTENSION IF NOT EXISTS h3;
CREATE EXTENSION IF NOT EXISTS h3_postgis CASCADE; CREATE EXTENSION IF NOT EXISTS h3_postgis CASCADE;
SQL SQL
BASH
''; '';
};
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
}; };
}; };