2024-04-19 17:11:03 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2021-08-06 17:40:57 +00:00
|
|
|
|
|
|
|
{
|
2024-07-02 13:11:38 +00:00
|
|
|
containers.nextcloud.timeoutStartSec = "10 min";
|
2024-04-19 17:11:03 +00:00
|
|
|
hacc.containers.nextcloud = {
|
|
|
|
config = { config, lib, pkgs, ... }: {
|
2021-08-06 17:40:57 +00:00
|
|
|
environment.systemPackages = [ pkgs.htop ];
|
|
|
|
|
2022-11-09 23:40:25 +00:00
|
|
|
services.nextcloud = {
|
2021-08-06 17:40:57 +00:00
|
|
|
enable = true;
|
|
|
|
|
|
|
|
# must be set manually; may not be incremented by more than one at
|
|
|
|
# a time, otherwise nextcloud WILL break
|
2024-07-25 16:37:43 +00:00
|
|
|
package = pkgs.nextcloud29;
|
2021-08-06 17:40:57 +00:00
|
|
|
|
|
|
|
home = "/persist/nextcloud";
|
|
|
|
https = true;
|
|
|
|
|
|
|
|
hostName = "cloud.infra4future.de";
|
|
|
|
config = {
|
|
|
|
dbtype = "pgsql";
|
|
|
|
dbuser = "nextcloud";
|
|
|
|
dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
|
|
|
|
dbname = "nextcloud";
|
2023-05-03 22:46:48 +00:00
|
|
|
# socket auth does not needs this, but the module insists it does
|
2023-09-27 16:24:18 +00:00
|
|
|
adminpassFile = "/persist/adminpassfile";
|
2021-08-06 17:40:57 +00:00
|
|
|
adminuser = "root";
|
|
|
|
};
|
|
|
|
|
|
|
|
# multiple pools may be doable using services.phpfpm.pools,
|
|
|
|
# but i have not tried this yet. The nextcloud module defines a
|
|
|
|
# pool "nextcloud"
|
|
|
|
poolSettings = {
|
|
|
|
pm = "dynamic";
|
|
|
|
"pm.max_children" = "32";
|
|
|
|
"pm.max_requests" = "500";
|
|
|
|
"pm.max_spare_servers" = "4";
|
|
|
|
"pm.min_spare_servers" = "2";
|
|
|
|
"pm.start_servers" = "2";
|
|
|
|
};
|
|
|
|
|
2024-07-25 16:37:43 +00:00
|
|
|
settings = {
|
2021-08-06 17:40:57 +00:00
|
|
|
instanceid = "ocxlphb7fbju";
|
2022-11-10 19:13:26 +00:00
|
|
|
datadirectory = "/persist/nextcloud/data";
|
2021-08-06 17:40:57 +00:00
|
|
|
loglevel = 0;
|
|
|
|
"overwrite.cli.url" = "https://cloud.infra4future.de";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.postgresql = {
|
|
|
|
enable = true;
|
2023-11-30 16:43:48 +00:00
|
|
|
package = pkgs.postgresql_15;
|
2021-08-06 17:40:57 +00:00
|
|
|
ensureDatabases = [ "nextcloud" ];
|
|
|
|
ensureUsers = [
|
|
|
|
{ # by default, postgres has unix sockets enabled, and allows a
|
|
|
|
# system user `nextcloud` to log in without other authentication
|
|
|
|
name = "nextcloud";
|
2023-11-30 16:43:48 +00:00
|
|
|
ensureDBOwnership = true;
|
2021-08-06 17:40:57 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-01-28 14:48:13 +00:00
|
|
|
services.postgresqlBackup = {
|
|
|
|
enable = true;
|
|
|
|
databases = [ "nextcloud" ];
|
|
|
|
startAt = "*-*-* 23:45:00";
|
|
|
|
location = "/persist/backups/postgres";
|
|
|
|
};
|
|
|
|
|
2021-08-06 17:40:57 +00:00
|
|
|
# ensure that postgres is running *before* running the setup
|
|
|
|
systemd.services."nextcloud-setup" = {
|
|
|
|
requires = ["postgresql.service"];
|
|
|
|
after = ["postgresql.service"];
|
|
|
|
};
|
2024-04-19 17:11:03 +00:00
|
|
|
};
|
2021-08-06 17:40:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."cloud.infra4future.de" = {
|
|
|
|
locations."/".proxyPass = "http://${config.containers.nextcloud.localAddress}:80";
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
2021-11-22 19:50:55 +00:00
|
|
|
extraConfig = ''
|
|
|
|
proxy_buffering off;
|
|
|
|
client_max_body_size 0;
|
2022-04-30 21:35:19 +00:00
|
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
2021-11-22 19:50:55 +00:00
|
|
|
'';
|
2021-08-06 17:40:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|