self-hosting/profiles/backend.nix

162 lines
3.9 KiB
Nix
Raw Normal View History

2024-08-26 05:38:10 +02:00
{
config,
lib,
pkgs,
...
}:
{
imports = [
../environment.nix
../hardware/hcloud.nix
../modules
];
2021-11-25 00:59:46 +01:00
2021-11-29 02:04:29 +01:00
sops.secrets = {
borgSshKey = {
owner = config.services.borgbackup.jobs.data.user;
key = "borg/client_keys/backend1/private";
};
2024-09-12 15:14:15 +02:00
dolibarrDbPassword = {
owner = config.users.users.dolibarr.name;
key = "dolibarr/db_password";
restartUnits = [ "phpfpm-dolibarr.service" ];
};
2021-11-29 02:04:29 +01:00
};
custom = {
2024-03-26 23:37:53 +01:00
services.backup-job = {
enable = true;
2023-04-22 02:46:55 +02:00
repoName = "bk1";
2024-08-26 05:38:10 +02:00
additionalPaths = [
"/var/lib/nextcloud/config"
"/var/lib/mastodon"
];
readWritePaths = [
"/nix/var/data/murmur"
"/nix/var/data/backup/"
];
preHook = ''
cp /var/lib/murmur/murmur.sqlite /nix/var/data/murmur/murmur.sqlite
'';
startAt = "03:30";
sshKey = config.sops.secrets.borgSshKey.path;
};
services.monit = {
enable = true;
additionalConfig = ''
check file nextcloud-data-mounted with path /var/lib/nextcloud/data/index.html
start = "${pkgs.systemd}/bin/systemctl start nextcloud-data-sshfs.service"
2021-11-25 00:59:46 +01:00
check host jellyfin with address jellyfin.banditlair.com
if failed port 443 protocol https with timeout 20 seconds then alert
check host stb with address www.societe-de-tir-bertrix.com
if failed port 443 protocol https with timeout 20 seconds then alert
check host transmission with address transmission.banditlair.com
if failed
port 443
protocol https
status = 401
with timeout 20 seconds
then alert
2022-10-30 01:05:16 +02:00
check host osteoview with address osteoview.app
if failed
port 443
protocol https
status = 200
request "/api/_health"
with timeout 5 seconds
2024-08-26 05:38:10 +02:00
content = "Healthy"
then alert
'';
};
2024-03-26 23:37:53 +01:00
services.nginx.enable = true;
services.dokuwiki.enable = true;
services.openssh.enable = true;
services.murmur.enable = true;
2023-12-13 18:51:56 +01:00
services.mastodon.enable = false;
2024-03-26 23:37:53 +01:00
services.synapse.enable = true;
services.nextcloud.enable = true;
services.roundcube.enable = true;
services.monitoring-exporters.enable = true;
};
2021-12-27 05:28:51 +01:00
2022-12-02 06:36:45 +01:00
services.uptime-kuma = {
enable = true;
2024-08-26 05:38:10 +02:00
settings = {
PORT = "3001";
};
2022-12-02 06:36:45 +01:00
};
2024-03-26 23:37:53 +01:00
services.nginx.virtualHosts = {
"osteopathie.froidmont.org" = {
enableACME = true;
forceSSL = true;
root = "/nix/var/data/website-marie";
};
"uptime.froidmont.org" = {
serverAliases = [ "status.${config.networking.domain}" ];
forceSSL = true;
enableACME = true;
2022-12-02 06:36:45 +01:00
2024-03-26 23:37:53 +01:00
locations."/" = {
2024-08-26 05:38:10 +02:00
proxyPass = "http://127.0.0.1:${config.services.uptime-kuma.settings.PORT}";
2024-03-26 23:37:53 +01:00
proxyWebsockets = true;
};
2022-12-02 06:36:45 +01:00
};
2024-03-26 23:37:53 +01:00
"www.fautlfer.com" = {
enableACME = true;
forceSSL = true;
2024-01-30 08:20:48 +01:00
2024-03-26 23:37:53 +01:00
locations."= /".extraConfig = ''
return 302 https://blogz.zaclys.com/faut-l-fer/;
'';
};
2024-01-30 08:20:48 +01:00
2024-03-26 23:37:53 +01:00
"fautlfer.com" = {
enableACME = true;
forceSSL = true;
2024-01-30 08:20:48 +01:00
2024-03-26 23:37:53 +01:00
locations."= /".extraConfig = ''
return 302 https://blogz.zaclys.com/faut-l-fer/;
'';
};
2024-01-30 08:20:48 +01:00
};
2024-09-12 15:14:15 +02:00
services.dolibarr = {
enable = true;
domain = "dolibarr.froidmont.solutions";
stateDir = "/nix/var/data/dolibarr";
database = {
createLocally = false;
host = "10.0.1.11";
port = 5432;
name = "dolibarr";
user = "dolibarr";
passwordFile = config.sops.secrets.dolibarrDbPassword.path;
};
settings = {
dolibarr_main_db_type = lib.mkForce "pgsql";
};
nginx = { };
};
2024-08-26 05:38:10 +02:00
networking.firewall.allowedTCPPorts = [
80
443
64738
];
2021-11-25 00:59:46 +01:00
networking.firewall.allowedUDPPorts = [ 64738 ];
2024-08-26 05:38:10 +02:00
networking.firewall.interfaces."eth1".allowedTCPPorts = [
config.services.prometheus.exporters.node.port
9000
];
2021-11-25 00:59:46 +01:00
}