feat: owncast test

This commit is contained in:
Nick 2024-10-18 22:05:40 -05:00
parent 748133dbd9
commit eeb0e890b8
5 changed files with 78 additions and 4 deletions

View file

@ -21,6 +21,7 @@
"nextcloud"
"nginx"
"ollama"
"owncast"
"peertube"
"postgresql"
"samba"

View file

@ -9,6 +9,7 @@ let
minecraftLabel = "Minecraft";
nextcloudLabel = "Nextcloud";
ollamaLabel = "Ollama";
owncastLabel = "Owncast";
peertubeLabel = "PeerTube";
postgresLabel = "PostgreSQL";
sambaLabel = "Samba";
@ -27,6 +28,7 @@ let
minecraftName = "minecraft";
nextcloudName = "nextcloud";
ollamaName = "ollama";
owncastName = "owncast";
peertubeName = "peertube";
postgresName = "postgres";
sambaName = "samba";
@ -217,6 +219,28 @@ in {
key = "${sslPath}/${ollamaName}.${domain0}/key.pem";
};
};
owncast = let
owncastSubdomain = "stream";
in {
label = owncastLabel;
name = owncastName;
sops = {
path0 = "${sops}/${owncastName}";
};
subdomain = owncastSubdomain;
paths = {
path0 = "${servicePath}/${owncastLabel}";
path1 = "/mnt/media/storage/${owncastName}";
};
ports = {
port0 = 9454;
port1 = 1935;
};
ssl = {
cert = "${sslPath}/${owncastSubdomain}.${domain1}/fullchain.pem";
key = "${sslPath}/${owncastSubdomain}.${domain1}/key.pem";
};
};
peertube = {
label = peertubeLabel;
name = peertubeName;

View file

@ -15,7 +15,7 @@
instanceName = service: (instance.${service}.subdomain);
domain0ServiceNames = [
domain0SubdomainNames = [
"nextcloud"
"jellyfin"
"minecraft"
@ -24,17 +24,18 @@
"vaultwarden"
];
domain1ServiceNames = [
domain1SubdomainNames = [
"nextcloud"
"castopod"
"forgejo"
"matrix"
"owncast"
"peertube"
"writefreely"
];
domain0Subdomains = map instanceName domain0ServiceNames;
domain1Subdomains = map instanceName domain1ServiceNames;
domain0Subdomains = map instanceName domain0SubdomainNames;
domain1Subdomains = map instanceName domain1SubdomainNames;
domainRoot = [
domain.url0

View file

@ -11,6 +11,7 @@
./ollama.nix
./peertube.nix
./postgresql.nix
./owncast.nix
./samba.nix
./vaultwarden.nix

View file

@ -0,0 +1,47 @@
{flake, ...}: let
inherit (flake.config.people) user0;
inherit (flake.config.people.${user0}) domain;
inherit (flake.config.system.device) server wildcard;
inherit (flake.config.service.instance.owncast) paths ports subdomain ssl name;
localhost = wildcard.ip.address0;
host = "${subdomain}.${domain.url1}";
in {
services = {
owncast = {
enable = true;
listen = localhost;
port = ports.port0;
openFirewall = true;
};
caddy = {
virtualHosts = {
"${host}" = {
extraConfig = ''
reverse_proxy ${localhost}:${toString ports.port0}
tls ${ssl.cert} ${ssl.key}
'';
};
};
};
};
fileSystems."/var/lib/${name}" = {
device = paths.path0;
fsType = "none";
options = ["bind"];
depends = [server.storage0.mount];
};
systemd.tmpfiles.rules = [
"Z ${paths.path0} 755 ${name} ${name} -"
];
networking = {
firewall = {
allowedTCPPorts = [
ports.port0
ports.port1
];
};
};
}