nix-config/hosts/buzzrelay/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

87 lines
2.2 KiB
Nix
Raw Permalink Normal View History

2023-01-06 23:56:02 +01:00
{ config, pkgs, ... }:
2022-12-19 20:57:43 +01:00
{
2023-01-06 23:24:02 +01:00
c3d2 = {
deployment.server = "server10";
hq.statistics.enable = true;
};
microvm = {
2023-09-05 22:22:48 +02:00
mem = 1024;
2022-12-19 20:57:43 +01:00
vcpu = 8;
};
2023-01-06 23:24:02 +01:00
networking.hostName = "buzzrelay";
# Don't let journald spam the disk
services.journald.extraConfig = ''
Storage=volatile
'';
2022-12-19 20:57:43 +01:00
2023-01-06 23:24:02 +01:00
sops = {
defaultSopsFile = ./secrets.yaml;
secrets = {
"buzzrelay/privKey".owner = config.services.buzzrelay.user;
"buzzrelay/pubKey".owner = config.services.buzzrelay.user;
"buzzrelay/redis/password".owner = config.services.buzzrelay.user;
2023-01-06 23:24:02 +01:00
};
};
2023-01-06 23:24:02 +01:00
services = {
buzzrelay = {
enable = true;
hostName = "relay.fedi.buzz";
privKeyFile = config.sops.secrets."buzzrelay/privKey".path;
pubKeyFile = config.sops.secrets."buzzrelay/pubKey".path;
redis = {
connection = "redis://fedi.buzz:6379/";
passwordFile = config.sops.secrets."buzzrelay/redis/password".path;
};
2023-01-06 23:24:02 +01:00
};
nginx = {
enable = true;
virtualHosts."relay.fedi.buzz" = {
forceSSL = true;
enableACME = true;
locations."/".proxyPass = "http://127.0.0.1:${toString config.services.buzzrelay.listenPort}/";
};
2022-12-19 22:28:04 +01:00
};
2023-01-06 23:24:02 +01:00
2023-01-06 23:56:02 +01:00
postgresql = {
2023-09-27 00:01:22 +02:00
package = pkgs.postgresql_16;
2023-01-06 23:56:02 +01:00
settings.log_min_duration_statement = 50;
upgrade.stopServices = [ "buzzrelay" ];
ensureUsers = [ {
name = "collectd";
ensurePermissions."DATABASE ${config.services.buzzrelay.database}" = "ALL PRIVILEGES";
} ];
2023-01-06 23:56:02 +01:00
};
collectd.plugins.postgresql = ''
<Query unique_followers>
Statement "select count(distinct id) from follows;"
<Result>
Type gauge
InstancePrefix "unique"
ValuesFrom "count"
</Result>
</Query>
<Query total_follows>
Statement "select count(id) from follows;"
<Result>
Type gauge
InstancePrefix "total"
ValuesFrom "count"
</Result>
</Query>
<Database ${config.networking.hostName}>
Param database "${config.services.buzzrelay.database}"
Query unique_followers
Query total_follows
</Database>
'';
2022-12-19 22:28:04 +01:00
};
2023-01-06 23:24:02 +01:00
system.stateVersion = "22.11";
2022-12-19 20:57:43 +01:00
}