init torrent sync

This commit is contained in:
Ingolf Wagner 2023-05-03 21:20:51 +02:00
parent 5c0a486388
commit f5b76b2f83
Signed by: palo
GPG key ID: 76BF5F1928B9618B
6 changed files with 117 additions and 2 deletions

View file

@ -23,6 +23,7 @@ let
"loki.robi" = hosts.robi;
"grafana.robi" = hosts.robi;
"prometheus.robi" = hosts.robi;
"sync.robi" = hosts.robi;
# pepe
"loki.pepe" = hosts.pepe;
"grafana.pepe" = hosts.pepe;
@ -35,6 +36,7 @@ let
"prometheus.chungus" = hosts.chungus;
"tts.chungus" = hosts.chungus;
"tdarr.chungus" = hosts.chungus;
"sync.chungus" = hosts.chungus;
};
network = "private";
in

View file

@ -31,6 +31,7 @@
#./tdarr.nix
./rbackup.nix
./sync-transmission.nix
];

View file

@ -0,0 +1,107 @@
{ lib, pkgs, config, ... }:
let
uiPort = 9099;
in
{
containers.torrent = {
# mount host folders
bindMounts = {
media = {
hostPath = "/media";
mountPoint = "/media"; # must be here otherwise transmission can't see the folder
isReadOnly = false;
};
lib = {
hostPath = "/srv/transmission";
mountPoint = "/var/lib/transmission";
isReadOnly = false;
};
};
autoStart = true;
config = { config, pkgs, lib, ... }: {
system.stateVersion = "22.11";
services.journald.extraConfig = "SystemMaxUse=1G";
services.transmission = {
enable = true;
settings = {
download-dir = "/media";
incomplete-dir = "/var/lib/transmission/incomplete";
incomplete-dir-enabled = true;
message-level = 1;
umask = 2;
rpc-whitelist-enabled = false;
rpc-host-whitelist-enabled = false;
rpc-port = uiPort;
rpc-enable = true;
rpc-bind-address = "0.0.0.0";
# "normal" speed limits
speed-limit-down-enabled = false;
speed-limit-down = 800;
speed-limit-up-enabled = true;
speed-limit-up = 3000;
upload-slots-per-torrent = 8;
# Queuing
# When true, Transmission will only download
# download-queue-size non-stalled torrents at once.
download-queue-enabled = true;
download-queue-size = 3;
# When true, torrents that have not shared data for
# queue-stalled-minutes are treated as 'stalled'
# and are not counted against the queue-download-size
# and seed-queue-size limits.
queue-stalled-enabled = true;
queue-stalled-minutes = 60;
# When true. Transmission will only seed seed-queue-size
# non-stalled torrents at once.
seed-queue-enabled = false;
seed-queue-size = 10;
# Enable UPnP or NAT-PMP.
peer-port = 51413;
port-forwarding-enabled = false;
# Start torrents as soon as they are added
start-added-torrents = true;
};
};
};
};
# open ports for logging
#networking.firewall.interfaces."ve-torrent".allowedTCPPorts =
# [ 5044 12304 12305 ];
#networking.firewall.interfaces."ve-torrent".allowedUDPPorts =
# [ 5044 12304 12305 ];
# host nginx setup
# ----------------
# curl -H "Host: transmission.robi.private" https://robi.private/ < will work
# curl -H "Host: transmission.robi.private" https://144.76.13.147/ < wont work
services.nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts = {
"sync.${config.networking.hostName}.private" = {
extraConfig = ''
allow ${config.tinc.private.subnet};
deny all;
'';
locations."/" = {
proxyPass = "http://127.0.0.1:${toString uiPort}";
};
};
};
};
}

View file

@ -54,6 +54,8 @@
./grafana.nix
./telegraf.nix
./sync-opentracker.nix
];

View file

@ -0,0 +1,5 @@
{
services.opentracker = {
enable = true;
};
}

View file

@ -65,8 +65,6 @@ in
};
};
# container network setup
# see also nating on host system.
autoStart = true;
config = { config, pkgs, lib, ... }: {