Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion modules/profiles/media-management/tracearr/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# `ALTER EXTENSION timescaledb UPDATE;` in the `tracearr` database
#
# See: https://github.com/NixOS/nixpkgs/issues/214367
{ config, ... }: {
{ config, pkgs, ... }: {
sops.secrets = {
maxmind_license_key = {
sopsFile = ./secrets.yml;
Expand Down Expand Up @@ -36,5 +36,20 @@
trustProxy = true;
};

systemd.services."migrate-tracearr-db-timescale-extension" = {
requiredBy = [ "tracearr.service" ];
before = [ "tracearr.service" ];
after = [ "postgresql.target" ];
environment.PGPORT = toString config.services.postgresql.settings.port;
path = [ pkgs.postgresql ];
serviceConfig = {
Type = "oneshot";
User = "postgres";
};
script = ''
psql tracearr -c 'ALTER EXTENSION timescaledb UPDATE;'
'';
};

services.postgresqlBackup.databases = [ "tracearr" ];
}
13 changes: 13 additions & 0 deletions modules/profiles/networking/blocky/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
};
denylists = {
ads = [ "https://big.oisd.nl/domainswild" ];
ps5 = [ ];
};
allowlists = {
ads = [
Expand All @@ -52,9 +53,21 @@
link.dwell.com
'')
];
ps5 = [
(pkgs.writeText "ps5-allowlist.txt" ''
googleads.g.doubleclick.net
insights-collector.newrelic.com
smetrics.aem.playstation.com
static.doubleclick.net
'')
];
};
clientGroupsBlock = {
default = [ "ads" ];
"10.100.0.101/32" = [
"ads"
"ps5"
];
};
};
caching = {
Expand Down
38 changes: 35 additions & 3 deletions modules/profiles/networking/blocky/postgresql.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
{ profiles, ... }: {
{
config,
pkgs,
profiles,
...
}:
{
imports = [ profiles.databases.postgresql ];

services.postgresql = {
extensions =
ps: with ps; [
timescaledb
timescaledb_toolkit
];
settings = {
shared_preload_libraries = [ "timescaledb" ];
max_locks_per_transaction = 256;
};
initialScriptText = ''
CREATE ROLE blocky WITH LOGIN PASSWORD 'blocky' CREATEDB;
CREATE DATABASE blocky;
Expand All @@ -20,9 +35,9 @@
};

services.blocky.settings.queryLog = {
type = "postgresql";
type = "timescale";
target = "postgres://blocky:blocky@localhost:5432/blocky";
logRetentionDays = 90;
logRetentionDays = 180;
flushInterval = "5s";
};

Expand All @@ -33,4 +48,21 @@
RestartSec = "1";
};
};

services.postgresqlBackup.databases = [ "blocky" ];

systemd.services."migrate-tracearr-db-timescale-extension" = {
requiredBy = [ "tracearr.service" ];
before = [ "tracearr.service" ];
after = [ "postgresql.target" ];
environment.PGPORT = toString config.services.postgresql.settings.port;
path = [ pkgs.postgresql ];
serviceConfig = {
Type = "oneshot";
User = "postgres";
};
script = ''
psql tracearr -c 'ALTER EXTENSION timescaledb UPDATE;'
'';
};
}
Loading