alpine: tweaks and fixes

This commit is contained in:
Tristan 2025-05-23 18:32:59 +01:00
parent 0e2eef3ee0
commit ae83324d9b
6 changed files with 70 additions and 7 deletions

View file

@ -61,8 +61,8 @@ in {
options = [ options = [
"minfreespace=50G" "minfreespace=50G"
"fsname=mergerfs" "fsname=mergerfs"
"category.create=mfs" "cache.readdir=true"
"dropcacheonclose=true" "func.readdir=cosr"
]; ];
}; };
@ -154,7 +154,7 @@ in {
enable = true; enable = true;
protocol = "namecheap"; protocol = "namecheap";
usev4 = "webv4, webv4=ipify-ipv4"; usev4 = "webv4, webv4=ipify-ipv4";
usev6 = ""; usev6 = "webv6, webv6=ipify-ipv6";
username = "tristans.cloud"; username = "tristans.cloud";
passwordFile = config.sops.secrets."namecheap".path; passwordFile = config.sops.secrets."namecheap".path;
domains = ["@" "*"]; domains = ["@" "*"];
@ -170,4 +170,7 @@ in {
systemd.services.NetworkManager-wait-online.enable = false; systemd.services.NetworkManager-wait-online.enable = false;
# not enough memory
boot.tmp.useTmpfs = false;
} }

View file

@ -25,7 +25,10 @@ in {
configurationLimit = 50; configurationLimit = 50;
}; };
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.tmp.useTmpfs = true; boot.tmp = {
useTmpfs = lib.mkDefault true;
cleanOnBoot = true;
};
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
programs.nm-applet = { programs.nm-applet = {

View file

@ -1,6 +1,5 @@
{config, ...}: {config, ...}:
{ {
# TODO: totally borked for some reason. DB migration?
nixpkgs.config.permittedInsecurePackages = [ nixpkgs.config.permittedInsecurePackages = [
"olm-3.2.16" "olm-3.2.16"
]; ];

View file

@ -12,6 +12,9 @@ in {
services.nginx.virtualHosts.${domain} = { services.nginx.virtualHosts.${domain} = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
locations."~".proxyPass = "http://localhost:${toString port}"; locations."~" = {
proxyPass = "http://localhost:${toString port}";
proxyWebsockets = true;
};
}; };
} }

View file

@ -2,7 +2,7 @@
inherit (config.services) prometheus; inherit (config.services) prometheus;
nodes = [ nodes = [
"alpine" "alpine"
"fcs-tristan-nixbook" "framework-13"
"zenix" "zenix"
]; ];
addPort = ip: "${ip}:${toString prometheus.exporters.node.port}"; addPort = ip: "${ip}:${toString prometheus.exporters.node.port}";
@ -27,12 +27,66 @@ in {
]; ];
} }
]; ];
rules = [
(builtins.toJSON {
groups = [{
name = "node";
rules = [
{
alert = "io error";
expr = ''node_filesystem_device_error{device_error!="permission denied"} > 0'';
}
{
alert = "disk full";
expr = ''node_filesystem_avail_bytes{fstype=~"ext4|btrfs"} < ${toString (50 * 1024 * 1024 * 1024)}'';
}
];
}];
})
];
alertmanagers = [ {
static_configs = [ {
targets = [
"localhost:9093"
];
} ];
} ];
exporters = { exporters = {
postgres = { postgres = {
enable = true; enable = true;
runAsLocalSuperUser = true; runAsLocalSuperUser = true;
}; };
}; };
alertmanager = {
enable = true;
configuration = {
receivers = [{
name = "ntfy";
webhook_configs = [{
url = "http://localhost${config.services.ntfy-sh.settings.listen-http}/alert/trigger";
}];
}];
route = {
receiver = "ntfy";
# routes = [{
# matchers = [
# ''node_filesystem_device_error != 0''
# ];
# }];
};
};
};
# alertmanager-ntfy = {
# enable = true;
# settings = {
# ntfy = {
# baseurl = "https://up.tristans.cloud";
# notification = {
# topic = "alertmanager";
# };
# };
# };
# };
}; };
services.grafana.provision.datasources.settings.datasources = [{ services.grafana.provision.datasources.settings.datasources = [{
name = "Prometheus"; name = "Prometheus";

View file

@ -4,6 +4,7 @@
in { in {
services.vaultwarden = { services.vaultwarden = {
enable = true; enable = true;
backupDir = "/mnt/storage/backups/vaultwarden";
}; };
services.nginx.virtualHosts.${domain} = { services.nginx.virtualHosts.${domain} = {
forceSSL = true; forceSSL = true;