more archiveteam and qbit changes

Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
ahuston-0 2024-11-28 13:15:39 -05:00
parent ecbb096d07
commit dde547c4cf
No known key found for this signature in database
GPG Key ID: 47940175096C1330
4 changed files with 58 additions and 26 deletions

View File

@ -85,7 +85,7 @@ let
}; };
archiveteam-youtube = { archiveteam-youtube = {
image = "youtube-grab"; image = "youtube-grab";
scale = 1; scale = 0;
}; };
archiveteam-deviantart = { archiveteam-deviantart = {
image = "deviantart-grab"; image = "deviantart-grab";
@ -141,7 +141,7 @@ in
services."custom-watchtower@archiveteam" = { services."custom-watchtower@archiveteam" = {
bindsTo = [ "docker.service" ]; bindsTo = [ "docker.service" ];
after = [ "docker.service" ]; after = [ "docker.service" ];
description = "runs a watchtower-esque script for systemd-based oci-containers"; description = "a watchtower-esque script for systemd-based oci-containers";
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
User = "root"; User = "root";

View File

@ -17,7 +17,7 @@
./nextcloud.nix ./nextcloud.nix
# ./postgres.nix # ./postgres.nix
# ./restic.nix # ./restic.nix
# ./torr.nix ./torr.nix
# ./unifi.nix # ./unifi.nix
]; ];

View File

@ -1,41 +1,52 @@
{ ... }: { pkgs, ... }:
let let
delugeBase = { delugeBase = {
image = "binhex/arch-deluge";
environment = { environment = {
PUID = "600"; PUID = "600";
PGID = "100"; PGID = "100";
TZ = "America/New_York"; TZ = "America/New_York";
UMASK = "000"; UMASK = "000";
DEBUG = "false"; DEBUG = "true";
DELUGE_DAEMON_LOG_LEVEL = "debug"; DELUGE_DAEMON_LOG_LEVEL = "debug";
DELUGE_WEB_LOG_LEVEL = "debug"; DELUGE_WEB_LOG_LEVEL = "debug";
}; };
extraOptions = [ "--restart=unless-stopped" ];
}; };
vars = import ../vars.nix; vars = import ../vars.nix;
docker_path = vars.primary_docker; #docker_path = vars.primary_docker;
torr_path = vars.primary_torr; torr_path = vars.primary_torr;
deluge_path = "${torr_path}/deluge";
delugevpn_path = "${torr_path}/delugevpn";
genSopsConf = file: {
"${file}" = {
format = "binary";
sopsFile = ./wg/${file};
path = "${delugevpn_path}/config/wireguard/configs/${file}";
owner = "docker-service";
group = "users";
restartUnits = [ "docker-delugeVPN.service" ];
};
};
in in
{ {
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {
deluge = delugeBase // { deluge = delugeBase // {
image = "binhex/arch-deluge";
volumes = [ volumes = [
"${docker_path}/Qbit:/config" "${deluge_path}/config:/config"
"${torr_path}/Qbit/:/data" "${deluge_path}/data/:/data"
"/etc/localtime:/etc/localtime:ro" "/etc/localtime:/etc/localtime:ro"
]; ];
ports = [ ports = [
"8082:8112" "8084:8112"
"29432:29432" "29433:29433"
]; ];
}; };
delugeVPN = delugeBase // { delugeVPN = delugeBase // {
image = "binhex/arch-delugevpn";
extraOptions = [ extraOptions = [
"--restart=unless-stopped"
"--privileged=true" "--privileged=true"
"--sysctl" "--sysctl"
"net.ipv4.conf.all.src_valid_mark=1" "net.ipv4.conf.all.src_valid_mark=1"
@ -46,28 +57,47 @@ in
VPN_PROV = "custom"; VPN_PROV = "custom";
ENABLE_PRIVOXY = "yes"; ENABLE_PRIVOXY = "yes";
LAN_NETWORK = "192.168.0.0/16"; LAN_NETWORK = "192.168.0.0/16";
NAME_SERVERS = "9.9.9.9,1.1.1.1,8.8.8.8,8.8.4.4"; NAME_SERVERS = "194.242.2.9";
# note, delete /config/perms.txt to force a bulk permissions update # note, delete /config/perms.txt to force a bulk permissions update
}; };
volumes = [ volumes = [
"${docker_path}/QbitVPN:/config" "${delugevpn_path}/config:/config"
"${torr_path}/QbitVPN/:/data" "${delugevpn_path}/data:/data"
"/etc/localtime:/etc/localtime:ro" "/etc/localtime:/etc/localtime:ro"
]; ];
ports = [ ports = [
"8081:8112" "8085:8112"
"8118:8118" "8119:8118"
"39274:39274" "39275:39275"
"39274:39274/udp" "39275:39275/udp"
]; ];
}; };
}; };
sops.secrets = { systemd.services.docker-delugeVPN = {
"docker/deluge" = { serviceConfig = {
owner = "docker-service"; ExecStartPre = [
path = "${docker_path}/QbitVPN/wireguard/wg0.conf"; (
"${pkgs.bash}/bin/bash -c \"${pkgs.findutils}/bin/find ${delugevpn_path}/config/wireguard/configs "
+ "-type l -not -name wg0.conf "
+ "| ${pkgs.coreutils}/bin/shuf -n 1 "
+ "| ${pkgs.findutils}/bin/xargs -I {} cp -L {} ${delugevpn_path}/config/wireguard/wg0.conf &&"
+ "${pkgs.coreutils}/bin/chown docker-service:users ${delugevpn_path}/config/wireguard/wg0.conf &&"
+ "${pkgs.coreutils}/bin/chmod 440 ${delugevpn_path}/config/wireguard/wg0.conf\""
)
];
ExecStopPost = [ "${pkgs.coreutils}/bin/rm ${delugevpn_path}/config/wireguard/wg0.conf" ];
}; };
}; };
sops.secrets =
(genSopsConf "se-mma-wg-001.conf")
// (genSopsConf "se-mma-wg-002.conf")
// (genSopsConf "se-mma-wg-003.conf")
// (genSopsConf "se-mma-wg-004.conf")
// (genSopsConf "se-mma-wg-005.conf")
// (genSopsConf "se-mma-wg-101.conf")
// (genSopsConf "se-mma-wg-102.conf")
// (genSopsConf "se-mma-wg-103.conf");
} }

View File

@ -1,5 +1,5 @@
#! /usr/bin/env nix #! /usr/bin/env nix
#! nix shell nixpkgs#docker nixpkgs#bash --command bash #! nix shell nixpkgs#docker nixpkgs#bash nixpkgs#gawk --command bash
outdated_msg="Project code is out of date and needs to be upgraded. To remedy this problem immediately, you may reboot your warrior." outdated_msg="Project code is out of date and needs to be upgraded. To remedy this problem immediately, you may reboot your warrior."
@ -19,6 +19,8 @@ for container in ${containers[@]}; do
if [[ $last_msg =~ $outdated_msg ]]; then if [[ $last_msg =~ $outdated_msg ]]; then
echo "${container} is outdated, restarting" echo "${container} is outdated, restarting"
imageTag=$(docker ps --format '{{.Names}}\t{{.Image}}' -f "name=$container" | grep -w "$container" | awk '{print $NF}')
docker pull "$imageTag"
systemctl restart "docker-${container}" systemctl restart "docker-${container}"
fi fi
done done