This commit is contained in:
parent
e7a93efafa
commit
50b333a5a9
1 changed files with 121 additions and 4 deletions
67
hosts/prusa-connect/prusa-connect.nix
Normal file
67
hosts/prusa-connect/prusa-connect.nix
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
{ config, ... }:
|
||||
|
||||
let
|
||||
fqdn = "prusa-connect.club.berlin.ccc.de";
|
||||
ipv6 = "2001:678:560:23:be24:11ff:fe0a:7eff";
|
||||
ipv4 = "172.23.42.30";
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
../../services/nginx.nix
|
||||
../../services/podman.nix
|
||||
];
|
||||
|
||||
networking.interfaces.ens3.ipv6.addresses = [
|
||||
{
|
||||
address = ipv6;
|
||||
prefixLength = 64;
|
||||
}
|
||||
];
|
||||
|
||||
virtualisation.oci-containers.containers.prusa-connect = {
|
||||
labels."io.containers.autoupdate" = "registry";
|
||||
image = "ghcr.io/prusa3d/prusa-connect:latest";
|
||||
environment = {};
|
||||
ports = [ "127.0.0.1:8080:8080" ];
|
||||
#extraOptions = [ "--network=host" ];
|
||||
pull = "newer";
|
||||
volumes = [
|
||||
"/etc/prusa-connect/config.yaml:/config/config.yaml:ro"
|
||||
"/etc/prusa-connect/config.d:/config/config.d"
|
||||
"/var/lib/prusa-connect/storage:/storage"
|
||||
"/var/lib/prusa-connect/data:/data"
|
||||
"/var/lib/prusa-connect/files:/files"
|
||||
"/var/lib/prusa-connect/tmp:/tmp"
|
||||
];
|
||||
};
|
||||
|
||||
services = {
|
||||
nginx.virtualHosts."${fqdn}" = {
|
||||
quic = true;
|
||||
kTLS = true;
|
||||
forceSSL = true;
|
||||
useACMEHost = fqdn;
|
||||
listenAddresses = [
|
||||
"[${ipv6}]"
|
||||
ipv4
|
||||
];
|
||||
location."/" = {
|
||||
recommendedProxySettings = true;
|
||||
proxyWebsockets = true;
|
||||
proxyPass = "http://127.0.0.1:8080";
|
||||
extraConfig = ''
|
||||
add_header Alt-Svc 'h3=":443"; ma=86400';
|
||||
client_max_body_size 128M;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
||||
'';
|
||||
};
|
||||
extraConfig = ''
|
||||
error_log syslog:server=unix:/dev/log,tag=${builtins.replaceStrings [ "." ] [ "_" ] fqdn} warn;
|
||||
access_log syslog:server=unix:/dev/log vhost_combined;
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
security.acme.certs."${fqdn}".reloadServices = [ "nginx" ];
|
||||
}
|
||||
Loading…
Reference in a new issue