add a serve for gaming related content

This commit is contained in:
chaos 2023-11-15 17:17:35 +00:00
parent b59686aa56
commit 16e1973b66
No known key found for this signature in database
5 changed files with 52 additions and 0 deletions

View file

@ -8,6 +8,7 @@ in {
webdav_music_ro = webdav + 2; webdav_music_ro = webdav + 2;
webdav_public = webdav + 3; webdav_public = webdav + 3;
webdav_uploads = webdav + 4; webdav_uploads = webdav + 4;
webdav_gaming = webdav + 5;
restic_music = restic + 0; restic_music = restic + 0;
restic_vault = restic + 1; restic_vault = restic + 1;

View file

@ -90,6 +90,7 @@ in {
"/MusicRO/".proxyPass = "http://${containerIP}:${toString ports.webdav_music_ro}"; "/MusicRO/".proxyPass = "http://${containerIP}:${toString ports.webdav_music_ro}";
"/Public/".proxyPass = "http://${containerIP}:${toString ports.webdav_public}"; "/Public/".proxyPass = "http://${containerIP}:${toString ports.webdav_public}";
"/Uploads/".proxyPass = "http://${containerIP}:${toString ports.webdav_uploads}"; "/Uploads/".proxyPass = "http://${containerIP}:${toString ports.webdav_uploads}";
"/Gaming/".proxyPass = "http://${containerIP}:${toString ports.webdav_gaming}";
}; };
extraConfig = '' extraConfig = ''
client_max_body_size ${clientMaxBodySize}; client_max_body_size ${clientMaxBodySize};

View file

@ -6,6 +6,7 @@ in {
"d /caches - storage storage" "d /caches - storage storage"
"d /caches/main_webdav_serve - storage storage" "d /caches/main_webdav_serve - storage storage"
"d /caches/media_webdav_serve - storage storage" "d /caches/media_webdav_serve - storage storage"
"d /caches/gaming_webdav_serve - storage storage"
]; ];
services.rclone-serve = { services.rclone-serve = {
@ -109,6 +110,22 @@ in {
"--read-only" "--read-only"
]; ];
} }
{
# This isn't really being directly used anymore but its nice as a backup
# Jellyfin directly mounts from StorageBox instead
id = "media-combine";
remote = "Gaming:";
type = "webdav";
extraArgs = [
"--addr=0.0.0.0:${toString ports.webdav_gaming}"
"--htpasswd=${secrets.webdav_gaming_htpasswd.path}"
"--baseurl=/Gaming/"
"--cache-dir=/caches/gaming_webdav_serve"
"--vfs-cache-max-age=5m"
"--vfs-cache-max-size=1g"
"--vfs-cache-mode=full"
];
}
{ {
id = "restic-music"; id = "restic-music";
remote = "StorageBox:Backups/Restic/Music"; remote = "StorageBox:Backups/Restic/Music";

View file

@ -123,3 +123,24 @@ chunk_size = 256Mi
[Media-Combine] [Media-Combine]
type = combine type = combine
upstreams = "Media=Media:" "PutIO=PutIO-WebDAV:" upstreams = "Media=Media:" "PutIO=PutIO-WebDAV:"
[B2-Gaming-Source]
type = b2
account = B2_CHAOS_GAMING_ACCOUNT
key = B2_CHAOS_GAMING_KEY
hard_delete = true
[B2-Gaming]
type = alias
remote = B2-Gaming-Source:Chaos-Gaming
[Gaming-Source]
type = crypt
remote = B2-Gaming:
password = STORAGE_GAMING_CRYPT_PASSWORD
password2 = STORAGE_GAMING_CRYPT_SALT
[Gaming]
type = chunker
remote = Gaming-Source:
chunk_size = 128Mi

View file

@ -22,6 +22,7 @@
"api-keys/data/backblaze/Chaos-Personal" "api-keys/data/backblaze/Chaos-Personal"
"api-keys/data/backblaze/Chaos-Public" "api-keys/data/backblaze/Chaos-Public"
"api-keys/data/backblaze/Chaos-Media" "api-keys/data/backblaze/Chaos-Media"
"api-keys/data/backblaze/Chaos-Gaming"
"api-keys/data/backblaze/Phoenix-Cryptidz-Storage" "api-keys/data/backblaze/Phoenix-Cryptidz-Storage"
"api-keys/data/storage/restic/Music" "api-keys/data/storage/restic/Music"
@ -39,8 +40,10 @@
"api-keys/data/storage/webdav/Media" "api-keys/data/storage/webdav/Media"
"api-keys/data/storage/webdav/Public" "api-keys/data/storage/webdav/Public"
"api-keys/data/storage/webdav/Uploads" "api-keys/data/storage/webdav/Uploads"
"api-keys/data/storage/webdav/Gaming"
"private-public-keys/data/rclone/Chaos-Media-Crypt" "private-public-keys/data/rclone/Chaos-Media-Crypt"
"private-public-keys/data/rclone/Chaos-Gaming-Crypt"
]; ];
packages = with pkgs; [ packages = with pkgs; [
@ -207,6 +210,13 @@
simple_get_htpasswd "/api-keys/storage/webdav/Uploads" "$secretFile" simple_get_htpasswd "/api-keys/storage/webdav/Uploads" "$secretFile"
''; '';
}; };
webdav_gaming_htpasswd = {
user = "storage";
group = "storage";
fetchScript = ''
simple_get_htpasswd "/api-keys/storage/webdav/Gaming" "$secretFile"
'';
};
rclone_config = { rclone_config = {
user = "storage"; user = "storage";
@ -217,6 +227,7 @@
STORAGEBOX_PASSWORD=$(simple_get_obscure /api-keys/hetzner/storagebox .password) STORAGEBOX_PASSWORD=$(simple_get_obscure /api-keys/hetzner/storagebox .password)
sed -i "s/STORAGEBOX_PASSWORD/$STORAGEBOX_PASSWORD/" "$secretFile" sed -i "s/STORAGEBOX_PASSWORD/$STORAGEBOX_PASSWORD/" "$secretFile"
simple_get_replace_b2 "/api-keys/backblaze/Chaos-Gaming" "B2_CHAOS_GAMING" "$secretFile"
simple_get_replace_b2 "/api-keys/backblaze/Chaos-Media" "B2_CHAOS_MEDIA" "$secretFile" simple_get_replace_b2 "/api-keys/backblaze/Chaos-Media" "B2_CHAOS_MEDIA" "$secretFile"
simple_get_replace_b2 "/api-keys/backblaze/Chaos-Backups" "B2_CHAOS_BACKUPS" "$secretFile" simple_get_replace_b2 "/api-keys/backblaze/Chaos-Backups" "B2_CHAOS_BACKUPS" "$secretFile"
simple_get_replace_b2 "/api-keys/backblaze/Chaos-Photos" "B2_CHAOS_PHOTOS" "$secretFile" simple_get_replace_b2 "/api-keys/backblaze/Chaos-Photos" "B2_CHAOS_PHOTOS" "$secretFile"
@ -230,6 +241,7 @@
sed -i "s/PUTIO_PASSWORD/$PUTIO_PASSWORD/" "$secretFile" sed -i "s/PUTIO_PASSWORD/$PUTIO_PASSWORD/" "$secretFile"
simple_get_replace_crypt "/private-public-keys/rclone/Chaos-Media-Crypt" "STORAGE_MEDIA_CRYPT" "$secretFile" simple_get_replace_crypt "/private-public-keys/rclone/Chaos-Media-Crypt" "STORAGE_MEDIA_CRYPT" "$secretFile"
simple_get_replace_crypt "/private-public-keys/rclone/Chaos-Gaming-Crypt" "STORAGE_GAMING_CRYPT" "$secretFile"
''; '';
}; };
}; };