2023-08-31 01:55:45 +03:00
|
|
|
{ cluster, config, lib, pkgs, depot, ... }:
|
2021-11-27 01:10:36 +02:00
|
|
|
let
|
2022-08-08 00:38:46 +03:00
|
|
|
patroni = cluster.config.links.patroni-pg-access;
|
2021-11-27 01:10:36 +02:00
|
|
|
in
|
2021-10-16 21:23:55 +03:00
|
|
|
{
|
|
|
|
age.secrets = {
|
|
|
|
nextcloud-adminpass = {
|
2023-06-05 02:20:22 +03:00
|
|
|
file = ../../../secrets/nextcloud-adminpass.age;
|
2021-10-16 21:23:55 +03:00
|
|
|
owner = "nextcloud";
|
|
|
|
group = "nextcloud";
|
|
|
|
mode = "0400";
|
|
|
|
};
|
|
|
|
nextcloud-dbpass = {
|
2023-06-05 02:20:22 +03:00
|
|
|
file = ../../../secrets/nextcloud-dbpass.age;
|
2021-10-16 21:23:55 +03:00
|
|
|
owner = "nextcloud";
|
|
|
|
group = "nextcloud";
|
|
|
|
mode = "0400";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
services.nextcloud = {
|
2024-06-04 21:07:33 +03:00
|
|
|
package = pkgs.nextcloud28;
|
2021-10-16 21:23:55 +03:00
|
|
|
enable = true;
|
|
|
|
https = true;
|
2023-08-31 01:55:45 +03:00
|
|
|
hostName = "storage.${depot.lib.meta.domain}";
|
2021-10-16 21:23:55 +03:00
|
|
|
home = "/srv/storage/www-app/nextcloud";
|
|
|
|
maxUploadSize = "4G";
|
|
|
|
enableImagemagick = true;
|
|
|
|
caching = with lib; flip genAttrs (_: true) [
|
|
|
|
"apcu" "redis"
|
|
|
|
];
|
|
|
|
|
|
|
|
autoUpdateApps = {
|
|
|
|
enable = true;
|
|
|
|
startAt = "02:00";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
2022-08-08 00:38:46 +03:00
|
|
|
dbhost = patroni.tuple;
|
2021-10-16 21:23:55 +03:00
|
|
|
dbtype = "pgsql";
|
|
|
|
dbname = "storage";
|
|
|
|
dbuser = "storage";
|
2022-08-08 00:38:46 +03:00
|
|
|
dbpassFile = config.age.secrets.nextcloud-dbpass.path;
|
2021-10-16 21:23:55 +03:00
|
|
|
|
|
|
|
overwriteProtocol = "https";
|
|
|
|
|
|
|
|
adminuser = "sa";
|
2022-08-08 00:38:46 +03:00
|
|
|
adminpassFile = config.age.secrets.nextcloud-adminpass.path;
|
2021-10-16 21:23:55 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
services.nginx.virtualHosts."${config.services.nextcloud.hostName}" = {
|
|
|
|
addSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
};
|
2021-12-03 00:39:54 +02:00
|
|
|
systemd.services = {
|
|
|
|
phpfpm-nextcloud.aliases = [ "nextcloud.service" ];
|
2022-08-09 00:15:08 +03:00
|
|
|
nextcloud-setup.serviceConfig = {
|
|
|
|
Restart = "on-failure";
|
|
|
|
RestartSec = "10s";
|
|
|
|
};
|
2021-12-03 00:39:54 +02:00
|
|
|
};
|
2021-10-16 21:23:55 +03:00
|
|
|
}
|