Merge pull request #106 from DarkKirb/revert-105-high-available-potsgresq

Revert "Add replicated postgresql"
This commit is contained in:
Charlotte 🦝 Delenk 2022-12-16 10:01:43 +01:00 committed by GitHub
commit 3f70d54c01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 10 additions and 183 deletions

View file

@ -14,7 +14,6 @@
./server.nix ./server.nix
./wireguard/public-server.nix ./wireguard/public-server.nix
./services/named-submissive.nix ./services/named-submissive.nix
./services/postgres/high-available.nix
]; ];
boot.initrd.availableKernelModules = ["xhci_pci" "virtio_pci" "usbhid"]; boot.initrd.availableKernelModules = ["xhci_pci" "virtio_pci" "usbhid"];
@ -76,7 +75,6 @@
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"L /var/lib/acme - - - - /persist/var/lib/acme" "L /var/lib/acme - - - - /persist/var/lib/acme"
"L /var/lib/postgresql - - - - /persist/var/lib/postgresql"
]; ];
networking.wireguard.interfaces."wg0".ips = ["fd0d:a262:1fa6:e621:746d:4523:5c04:1453/64"]; networking.wireguard.interfaces."wg0".ips = ["fd0d:a262:1fa6:e621:746d:4523:5c04:1453/64"];

View file

@ -15,7 +15,7 @@
./services/named.nix ./services/named.nix
./services/grafana.nix ./services/grafana.nix
./users/miifox.nix ./users/miifox.nix
./services/postgres ./services/postgres.nix
./services/gitea.nix ./services/gitea.nix
./services/old-homepage.nix ./services/old-homepage.nix
./services/postfixadmin.nix ./services/postfixadmin.nix
@ -30,7 +30,6 @@
./services/peertube ./services/peertube
./services/rspamd.nix ./services/rspamd.nix
./wireguard/public-server.nix ./wireguard/public-server.nix
./services/postgres/high-available.nix
]; ];
boot.initrd.availableKernelModules = ["ata_piix" "virtio_pci" "virtio_scsi" "xhci_pci" "sd_mod" "sr_mod"]; boot.initrd.availableKernelModules = ["ata_piix" "virtio_pci" "virtio_scsi" "xhci_pci" "sd_mod" "sr_mod"];

View file

@ -18,7 +18,7 @@
nixos-hardware.nixosModules.common-cpu-amd nixos-hardware.nixosModules.common-cpu-amd
nixos-hardware.nixosModules.common-gpu-amd nixos-hardware.nixosModules.common-gpu-amd
nixos-hardware.nixosModules.common-pc-ssd nixos-hardware.nixosModules.common-pc-ssd
./services/postgres ./services/postgres.nix
./services/drone-runner-docker.nix ./services/drone-runner-docker.nix
./services/gitlab-runner ./services/gitlab-runner
]; ];

View file

@ -18,7 +18,7 @@
''; '';
in { in {
imports = [ imports = [
./postgres ./postgres.nix
../../modules/hydra.nix ../../modules/hydra.nix
]; ];
services.hydra = { services.hydra = {

View file

@ -19,7 +19,7 @@
services.prometheus.exporters.postgres = { services.prometheus.exporters.postgres = {
enable = true; enable = true;
user = "postgres"; user = "postgres";
listenAddress = (import ../../../utils/getInternalIP.nix config).listenIP; listenAddress = (import ../../utils/getInternalIP.nix config).listenIP;
}; };
networking.firewall.interfaces."wg0".allowedTCPPorts = [9187]; networking.firewall.interfaces."wg0".allowedTCPPorts = [9187];
} }

View file

@ -1,49 +0,0 @@
{
config,
pkgs,
lib,
hapsql,
...
}: let
internalIP = (import ../../../utils/getInternalIP.nix config).listenIP;
haNodes = ["[fd0d:a262:1fa6:e621:b4e1:08ff:e658:6f49]" "[fd0d:a262:1fa6:e621:746d:4523:5c04:1453]"];
in {
imports = [
hapsql.nixosModule
];
services.hapsql = {
enable = true;
nodeName = config.networking.hostName;
nodeAddress = internalIP;
cluster = {
scope = "chirrs";
nodes = builtins.filter (a: a != internalIP) haNodes;
ports = {
raft = 49921;
postgres = 2428;
restApi = 56708;
};
};
postgresqlPackage = pkgs.postgresql_15.withPackages (ps: with ps; [rum]);
prometheus = {
enable-postgres-exporter = true;
};
};
services.patroni2 = {
postgresql.data_dir = "/var/lib/postgresql/15";
bootstrap = {
pg_hba = [
"host replication replicator fd0d:a262:1fa6:e621:b4e1:08ff:e658:6f49/128 md5"
"host replication replicator fd0d:a262:1fa6:e621:746d:4523:5c04:1453/128 md5"
"host all all 0.0.0.0/0 md5"
"host all all ::/0 md5"
];
};
};
networking.firewall.interfaces."wg0".allowedTCPPorts = [
49921
2428
56708
];
users.users.postgres.home = lib.mkForce "/var/lib/postgresql";
}

View file

@ -18,7 +18,7 @@
nixos-hardware.nixosModules.lenovo-thinkpad-t470s nixos-hardware.nixosModules.lenovo-thinkpad-t470s
nixos-hardware.nixosModules.common-cpu-intel-kaby-lake nixos-hardware.nixosModules.common-cpu-intel-kaby-lake
nixos-hardware.nixosModules.common-pc-ssd nixos-hardware.nixosModules.common-pc-ssd
./services/postgres ./services/postgres.nix
]; ];
hardware.cpu.intel.updateMicrocode = true; hardware.cpu.intel.updateMicrocode = true;

View file

@ -143,31 +143,6 @@
"type": "github" "type": "github"
} }
}, },
"hapsql": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"patroni": "patroni",
"prometheus-keepalived-exporter": "prometheus-keepalived-exporter",
"sops-nix": [
"sops-nix"
]
},
"locked": {
"lastModified": 1668373073,
"narHash": "sha256-jevN2P7euK8hWc7iEF40cW2UfQsqurHL2Ccw4vz0S6s=",
"ref": "refs/heads/master",
"rev": "daf95d1e1e7f0270ac82edd7231d9daed0106a0d",
"revCount": 21,
"type": "git",
"url": "https://git.sr.ht/~bwolf/hapsql.nix"
},
"original": {
"type": "git",
"url": "https://git.sr.ht/~bwolf/hapsql.nix"
}
},
"haskell-flake": { "haskell-flake": {
"locked": { "locked": {
"lastModified": 1668096377, "lastModified": 1668096377,
@ -235,7 +210,7 @@
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"utils": "utils_3" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1670970889, "lastModified": 1670970889,
@ -509,28 +484,6 @@
"type": "github" "type": "github"
} }
}, },
"patroni": {
"inputs": {
"nixpkgs": [
"hapsql",
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1668372943,
"narHash": "sha256-JSbuXzu1cHuu3NbQzRDs3ExPUP89xTNWfTRJG/vzOqg=",
"ref": "refs/heads/master",
"rev": "0e0e7c4e82f6583efc8cec47904e0a8deb92191f",
"revCount": 16,
"type": "git",
"url": "https://git.sr.ht/~bwolf/patroni.nix"
},
"original": {
"type": "git",
"url": "https://git.sr.ht/~bwolf/patroni.nix"
}
},
"plasma-manager": { "plasma-manager": {
"inputs": { "inputs": {
"home-manager": [ "home-manager": [
@ -577,28 +530,6 @@
"type": "github" "type": "github"
} }
}, },
"prometheus-keepalived-exporter": {
"inputs": {
"nixpkgs": [
"hapsql",
"nixpkgs"
],
"utils": "utils_2"
},
"locked": {
"lastModified": 1662960295,
"narHash": "sha256-4nOsFasQ463Zf8TAlUBydtr5FS+ivpNNcfyWeAdsyNw=",
"ref": "refs/heads/master",
"rev": "52fe5366dde3d5a9ee8562fff5b0502544921dd0",
"revCount": 5,
"type": "git",
"url": "https://git.sr.ht/~bwolf/prometheus-keepalived-exporter.nix"
},
"original": {
"type": "git",
"url": "https://git.sr.ht/~bwolf/prometheus-keepalived-exporter.nix"
}
},
"root": { "root": {
"inputs": { "inputs": {
"dns": "dns", "dns": "dns",
@ -606,7 +537,6 @@
"emanote": "emanote", "emanote": "emanote",
"flake-parts": "flake-parts_2", "flake-parts": "flake-parts_2",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"hapsql": "hapsql",
"haskell-flake": "haskell-flake_2", "haskell-flake": "haskell-flake_2",
"home-manager": "home-manager", "home-manager": "home-manager",
"hosts-list": "hosts-list", "hosts-list": "hosts-list",
@ -692,36 +622,6 @@
"repo": "flake-utils", "repo": "flake-utils",
"type": "github" "type": "github"
} }
},
"utils_2": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"utils_3": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -22,11 +22,6 @@ rec {
inputs.nixpkgs-lib.follows = "nixpkgs"; inputs.nixpkgs-lib.follows = "nixpkgs";
}; };
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
hapsql = {
url = "git+https://git.sr.ht/~bwolf/hapsql.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.sops-nix.follows = "sops-nix";
};
haskell-flake.url = "github:srid/haskell-flake"; haskell-flake.url = "github:srid/haskell-flake";
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";

View file

@ -21,14 +21,6 @@ root:
password: password:
root: ENC[AES256_GCM,data:wGFQ73r7XiOQ5HTtVwZfJu10Y0ZkBQ4YWm2MUCXyJy0kS2lh942aCOOobn+ZgDwZe2/esaaZi3UZ1sjmAMsRe4E5Fv6eJRXeqa7Ym+3Wj8LsssWIWBX06CkCS/LADUIUekcmDfGq5KLvIA==,iv:lvcSkngLc7phKVsFO0QooID62iI7Cm+qoYvW2nRo9Js=,tag:jTOBdy+EBrxMm5jyy8m3PA==,type:str] root: ENC[AES256_GCM,data:wGFQ73r7XiOQ5HTtVwZfJu10Y0ZkBQ4YWm2MUCXyJy0kS2lh942aCOOobn+ZgDwZe2/esaaZi3UZ1sjmAMsRe4E5Fv6eJRXeqa7Ym+3Wj8LsssWIWBX06CkCS/LADUIUekcmDfGq5KLvIA==,iv:lvcSkngLc7phKVsFO0QooID62iI7Cm+qoYvW2nRo9Js=,tag:jTOBdy+EBrxMm5jyy8m3PA==,type:str]
darkkirb: ENC[AES256_GCM,data:ji+aKSQgrVNSASAr23hRppGLnANXKD5CI+pRk6Lb4DHsVd+U0enDu68SAR6vh5xt5t2NlICdnN6K5IlS8DQvNWC+3X5IJb5F0dfBZYcTnu2FdmX1D2XyoniJw2z4Pd2YZLB6+fiVmgcL2g==,iv:GExkGbbImSDOXc8nGD3vGbBr7AIa0ArhaOaV8rOnWGk=,tag:pZB/IBZzNL9Cuv/xNRY3sA==,type:str] darkkirb: ENC[AES256_GCM,data:ji+aKSQgrVNSASAr23hRppGLnANXKD5CI+pRk6Lb4DHsVd+U0enDu68SAR6vh5xt5t2NlICdnN6K5IlS8DQvNWC+3X5IJb5F0dfBZYcTnu2FdmX1D2XyoniJw2z4Pd2YZLB6+fiVmgcL2g==,iv:GExkGbbImSDOXc8nGD3vGbBr7AIa0ArhaOaV8rOnWGk=,tag:pZB/IBZzNL9Cuv/xNRY3sA==,type:str]
patroni:
postgresql:
replication:
password: ENC[AES256_GCM,data:Rtvp3uFW5i8Ql2rmkqJEqwdePXvqcRH2pc1UVn1MIlBmbSupklkdnObnB6GHDPLpNB8e7WS3pg3DW7PoNCtTHQ==,iv:ON96cAS/TIxUwGePwhRQdwe/e4VEZ7AJrZbS5SpB5GY=,tag:qlUhxoGriNrYHnf8xJkK0Q==,type:str]
superuser:
password: ENC[AES256_GCM,data:biKsnCeSvrF+ALiflH0wbn+k9Lu+WUQinojSsRZKcQ3Btez/8x4BYM3FGekG+bKM+YGjYOb3hTEuElbes4KhLw==,iv:fhGxZ3RlRyJ0h+1m8pycHI+eHaYTZ6WUwJGiSNtyvdU=,tag:XLtU+ZhBz5Ea9K0iZpZVQg==,type:str]
rewind:
password: ENC[AES256_GCM,data:3SFUf/vesfzA8lM/ND/89yvJga5SNBFilRZNdDCw3wfCBmqtWnQB5P3BuEvR1Ccao6H9dKQuEn32EQVZcVqCrw==,iv:JiseXAZGflG3JtL+jMkZ4N1jAutTvyuAxIuGHbTMvZc=,tag:ZrVCC6M3xtXss5zXoFKtiQ==,type:str]
sops: sops:
kms: [] kms: []
gcp_kms: [] gcp_kms: []
@ -44,8 +36,8 @@ sops:
bVJUcDZLWTk3MiszOWp4enRRQmNsajQKF8QJs/Wb0SqnvsQEkRKlS1Ms9xLIdyvZ bVJUcDZLWTk3MiszOWp4enRRQmNsajQKF8QJs/Wb0SqnvsQEkRKlS1Ms9xLIdyvZ
QCFAPclaOfaTLTiRJWXjDneBkMBduYKkRPiXCR+Bn7i4z8ixLXFmWw== QCFAPclaOfaTLTiRJWXjDneBkMBduYKkRPiXCR+Bn7i4z8ixLXFmWw==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
lastmodified: "2022-12-15T18:48:50Z" lastmodified: "2022-12-14T15:34:13Z"
mac: ENC[AES256_GCM,data:Mg8cfwxhjPfJHHwEI3R+ZMeJUzl/caVc/V3UxDwV4VIeAT/d+WDVtdanF6ro4SyELbR9PdWC5q8wLTlpoz/CAjQvoPI3WEmYMtxmMBuZATy86EWz07FEltaod0yYcDvQ1RW24Km3gWrghHMBQUehijG+xHI84jvv8o+LL+ItktI=,iv:47ms+YmKjNC7wnox4Lpxp0m4eyMDJ+BNYI7JUokvyWk=,tag:sRL/JO7MKbFcf3gx064r9g==,type:str] mac: ENC[AES256_GCM,data:9DHLfOjTVKWbsWiUDr7pu5pyh6dzoExcgjRsAd2HMtdu+R/Y04Zy5dbCJpFu4mvyRD9GJ5aI4hufYRLvFsTuO9k8aWNUbqb1IYnX+D6zzLlecCHxEJ6zhm0PhjkcuN0XxFhBQb/aCUaisP891PqHM8ZbXblIaCdl4FFX/me3Cls=,iv:MnMInA14AxnCPjLYvksSdZVfpvcIjpbLSQRMbzSYr2M=,tag:eQsCwg6S60FpZ4bxaBMiJg==,type:str]
pgp: pgp:
- created_at: "2022-12-14T15:34:13Z" - created_at: "2022-12-14T15:34:13Z"
enc: | enc: |

View file

@ -73,14 +73,6 @@ email:
password: password:
root: ENC[AES256_GCM,data:AmwmR4I14s8mGTJidm4yEys1pPlLSRWoL9632IZSM1pAgV1H27KZIi+z00JUqnkvaCwuOsUH77tl9cSIK3UN1GUMbMaev3Ltln8hshRIYXN/bgg7K2JlZ5rwjLYjvxbwEBGEG8mBubHSvg==,iv:uoUiZ7t0u2ezAI1cwf86YxQ30hTlu6o7g3avzyBKWn8=,tag:Agn3UgC6PO5TdegGNHiZPw==,type:str] root: ENC[AES256_GCM,data:AmwmR4I14s8mGTJidm4yEys1pPlLSRWoL9632IZSM1pAgV1H27KZIi+z00JUqnkvaCwuOsUH77tl9cSIK3UN1GUMbMaev3Ltln8hshRIYXN/bgg7K2JlZ5rwjLYjvxbwEBGEG8mBubHSvg==,iv:uoUiZ7t0u2ezAI1cwf86YxQ30hTlu6o7g3avzyBKWn8=,tag:Agn3UgC6PO5TdegGNHiZPw==,type:str]
darkkirb: ENC[AES256_GCM,data:DSecZ2Fw8akFfzor30x/lPVztZcaxM5YT2gTsFYJxV/GQHODy9htHT7blTU4tWzAJsUXqFo/GzcBIwyJZ1ox3jVpAqznaBuQxslrgMurb6T47wsUcbjmX6bkDGra4iQEYrRPyXlJgKpmlw==,iv:XY4S3skY2zbq771Y3Tva2povZRfcXEOhweajzvI1ebk=,tag:DrHRNFgYpNWCPIY1zbURKg==,type:str] darkkirb: ENC[AES256_GCM,data:DSecZ2Fw8akFfzor30x/lPVztZcaxM5YT2gTsFYJxV/GQHODy9htHT7blTU4tWzAJsUXqFo/GzcBIwyJZ1ox3jVpAqznaBuQxslrgMurb6T47wsUcbjmX6bkDGra4iQEYrRPyXlJgKpmlw==,iv:XY4S3skY2zbq771Y3Tva2povZRfcXEOhweajzvI1ebk=,tag:DrHRNFgYpNWCPIY1zbURKg==,type:str]
patroni:
postgresql:
replication:
password: ENC[AES256_GCM,data:iMbwJTCn0IQ7rm/W5+vVLyHCKQfFpkGDXb0lNQJtAO/GBioQ8TLcp5djhAlHljCt6uKCPqkQaN5PxRvAijUQUw==,iv:rmbgTxYEL5ANJqoDZatzXGflg9nDbbsD9/1jb26RFME=,tag:wB9YV997ForDjJxZWSYaig==,type:str]
superuser:
password: ENC[AES256_GCM,data:dxAfTgyDtiNNhFfjmfgZIdTZf4H4RktD7uX7ywKSOOkLkrQRbbrM43voxC4hiCPNKfDXOKODLTYKdoFz0UZQBw==,iv:sT44JwP4dNIfE9ImohTvPt0XNlFucJCHIsALZ8oT/O0=,tag:XCxegdIMJhwLLejv1RpQFg==,type:str]
rewind:
password: ENC[AES256_GCM,data:8svavhNeEtOTKfoUNmlEamlGy0bS1GnefUvTpPs624ied3nXc9lhOyg1ZT4tXY5OmL9Qy7Xzr0YgTLJt19dQVA==,iv:y8+Pl251pHoZQK70uJQ44odKSXTcBSyEykprQOyHN08=,tag:BbZJnEQOiTol+UrrzQnoHw==,type:str]
sops: sops:
kms: [] kms: []
gcp_kms: [] gcp_kms: []
@ -96,8 +88,8 @@ sops:
N1lNTTRhSDFsczd4VjNudUU2NEt4MUEKdVJIJmaoGcwUHa0BGB45jqYnm9aPVZxP N1lNTTRhSDFsczd4VjNudUU2NEt4MUEKdVJIJmaoGcwUHa0BGB45jqYnm9aPVZxP
dl1vkMx8EAiKhWKbBwQm5fFZcNh371rspGE7KOXmwNbNWef5bVfHpQ== dl1vkMx8EAiKhWKbBwQm5fFZcNh371rspGE7KOXmwNbNWef5bVfHpQ==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
lastmodified: "2022-12-15T18:49:04Z" lastmodified: "2022-12-14T16:46:00Z"
mac: ENC[AES256_GCM,data:WyZHDnHUtzyD7G9B1pZ61u4RdMf3TkQK8DUFNS1+fnT5ix0T9N/tMq9xgD1xvkey8PJpoSXeAPcCGlom8VwyWOw0reiJXGIgXd5jW28YSOlP8Sqtq+G37vSavCFfvtEI0ZwCt9mtB+hPvzGQK5n0mRb8LvuQQlZThji+yMSDPfo=,iv:trpJ/FVMlbGXkvwTRJjiu/ewfs8uq5twkj26gmPrVd8=,tag:U7km68CPWBu/QQlnhbRMCw==,type:str] mac: ENC[AES256_GCM,data:SZUAvmTDVMfzCU8j9FS4zGIHUpwyHFYC2ybPrgiISOO4ka1LAR+8FgsY9SAkI0to6BV/Ha6sf8GyTYzJhtwnhDiTzsd0nmi+ZRJHVb7wZfvUEsKr69XoYhjx4cO3hhCIhBgminxqctSnx4wtR4mxtoisTImm6hxbZOW4FL3Tbu4=,iv:5Qo/fYBph6pbhNTS44ibuyMbli4ojMeGQkQVdtMveRo=,tag:w4xzhjFXiuJT9Jw0ELUXTg==,type:str]
pgp: pgp:
- created_at: "2022-02-02T17:50:42Z" - created_at: "2022-02-02T17:50:42Z"
enc: | enc: |