Small modules config restructure
Changed variables names in every module
This commit is contained in:
1 parent
c1d2e52bf8
commit
c92b90e406
83 files changed
+616
-523
No files matched your search
@@ -1,14 +1,15 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.monitoring;
|
||||
cfg = rootCfg.grafana;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.monitoring;
|
||||
cfg = moduleCfg.grafana;
|
||||
domain = config.sops.placeholder."domains/serv";
|
||||
grafanaDomain = "${cfg.subdomain}.${domain}";
|
||||
oidpDomain = "https://${config.selfhosted.pocket-id.subdomain}.${domain}";
|
||||
oidpDomain = "https://${rootCfg.pocket-id.subdomain}.${domain}";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."grafana.env".content = ''
|
||||
GF_SERVER_DOMAIN=${grafanaDomain}
|
||||
GF_SERVER_ROOT_URL=https://${grafanaDomain}/
|
||||
@@ -51,7 +52,7 @@ in
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://${rootCfg.prometheus.name}:9090
|
||||
url: http://${moduleCfg.prometheus.name}:9090
|
||||
isDefault: true
|
||||
editable: true
|
||||
'';
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.monitoring;
|
||||
cfg = rootCfg.grafana;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.monitoring;
|
||||
cfg = moduleCfg.grafana;
|
||||
hostDataPath = "${common.dataDir}/grafana";
|
||||
in
|
||||
{
|
||||
@@ -21,7 +22,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
image = "docker.io/grafana/grafana:13.2.3";
|
||||
ports = [
|
||||
@@ -42,10 +43,10 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${rootCfg.prometheus.name}.service" ];
|
||||
after = [ "${common.backend}-${rootCfg.prometheus.name}.service" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [ "${common.backend}-${moduleCfg.prometheus.name}.service" ];
|
||||
after = [ "${common.backend}-${moduleCfg.prometheus.name}.service" ];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/data ${hostDataPath}/monitoring/datasources
|
||||
cp -f ${config.sops.templates."grafana-datasources.yaml".path} ${hostDataPath}/monitoring/datasources/datasources.yaml
|
||||
|
||||
Reference in new issue
Block a user