blob: 760a958218a7ca067d5a769ed4c382c5d402205a (
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
|
{
me,
pkgs,
auxiliaryPkgs,
...
}:
let
inherit (pkgs) dockerTools;
inherit (auxiliaryPkgs) common;
goatcounter = pkgs.goatcounter;
goatcounterLocalPort = 7151;
goatcounterDir = "/srv/goatcounter";
goatcounterImage = dockerTools.streamLayeredImage {
name = "goatcounter";
tag = goatcounter.version;
fromImage = common.alpine.base;
contents = [ goatcounter ];
};
in
{
foundation.services.goatcounter = {
image = goatcounterImage;
ports = [
[
goatcounterLocalPort
8080
]
];
volumes = [
[
"${goatcounterDir}"
"/goatcounter"
]
];
entrypoint = "${goatcounter}/bin/goatcounter";
cmd = [
"serve"
"-automigrate"
"-listen=:8080"
"-tls=none"
"-db=sqlite+/goatcounter/db.sqlite3"
];
};
services.nginx.virtualHosts =
let
vhost =
extra:
{
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString goatcounterLocalPort}/";
proxyWebsockets = true;
};
extraConfig = ''
access_log /var/log/nginx/goat.access.log json_combined;
'';
}
// extra;
domain = {
renard = {
useACMEHost = "rnrd.eu";
};
other = {
enableACME = true;
};
};
in
{
"goat.rnrd.eu" = vhost domain.renard;
"stats.mel.gg" = vhost domain.other;
};
}
|