hosts/suwako: move filehost from marisa to suwako

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2025-09-04 15:32:26 +05:30
parent 6d431bdf9d
commit c2a1654be8
5 changed files with 50 additions and 28 deletions

View File

@@ -3,6 +3,7 @@
imports = [
./nginx.nix
./pufferpanel.nix
./filehost.nix
];
virtualisation.docker = {

View File

@@ -0,0 +1,25 @@
{
config,
pkgs,
inputs,
conf,
...
}:
{
systemd.services.filehost = {
enable = true;
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
Environment = [
"TITLE=nattofiles"
"USER_URL=https://f.${conf.network.addresses.domain.natto}"
"ROCKET_LIMITS={file=\"512MB\",data-form=\"512MB\"}"
"ROCKET_LOG_LEVEL=debug"
"ROCKET_ADDRESS=0.0.0.0"
];
Restart = "on-failure";
ExecStart = "${inputs.filehost.packages.${pkgs.system}.simpler-filehost}/bin/simpler-filehost";
};
};
}

View File

@@ -5,32 +5,55 @@ in
{
services.nginx = {
enable = true;
virtualHosts = with conf.network.addresses.wireguard.ips; {
"moj.${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "https://${suwako}:25565";
appendHttpConfig = ''
map $uri $expires {
default off;
~\.(jpg|jpeg|png|gif|ico)$ 30d;
}
'';
virtualHosts =
let
genericHttpRProxy =
{
addr,
ssl ? true,
conf ? "",
}:
{
enableACME = ssl;
# addSSL = ssl;
forceSSL = ssl;
locations."/" = {
proxyPass = toString addr;
extraConfig = ''
expires $expires;
proxy_set_header Host $host;
''
+ conf;
};
};
in
with conf.network.addresses.wireguard.ips;
{
"moj.${domain}" = genericHttpRProxy { addr = "https://${suwako}:25565"; };
"puffer.${domain}" = genericHttpRProxy {
addr = "http://${suwako}:8080";
conf = ''
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection "Upgrade";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Nginx-Proxy true;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 100M;
'';
};
# Personal filehost
"f.${domain}" = genericHttpRProxy { addr = "http://${suwako}:8000"; };
};
"puffer.${domain}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://${suwako}:8080";
};
extraConfig = ''
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection "Upgrade";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Nginx-Proxy true;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 100M;
'';
};
};
};
}