Compare commits

...

3 commits

Author SHA1 Message Date
uku
5885a850bf
fix(etna): proxy immich via frp and nginx 2025-01-04 16:14:00 +01:00
uku
4f3ff236a4
feat(utils): add mkFrpPassthrough 2025-01-04 16:13:42 +01:00
uku
50a4954704
feat(vesuvio): add acme certificates 2025-01-04 15:27:07 +01:00
5 changed files with 75 additions and 5 deletions

View file

@ -84,4 +84,16 @@
systemd.services."${backend}-mc-${name}".serviceConfig.TimeoutSec = "300";
};
mkFrpPassthrough = name: port: {
services.frp.settings.proxies = [
{
inherit name;
type = "tcp";
localIp = "localhost";
localPort = port;
remotePort = port;
}
];
};
}

View file

@ -1,6 +1,9 @@
{ config, ... }:
{ config, _utils, ... }:
let
frp = _utils.mkFrpPassthrough "immich" config.services.immich.port;
in
{
cfTunnels."im.uku.moe" = "http://localhost:${builtins.toString config.services.immich.port}";
imports = [ frp ];
services.immich = {
enable = true;

View file

@ -0,0 +1,25 @@
{ config, ... }:
{
security.acme = {
acceptTerms = true;
defaults = {
email = "acme@uku.moe";
webroot = "/var/lib/acme/acme-challenge";
};
};
services.nginx.virtualHosts = {
"acme.uku3lig.net" = {
serverAliases = [
"*.uku3lig.net"
"*.uku.moe"
];
locations."/.well-known/acme-challenge".root = config.security.acme.defaults.webroot;
};
};
# /var/lib/acme/acme-challenge must be writable by the ACME user and readable by the Nginx user.
# The easiest way to achieve this is to add the Nginx user to the ACME group.
users.users.nginx.extraGroups = [ "acme" ];
}

View file

@ -1,8 +1,10 @@
{ pkgs, ... }:
{
imports = [
./certificates.nix
./frp.nix
./hetzner.nix
./nginx.nix
];
environment.systemPackages = with pkgs; [
@ -10,8 +12,16 @@
traceroute
];
services.openssh = {
ports = [ 4269 ];
openFirewall = true;
services = {
nginx.enable = true;
openssh = {
ports = [ 4269 ];
openFirewall = true;
};
};
networking.firewall.allowedTCPPorts = [
80
443
];
}

20
systems/vesuvio/nginx.nix Normal file
View file

@ -0,0 +1,20 @@
{
services.nginx.virtualHosts = {
# immich
"im.uku.moe" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:2283";
proxyWebsockets = true;
};
extraConfig = ''
client_max_body_size 5000M;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
send_timeout 600s;
'';
};
};
}