wow
Some checks failed
CI / check (push) Has been cancelled
CI / ida (push) Has been cancelled
CI / cpt (push) Has been cancelled
CI / build-nixos (ena) (push) Has been cancelled
CI / build-nixos (hako) (push) Has been cancelled
CI / build-nixos (kazusa) (push) Has been cancelled
CI / build-nixos (mizuki) (push) Has been cancelled
Some checks failed
CI / check (push) Has been cancelled
CI / ida (push) Has been cancelled
CI / cpt (push) Has been cancelled
CI / build-nixos (ena) (push) Has been cancelled
CI / build-nixos (hako) (push) Has been cancelled
CI / build-nixos (kazusa) (push) Has been cancelled
CI / build-nixos (mizuki) (push) Has been cancelled
This commit is contained in:
parent
10f35d47e7
commit
88cb745937
3 changed files with 66 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ nixpkgs.lib.nixosSystem {
|
||||||
# ./services/attic.nix
|
# ./services/attic.nix
|
||||||
./services/caddy.nix
|
./services/caddy.nix
|
||||||
./services/forgejo-runner.nix
|
./services/forgejo-runner.nix
|
||||||
|
./services/rtmps.nix
|
||||||
# ./services/harmonia.nix
|
# ./services/harmonia.nix
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,11 @@
|
||||||
virtualHosts."blog.imnya.ng".extraConfig = ''
|
virtualHosts."blog.imnya.ng".extraConfig = ''
|
||||||
reverse_proxy 127.0.0.1:4321
|
reverse_proxy 127.0.0.1:4321
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
virtualHosts."rtmps.mizuki.guru".extraConfig = ''
|
||||||
|
respond 204
|
||||||
|
'';
|
||||||
|
|
||||||
virtualHosts."netbird.mizuki.guru".extraConfig = ''
|
virtualHosts."netbird.mizuki.guru".extraConfig = ''
|
||||||
# Native gRPC (needs HTTP/2 cleartext to backend)
|
# Native gRPC (needs HTTP/2 cleartext to backend)
|
||||||
@grpc header Content-Type application/grpc*
|
@grpc header Content-Type application/grpc*
|
||||||
|
|
|
||||||
60
hosts/server/natsu/services/rtmps.nix
Normal file
60
hosts/server/natsu/services/rtmps.nix
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
domain = "rtmps.mizuki.guru";
|
||||||
|
caddyCertDir = "/var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/${domain}";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.nginx.override {
|
||||||
|
modules = [ pkgs.nginxModules.rtmp ];
|
||||||
|
};
|
||||||
|
|
||||||
|
appendConfig = ''
|
||||||
|
rtmp {
|
||||||
|
server {
|
||||||
|
listen 127.0.0.1:19350;
|
||||||
|
chunk_size 4096;
|
||||||
|
|
||||||
|
application live {
|
||||||
|
live on;
|
||||||
|
record off;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.rtmps-stunnel = {
|
||||||
|
description = "RTMPS TLS terminator for nginx-rtmp";
|
||||||
|
after = [
|
||||||
|
"network-online.target"
|
||||||
|
"caddy.service"
|
||||||
|
"nginx.service"
|
||||||
|
];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
requires = [ "nginx.service" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
User = "caddy";
|
||||||
|
Group = "caddy";
|
||||||
|
ExecStart = "${pkgs.stunnel}/bin/stunnel ${pkgs.writeText "rtmps-stunnel.conf" ''
|
||||||
|
foreground = yes
|
||||||
|
pid =
|
||||||
|
|
||||||
|
[rtmps]
|
||||||
|
accept = 0.0.0.0:1935
|
||||||
|
connect = 127.0.0.1:19350
|
||||||
|
cert = ${caddyCertDir}/${domain}.crt
|
||||||
|
key = ${caddyCertDir}/${domain}.key
|
||||||
|
''}";
|
||||||
|
Restart = "always";
|
||||||
|
RestartSec = 5;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ 1935 ];
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue