2024-03-19 21:11:06 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2024-03-16 14:35:12 +00:00
|
|
|
let
|
|
|
|
secrets = config.sops.secrets;
|
2024-03-19 21:11:06 +00:00
|
|
|
cfg = config.services.peertube;
|
2024-03-16 14:35:12 +00:00
|
|
|
|
|
|
|
host = "peertube.dtth.ch";
|
|
|
|
port = 19878;
|
|
|
|
in
|
|
|
|
{
|
2024-03-19 21:11:06 +00:00
|
|
|
sops.secrets."peertube" = { owner = cfg.user; };
|
|
|
|
sops.secrets."peertube-env" = { owner = cfg.user; };
|
2024-03-16 14:35:12 +00:00
|
|
|
# database
|
|
|
|
cloud.postgresql.databases = [ "peertube" ];
|
|
|
|
# traefik
|
|
|
|
cloud.traefik.hosts.peertube = {
|
|
|
|
inherit port host;
|
2024-03-19 21:11:06 +00:00
|
|
|
noCloudflare = true;
|
2024-03-16 14:35:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.peertube = {
|
|
|
|
enable = true;
|
|
|
|
enableWebHttps = true;
|
2024-03-19 21:11:06 +00:00
|
|
|
listenWeb = 443;
|
2024-03-16 14:35:12 +00:00
|
|
|
listenHttp = port;
|
|
|
|
localDomain = host;
|
|
|
|
|
2024-03-19 21:11:06 +00:00
|
|
|
secrets.secretsFile = secrets."peertube".path;
|
|
|
|
serviceEnvironmentFile = secrets."peertube-env".path;
|
|
|
|
|
2024-03-16 14:35:12 +00:00
|
|
|
# Databases
|
|
|
|
redis.createLocally = true;
|
|
|
|
database = {
|
|
|
|
host = "/run/postgresql";
|
|
|
|
};
|
2024-03-19 21:11:06 +00:00
|
|
|
|
|
|
|
# S3
|
|
|
|
settings.object_storage = {
|
|
|
|
enabled = true;
|
|
|
|
|
|
|
|
region = "auto";
|
|
|
|
|
|
|
|
proxy.proxify_private_files = false;
|
|
|
|
|
|
|
|
web_videos = {
|
|
|
|
bucket_name = "dtthtube";
|
|
|
|
prefix = "web-videos/";
|
|
|
|
base_url = "https://content.peertube.dtth.ch";
|
|
|
|
};
|
|
|
|
streaming_playlists = {
|
|
|
|
bucket_name = "dtthtube";
|
|
|
|
prefix = "hls-playlists/";
|
|
|
|
base_url = "https://content.peertube.dtth.ch";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Storage
|
|
|
|
settings.client.videos = {
|
|
|
|
resumable_upload.max_chunk_size = "90MB";
|
|
|
|
};
|
|
|
|
settings.storage = {
|
|
|
|
storyboards = "/var/lib/peertube/storage/storyboards/";
|
|
|
|
tmp = "/mnt/data/peertube/tmp/";
|
|
|
|
tmp_persistent = "/mnt/data/peertube/tmp_persistent/";
|
|
|
|
web_videos = "/mnt/data/peertube/web-videos/";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Trust proxy
|
|
|
|
settings.trust_proxy = [ "loopback" ] ++ config.services.traefik.staticConfigOptions.entrypoints.https.forwardedHeaders.trustedIPs;
|
|
|
|
|
|
|
|
# Federation
|
|
|
|
settings.federation = {
|
|
|
|
sign_federated_fetches = true;
|
|
|
|
videos.federate_unlisted = true;
|
|
|
|
videos.cleanup_remote_interactions = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
dataDirs = [ "/var/lib/peertube" "/mnt/data/peertube" ];
|
2024-03-16 14:35:12 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|