setup scripts

This commit is contained in:
soraefir
2026-05-09 17:50:23 +02:00
parent 55d678df19
commit 63d2dddd1e
2 changed files with 70 additions and 12 deletions

View File

@@ -33,13 +33,13 @@ in {
"SMTP_PASSWORD" = "mail_password";
"MAIL_FROM_ADDRESS" = "${containerCfg.subdomain}@${serverCfg.hostDomain}";
"MAIL_DOMAIN" = serverCfg.mailDomain;
"TRUSTED_PROXIES" = "...";
"TRUSTED_PROXIES" = "10.10.0.0/16 192.168.0.0/16";
};
extraLabels = {
"traefik.http.routers.${containerCfg.subdomain}.middlewares" = "sts_headers,${containerCfg.subdomain}-caldav";
"traefik.http.middlewares.${containerCfg.subdomain}-caldav.redirectregex.permanent" = "true";
"traefik.http.middlewares.${containerCfg.subdomain}-caldav.redirectregex.regex" = "^https://(.*)/.well-known/(card|cal)dav";
"traefik.http.middlewares.${containerCfg.subdomain}-caldav.redirectregex.replacement" = "https://$\${1}/remote.php/dav/";
"traefik.http.middlewares.${containerCfg.subdomain}-caldav.redirectregex.regex=https://(.*)/.well-known/(?:card|cal)dav"
"traefik.http.middlewares.${containerCfg.subdomain}-caldav.redirectregex.replacement=https://$${1}/remote.php/dav"
"traefik.http.middlewares.sts_headers.headers.stsSeconds" = "15552000";
"traefik.http.middlewares.sts_headers.headers.stsIncludeSubdomains" = "true";
};
@@ -54,6 +54,29 @@ in {
];
};
};
};
setup = {
trigger="server";
script = pkgs.writeShellScript "setup" ''
# Define the command wrapper
OCC="${pkgs.podman}/bin/podman exec -u www-data nextcloud php occ"
echo "Waiting for Nextcloud container to start..."
until $OCC status > /dev/null 2>&1; do
sleep 2
done
echo "Maintenance ..."
$OCC maintenance:repair --include-expensive --non-interaction
$OCC db:add-missing-indices --non-interaction
echo "Applying settings..."
$OCC app:install calendar || true
$OCC config:system:set phone_region --value="CH"
$OCC config:app:set core backgroundjobs_mode --value="cron"
'';
};
}