c3115026e9
Requires= doesn't restart a service once its required mount comes back after a USB disconnect/remount, so a dedicated storage-keepalive unit now Upholds= every storage-dependent service to bring it back automatically. Also adds the missing Nextcloud cron.php timer (background jobs were never triggered), and disables opcache.jit in the Nextcloud container — PHP 8.4's JIT was miscompiling OC\Config\UserConfig::getValueBool(), crashing every session-bootstrapping request with a bogus strtolower() TypeError. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
98 lines
3.3 KiB
Nix
98 lines
3.3 KiB
Nix
{ config, lib, pkgs, homeyConfig, ... }:
|
|
|
|
let
|
|
cfg = config.homey.stirlingPdf;
|
|
dataDir = config.homey.storage.mountPoint;
|
|
domain = homeyConfig.domain;
|
|
in
|
|
{
|
|
options.homey.stirlingPdf = {
|
|
enable = lib.mkEnableOption "Stirling-PDF document tools";
|
|
|
|
image = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "stirlingtools/stirling-pdf:latest";
|
|
};
|
|
|
|
port = lib.mkOption {
|
|
type = lib.types.port;
|
|
default = 8084;
|
|
description = "Host port Stirling-PDF listens on (bound to 127.0.0.1).";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
# -----------------------------------------------------------------------
|
|
# Container
|
|
# -----------------------------------------------------------------------
|
|
virtualisation.oci-containers.containers.stirling-pdf = {
|
|
image = cfg.image;
|
|
ports = [ "127.0.0.1:${toString cfg.port}:8080" ];
|
|
|
|
environment = {
|
|
# Disable Stirling-PDF's own login — Authelia forward_auth handles auth
|
|
DOCKER_ENABLE_SECURITY = "false";
|
|
SECURITY_ENABLELOGIN = "false";
|
|
INSTALL_BOOK_AND_ADVANCED_HTML_OPS = "false";
|
|
LANGS = "en_GB";
|
|
TZ = homeyConfig.timezone;
|
|
};
|
|
|
|
volumes = [
|
|
"${dataDir}/stirling-pdf/configs:/configs"
|
|
"${dataDir}/stirling-pdf/customFiles:/customFiles"
|
|
];
|
|
|
|
extraOptions = [ "--network=homey" ];
|
|
};
|
|
|
|
systemd.services."podman-stirling-pdf" = {
|
|
after = lib.mkAfter [ "mnt-data.mount" "podman-homey-network.service" ];
|
|
requires = lib.mkAfter [ "mnt-data.mount" "podman-homey-network.service" ];
|
|
};
|
|
|
|
# -----------------------------------------------------------------------
|
|
# Caddy virtual host — forward_auth to Authelia
|
|
# -----------------------------------------------------------------------
|
|
homey.caddy.virtualHosts = [{
|
|
subdomain = "pdf";
|
|
port = cfg.port;
|
|
auth = true;
|
|
}];
|
|
|
|
# -----------------------------------------------------------------------
|
|
# Authelia access control — one_factor for any authenticated user
|
|
# -----------------------------------------------------------------------
|
|
homey.authelia.accessControlRules = [{
|
|
priority = 56;
|
|
domain = [ "pdf.${domain}" ];
|
|
policy = "one_factor";
|
|
}];
|
|
|
|
# -----------------------------------------------------------------------
|
|
# Storage directories
|
|
# -----------------------------------------------------------------------
|
|
homey.storage.upholds = [ "podman-stirling-pdf.service" ];
|
|
|
|
homey.storage.extraDirs = [
|
|
{ path = "stirling-pdf"; }
|
|
{ path = "stirling-pdf/configs"; mode = "0755"; }
|
|
{ path = "stirling-pdf/customFiles"; mode = "0755"; }
|
|
];
|
|
|
|
# -----------------------------------------------------------------------
|
|
# Backup
|
|
# -----------------------------------------------------------------------
|
|
homey.backup.extraPaths = [ "${dataDir}/stirling-pdf/configs" ];
|
|
|
|
# -----------------------------------------------------------------------
|
|
# Uptime Kuma monitor
|
|
# -----------------------------------------------------------------------
|
|
homey.monitoring.monitors = [{
|
|
name = "Stirling-PDF";
|
|
url = "https://pdf.${domain}";
|
|
interval = 60;
|
|
}];
|
|
};
|
|
}
|