masive rewriting and setup of server files

This commit is contained in:
2024-09-28 23:10:03 -06:00
parent f9399c51fa
commit 9151ca5971
39 changed files with 756 additions and 556 deletions

View File

@@ -2,13 +2,10 @@
lib,
config,
pkgs,
setup,
...
}:
let
inherit (config.my) localhost;
collaboraPort = 9980;
url = "cloud.${config.my.domain}";
collaboraProxy = "http://${localhost}:${toString collaboraPort}";
commonProxyConfig = ''
proxy_set_header Host $host;
'';
@@ -18,17 +15,16 @@ let
proxy_set_header Host $host;
proxy_read_timeout 36000s;
'';
cfg = config.my.servers.nextcloud;
cfgC = config.my.servers.collabora;
in
{
options.my.servers = {
nextcloud = {
enable = lib.mkEnableOption "enable";
enableCron = lib.mkEnableOption "enable";
};
collabora.enable = lib.mkEnableOption "enable";
nextcloud = setup.mkOptions "nextcloud" "cloud" 80;
collabora = setup.mkOptions "collabora" "collabora" 9980;
go-vod.enable = lib.mkEnableOption "enable";
};
config = lib.mkIf (config.my.servers.nextcloud.enable && config.my.servers.postgres.enable) {
config = lib.mkIf (cfg.enable && config.my.servers.postgres.enable) {
sops.secrets = {
smtp-password = { };
nextcloud-adminpass = {
@@ -80,7 +76,7 @@ in
extraAppsEnable = true;
enableImagemagick = true;
maxUploadSize = "16G";
hostName = url;
hostName = cfg.host;
extraApps = {
inherit (config.services.nextcloud.package.packages.apps) calendar;
};
@@ -139,10 +135,9 @@ in
];
};
# phpExtraExtensions = all: [ all.pdlib all.bz2 ];
phpExtraExtensions = _all: [ ];
};
nginx.virtualHosts = {
${config.services.nextcloud.hostName} = {
"${config.services.nextcloud.hostName}" = lib.mkIf cfg.enableProxy {
forceSSL = true;
enableACME = true;
http2 = true;
@@ -153,34 +148,34 @@ in
{ };
};
};
"collabora.${config.my.domain}" = lib.mkIf config.my.servers.collabora.enable {
"${cfgC.host}" = lib.mkIf cfgC.enableProxy {
forceSSL = true;
enableACME = true;
http2 = true;
locations = {
# static files
"^~ /loleaflet" = {
proxyPass = collaboraProxy;
proxyPass = cfgC.local;
extraConfig = commonProxyConfig;
};
# WOPI discovery URL
"^~ /hosting/discovery" = {
proxyPass = collaboraProxy;
proxyPass = cfgC.local;
extraConfig = commonProxyConfig;
};
# Capabilities
"^~ /hosting/capabilities" = {
proxyPass = collaboraProxy;
proxyPass = cfgC.local;
extraConfig = commonProxyConfig;
};
# download, presentation, image upload and websocket
"~ ^/lool" = {
proxyPass = collaboraProxy;
proxyPass = cfgC.local;
extraConfig = commonWebsocketConfig;
};
# Admin Console websocket
"^~ /lool/adminws" = {
proxyPass = collaboraProxy;
proxyPass = cfgC.local;
extraConfig = commonWebsocketConfig;
};
};
@@ -211,8 +206,8 @@ in
};
ports = [ "9980:9980" ];
environment = {
TZ = "America/Mexico_City";
domain = "cloud.servidos.lat";
TZ = config.my.timeZone;
domain = cfg.host;
aliasgroup1 = "cloud.servidos.lat:443";
aliasgroup2 = "cloud.rotehaare.art:443";
dictionaries = "en_CA en_US es_MX es_ES fr_FR it pt_BR ru";