adds upnp service

This commit is contained in:
Menno van Leeuwen 2024-11-16 00:04:38 +01:00
parent 945196c8e0
commit db89a244b0
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE
3 changed files with 33 additions and 0 deletions

View File

@ -9,6 +9,7 @@
./gitea.nix ./gitea.nix
./golink.nix ./golink.nix
./plex.nix ./plex.nix
./upnp.nix
]; ];
} }
# TODO: Import all the package modules, disabled for testing one by one. # TODO: Import all the package modules, disabled for testing one by one.

View File

@ -0,0 +1,19 @@
{ config, pkgs, ... }:
{
environment.etc."docker/upnp/docker-compose.yml".source = ./upnp/docker-compose.yml;
systemd.services.upnp = {
description = "UPnP Docker Compose Service";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
serviceConfig = {
ExecStart = "${pkgs.docker-compose}/bin/docker-compose -f /etc/docker/upnp/docker-compose.yml up";
ExecStop = "${pkgs.docker-compose}/bin/docker-compose -f /etc/docker/upnp/docker-compose.yml down";
WorkingDirectory = "/etc/docker/upnp";
Restart = "always";
RestartSec = 10;
};
wantedBy = [ "multi-user.target" ];
};
}

View File

@ -0,0 +1,13 @@
name: upnp
services:
service:
image: ghcr.io/vleeuwenmenno/auto-upnp:latest
restart: unless-stopped
network_mode: host
environment:
UPNP_DURATION: 86400 # 24 hours in seconds
PORTS: |
[
{"port": 80, "protocol": "tcp"},
{"port": 443, "protocol": "tcp"}
]