delete postgresql

This commit is contained in:
chaos 2024-07-20 12:29:16 +01:00
parent a32dd6dbf3
commit e2a2fd286a
No known key found for this signature in database
4 changed files with 0 additions and 145 deletions

View file

@ -1,46 +0,0 @@
{
self,
hostPath,
tree,
inputs,
config,
pkgs,
...
}: let
containerAddresses = import "${hostPath}/data/containerAddresses.nix";
hostIP = containerAddresses.host;
containerIP = containerAddresses.containers.postgresql;
in {
containers.postgresql = {
autoStart = true;
privateNetwork = true;
hostAddress = hostIP;
localAddress = containerIP;
specialArgs = {
inherit inputs;
inherit tree;
inherit self;
inherit hostPath;
};
config = {...}: {
nixpkgs.pkgs = pkgs;
imports = with tree;
[
presets.nixos.containerBase
./secrets.nix
]
++ (with hosts.hetzner-arm.containers.postgresql.profiles; [
postgres
restic
]);
networking.firewall.allowedTCPPorts = [5432];
home-manager.users.root.home.stateVersion = "24.05";
system.stateVersion = "24.05";
};
};
}

View file

@ -1,24 +0,0 @@
{hostPath, ...}: let
#wireguardData = import "${self}/data/wireguard/chaosInternalWireGuard.nix";
#wireguardHosts = wireguardData.hosts;
localContainersAddresses = import "${hostPath}/data/containerAddresses.nix";
in {
services.postgresql = {
enable = true;
enableTCPIP = true;
ensureDatabases = [
"gotosocial"
];
ensureUsers = [
{
name = "gotosocial";
ensureDBOwnership = true;
}
];
# If the host is a local container then use the container's IP
# otherwise use the host's IP
authentication = ''
host gotosocial gotosocial ${localContainersAddresses.containers."social"}/32 trust
'';
};
}

View file

@ -1,40 +0,0 @@
{
self,
pkgs,
config,
...
}: let
inherit (config.services.secrets) secrets;
backupSchedules = import "${self}/data/backupSchedules.nix";
backupPrepareCommand = "${
(pkgs.writeShellScriptBin "backupPrepareCommand" ''
systemctl start remotePostgreSQLBackup-gotosocial --wait
'')
}/bin/backupPrepareCommand";
in {
services.restic.backups.postgresql = {
user = "root";
paths = [
"/var/backup/postgresql"
];
repository = "s3:s3.eu-central-003.backblazeb2.com/Chaos-Backups/Restic/PostgreSQL";
passwordFile = "${secrets.restic_password.path}";
environmentFile = "${secrets.restic_env.path}";
createWrapper = true;
pruneOpts = ["--keep-last 10"];
timerConfig = backupSchedules.restic.high;
inherit backupPrepareCommand;
};
services.postgreSQLRemoteBackup = {
enable = true;
backupUser = "postgres";
databases = [
"gotosocial"
];
};
}

View file

@ -1,35 +0,0 @@
{...}: {
services.secrets = {
enable = true;
vaultLogin = {
enable = true;
loginUsername = "hetzner-arm-container-postgresql";
};
requiredVaultPaths = [
"api-keys/data/backblaze/Chaos-Backups"
"private-public-keys/data/restic/PostgreSQL"
];
secrets = {
vault_password = {
manual = true;
};
restic_password = {
fetchScript = ''
simple_get "/private-public-keys/restic/PostgreSQL" .password > "$secretFile"
'';
};
restic_env = {
fetchScript = ''
cat << EOF > "$secretFile"
AWS_ACCESS_KEY_ID=$(simple_get "/api-keys/backblaze/Chaos-Backups" .keyID)
AWS_SECRET_ACCESS_KEY=$(simple_get "/api-keys/backblaze/Chaos-Backups" .applicationKey)
EOF
'';
};
};
};
}