aboutsummaryrefslogtreecommitdiffstats
path: root/modules/by-name/ng
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/by-name/ng/nginx/module.nix41
1 files changed, 25 insertions, 16 deletions
diff --git a/modules/by-name/ng/nginx/module.nix b/modules/by-name/ng/nginx/module.nix
index fa3337d..1317d4d 100644
--- a/modules/by-name/ng/nginx/module.nix
+++ b/modules/by-name/ng/nginx/module.nix
@@ -18,15 +18,6 @@ in {
a default nginx config.
'';
- selfsign = lib.mkOption {
- type = lib.types.bool;
- default = false;
- description = ''
- Whether to selfsign the acme certificates. This should only
- really be useful for tests.
- '';
- };
-
redirects = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = {};
@@ -39,9 +30,27 @@ in {
};
config = lib.mkIf cfg.enable {
- vhack.persist.directories = [
- "/var/lib/acme"
- ];
+ vhack = {
+ persist.directories = [
+ "/var/lib/acme"
+ ];
+
+ monitoring.prometheus = {
+ sources = [
+ {
+ name = "nginx";
+ target = "127.0.0.1:${toString config.services.prometheus.exporters.nginx.port}";
+ }
+ ];
+ };
+ };
+
+ services.prometheus.exporters.nginx = {
+ enable = true;
+ port = 9111;
+ listenAddress = "127.0.0.1";
+ scrapeUri = "http://localhost:80/nginx_status";
+ };
users = {
users.acme = {
@@ -56,10 +65,6 @@ in {
defaults = {
email = "admin@vhack.eu";
webroot = "/var/lib/acme/acme-challenge";
-
- # Avoid spamming the acme server, if we run in a test, and only really want self-signed
- # certificates
- server = lib.mkIf cfg.selfsign "https://127.0.0.1";
};
};
@@ -68,6 +73,10 @@ in {
};
services.nginx = {
enable = true;
+
+ # Enable the status page for the prometheus exporter.
+ statusPage = lib.mkIf config.services.prometheus.enable true;
+
virtualHosts = redirects;
};
};