nix-config/modules/data-hoarder/datacare.nix

52 lines
1.5 KiB
Nix
Raw Normal View History

{ config, ... }: {
2022-12-30 18:29:13 +01:00
TLMS.datacare = {
enable = true;
host = "127.0.0.1";
port = 8070;
2023-01-12 23:19:07 +01:00
database = {
host = "127.0.0.1";
port = config.services.postgresql.port;
2023-03-05 14:12:50 +01:00
user = "tlms";
database = "tlms";
2023-01-12 23:19:07 +01:00
passwordFile = config.sops.secrets.postgres_password.path;
};
saltFile = config.sops.secrets.postgres_password_hash_salt.path;
user = "datacare";
2023-03-05 14:12:50 +01:00
group = config.users.groups.postgres-tlms.name;
};
systemd.services."datacare" = {
after = [ "postgresql.service" ];
wants = [ "postgresql.service" ];
};
services = {
nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts = {
2023-04-18 21:48:32 +02:00
"datacare.${(builtins.replaceStrings [ "tlm.solutions" ] [ "dvb.solutions" ] config.deployment-TLMS.domain)}" = {
enableACME = true;
forceSSL = true;
extraConfig = ''
rewrite ^ https://datacare.${config.deployment-TLMS.domain}$request_uri permanent;
'';
};
2022-12-30 18:29:13 +01:00
"datacare.${config.deployment-TLMS.domain}" = {
forceSSL = true;
enableACME = true;
locations = {
"/" = {
2022-12-30 18:29:13 +01:00
proxyPass = with config.TLMS.datacare; "http://${host}:${toString port}/";
proxyWebsockets = true;
2023-03-10 19:47:08 +01:00
extraConfig = ''
2023-04-18 21:48:32 +02:00
more_set_headers "Access-Control-Allow-Credentials: true";
'';
};
};
};
};
};
};
}