91 lines
2.4 KiB
Nix
91 lines
2.4 KiB
Nix
{ config, ... }:
|
|
|
|
let
|
|
fqdn = "prusa-connect.club.berlin.ccc.de";
|
|
in
|
|
{
|
|
imports = [
|
|
../../services/nginx.nix
|
|
../../services/podman.nix
|
|
];
|
|
|
|
environment.etc."prusa-connect/config.yaml".text =
|
|
(pkgs.formats.yaml {}).generate "config.yaml" {
|
|
core = {
|
|
site = "cccb";
|
|
api = {
|
|
addr = ":8080";
|
|
allowed_origins = [
|
|
"https://prusa-connect.club.berlin.ccc.de"
|
|
];
|
|
#tls = {
|
|
# certificate = config.acme...;
|
|
# key = config.acme...;
|
|
#};
|
|
};
|
|
trusted_proxies = [
|
|
"10.88.0.1"
|
|
"127.0.0.1"
|
|
];
|
|
log = {
|
|
level = "info";
|
|
format = "text";
|
|
};
|
|
frontend = {
|
|
enabled = true;
|
|
title = "CCCB Prusa Connect Local";
|
|
printer_address = "https://172.23.42.30";
|
|
};
|
|
discovery.host_records = "system";
|
|
};
|
|
persistence.type = "sqlite";
|
|
resources = {
|
|
storage.local = {
|
|
type = "filesystem";
|
|
config.root = "/var/lib/prusa-connect/storage";
|
|
};
|
|
};
|
|
};
|
|
|
|
virtualisation.oci-containers.containers.prusa-connect = {
|
|
labels."io.containers.autoupdate" = "registry";
|
|
image = "ghcr.io/prusa3d/prusa-connect:0.1.0-beta.2";
|
|
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;
|
|
enableACME = true;
|
|
locations."/" = {
|
|
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;
|
|
'';
|
|
};
|
|
extraConfig = ''
|
|
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
|
|
error_log syslog:server=unix:/dev/log,tag=prusa_connect_club_berlin_ccc_de warn;
|
|
access_log syslog:server=unix:/dev/log vhost_combined;
|
|
'';
|
|
};
|
|
};
|
|
|
|
security.acme.certs."${fqdn}".reloadServices = [ "nginx" ];
|
|
}
|