blob: c7ca98f798ae6dee91a3eabde901105e9c39ec5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
{
config,
lib,
...
}:
with lib;
let
service = "lubelogger";
cfg = config.modules.containers.${service};
in
{
options.modules.containers.${service} = {
enable = mkEnableOption service;
user = mkOption {
default = "share";
type = types.str;
};
group = mkOption {
default = "share";
type = types.str;
};
port = mkOption {
default = 8889;
type = types.int;
};
url = mkOption {
default = null;
type = types.str;
};
configDir = mkOption {
default = "/opt/${service}";
type = types.str;
};
};
config = mkIf cfg.enable {
users.users.${cfg.user} = {
isSystemUser = true;
group = cfg.group;
};
users.groups.${cfg.group} = { };
networking.firewall.allowedTCPPorts = [
80
443
];
services.caddy = {
enable = true;
virtualHosts = {
${cfg.url}.extraConfig = ''
encode zstd gzip
reverse_proxy http://localhost:${builtins.toString cfg.port}
'';
};
};
systemd.tmpfiles.rules = builtins.map (f: "d ${f} 0755 ${cfg.user} ${cfg.group} - -") [
cfg.configDir
];
virtualisation.oci-containers.containers.${service} = {
image = "ghcr.io/hargata/lubelogger:latest";
autoStart = true;
ports = [ "${builtins.toString cfg.port}:8080" ];
volumes = [
"${cfg.configDir}/config:/App/config"
"${cfg.configDir}/data:/App/data"
"${cfg.configDir}/translations:/App/wwwroot/translations"
"${cfg.configDir}/documents:/App/wwwroot/documents"
"${cfg.configDir}/images:/App/wwwroot/images"
"${cfg.configDir}/temp:/App/wwwroot/temp"
"${cfg.configDir}/log:/App/log"
"${cfg.configDir}/keys:/root/.aspnet/DataProtection-Keys"
];
environment = {
LC_ALL = "en_US.UTF-8";
LANG = "en_US.UTF-8";
LUBELOGGER_ALLOWED_FILE_EXTENSIONS = "*";
};
};
};
}
|