-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
902a589
commit 58f4344
Showing
9 changed files
with
277 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
modules/common/types/server/services/databases/redis/default.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
config, | ||
lib, | ||
... | ||
}: let | ||
inherit (lib) mkIf; | ||
|
||
cfg = config.modules.services.database.redis; | ||
in { | ||
config = mkIf cfg.enable { | ||
services.redis = { | ||
vmOverCommit = true; | ||
servers = { | ||
gitea = mkIf cfg.gitea.enable { | ||
enable = true; | ||
user = "gitea"; | ||
port = 6371; | ||
databases = 16; | ||
logLevel = "debug"; | ||
requirePass = "gitea"; | ||
}; | ||
|
||
searxng = mkIf cfg.searxng.enable { | ||
enable = true; | ||
user = "searx"; | ||
port = 6370; | ||
databases = 16; | ||
logLevel = "debug"; | ||
requirePass = "searxng"; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
_: { | ||
imports = [ | ||
./grafana.nix | ||
./prometheus.nix | ||
./grafana | ||
./prometheus | ||
]; | ||
} |
52 changes: 0 additions & 52 deletions
52
modules/common/types/server/services/monitoring/grafana.nix
This file was deleted.
Oops, something went wrong.
86 changes: 86 additions & 0 deletions
86
modules/common/types/server/services/monitoring/grafana/default.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{ | ||
config, | ||
lib, | ||
... | ||
}: let | ||
inherit (lib) mkIf; | ||
inherit (config.networking) domain; | ||
|
||
cfg = config.modules.services.monitoring.grafana; | ||
|
||
port = 3100; | ||
in { | ||
config = mkIf cfg.enable { | ||
networking.firewall.allowedTCPPorts = [port]; | ||
|
||
services = { | ||
postgresql = { | ||
enable = true; | ||
ensureDatabases = ["grafana"]; | ||
ensureUsers = [ | ||
{ | ||
name = "grafana"; | ||
ensurePermissions."DATABASE grafana" = "ALL PRIVILEGES"; | ||
} | ||
]; | ||
}; | ||
|
||
grafana = { | ||
enable = true; | ||
settings = { | ||
analytics = { | ||
reporting_enabled = false; | ||
check_for_updates = false; | ||
}; | ||
|
||
server = { | ||
http_port = port; | ||
http_addr = "0.0.0.0"; | ||
domain = "graph.${domain}"; | ||
enforce_domain = true; | ||
}; | ||
|
||
"auth.anonymous".enabled = true; | ||
"auth.basic".enabled = false; | ||
|
||
users = { | ||
allow_signup = false; | ||
}; | ||
|
||
database = { | ||
type = "postgres"; | ||
host = "/run/postgresql"; | ||
name = "grafana"; | ||
user = "grafana"; | ||
ssl_mode = "disable"; | ||
}; | ||
|
||
smtp = let | ||
mailer = "grafana@${domain}"; | ||
in { | ||
enabled = true; | ||
|
||
user = mailer; | ||
password = "$__file{" + config.sops.secrets.mailserver-grafana-nohash.path + "}"; | ||
|
||
host = "mail.${domain}:465"; | ||
from_address = mailer; | ||
startTLS_policy = "MandatoryStartTLS"; | ||
}; | ||
}; | ||
provision = { | ||
datasources.settings = { | ||
datasources = [ | ||
{ | ||
name = "Prometheus"; | ||
type = "prometheus"; | ||
url = "http://localhost:9090"; | ||
orgId = 1; | ||
} | ||
]; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
Oops, something went wrong.