monitor containers

This commit is contained in:
Ingolf Wagner 2024-05-18 12:02:21 +02:00
parent 3a4ed070f2
commit b890a69e30
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
13 changed files with 134 additions and 97 deletions

View file

@ -0,0 +1,22 @@
{ lib, config, ... }:
with lib;
with types;
{
imports = [
../../components/monitor
];
# todo create a the components.monitor.container module.
options.promtail.port = mkOption {
type = int;
};
config = {
components.monitor.enable = true;
components.monitor.metrics.enable = false;
components.monitor.promtail.port = config.promtail.port;
components.monitor.opentelemetry.exporter.endpoint = "127.0.0.1:4317";
};
}

View file

@ -86,14 +86,18 @@ in
privateNetwork = false;
autoStart = true;
config = { config, pkgs, lib, ... }: {
config = { config, lib, ... }: {
nixpkgs.pkgs = pkgs;
imports = [ ./container-monitoring.nix ];
promtail.port = 3502;
system.stateVersion = "23.11";
# Configuring nameservers for containers is currently broken.
# Therefore in some cases internet connectivity can be broken inside the containers.
# A temporary workaround is to manually write the /etc/nixos/resolv.conf file like this:
#environment.etc."resolv.conf".text = "nameserver 8.8.8.8";
system.stateVersion = "23.11";
users.users.nextcloud.uid = nextcloudUid;

View file

@ -1,54 +0,0 @@
{ config, lib, pkgs, ... }:
{
# https://docs.tdarr.io/docs/installation/docker/run-compose
virtualisation.oci-containers = {
containers.tdarr = {
volumes = [
"/media/arr/tdarr/server:/app/server"
"/media/arr/tdarr/configs:/app/configs"
"/media/arr/tdarr/logs:/app/logs"
"/media/arr/tdarr/transcode_cache:/temp"
"/media:/media"
];
environment = {
serverIP = "0.0.0.0";
serverPort = "8266";
webUIPort = "8265";
internalNode = "true";
inContainer = "true";
nodeName = "robi";
TZ = "Europe/Berlin";
PUID = toString config.users.users.media.uid;
PGID = toString config.users.groups.media.gid;
};
ports = [
"127.0.0.1:8265:8265" # WebUI
# "8266:8266" # server port
];
image = "ghcr.io/haveagitgat/tdarr:latest"; # Warning: if the tag does not change, the image will not be updated
extraOptions = [
#"--network=bridge"
#"--privileged"
];
};
};
#networking.firewall.interfaces.wg0.allowedTCPPorts = [ 8266 ];
#networking.firewall.interfaces.wg0.allowedUDPPorts = [ 8266 ];
#networking.firewall.interfaces.enp0s31f6.allowedTCPPorts = [ 8266 ];
#networking.firewall.interfaces.enp0s31f6.allowedUDPPorts = [ 8266 ];
services.nginx.virtualHosts."tdarr.${config.networking.hostName}.private" = {
extraConfig = ''
allow ${config.tinc.private.subnet};
deny all;
'';
locations."/" = {
proxyPass = "http://localhost:8265";
proxyWebsockets = true;
};
};
}

View file

@ -13,7 +13,10 @@ in
privateNetwork = false;
autoStart = true;
config = { config, pkgs, lib, ... }: {
config = { config, lib, ... }: {
nixpkgs.pkgs = pkgs;
imports = [ ./container-monitoring.nix ];
promtail.port = 3503;
system.stateVersion = "23.11";
# Photoprism

View file

@ -68,7 +68,10 @@ in
};
};
config = { config, pkgs, lib, ... }: {
config = { config, lib, ... }: {
nixpkgs.pkgs = pkgs;
imports = [ ./container-monitoring.nix ];
promtail.port = 3504;
system.stateVersion = "23.11";
services.postgresql = {