From c8397feaa47c144c394b5dd9e4feb76968a920ae Mon Sep 17 00:00:00 2001 From: Dustin Kaiser Date: Wed, 18 Dec 2024 09:37:24 +0100 Subject: [PATCH] Refactor j2 calling convention, always pass .env file path explicitly --- scripts/common.Makefile | 4 +-- services/maintenance-page/Makefile | 2 +- services/monitoring/Makefile | 10 ++++---- .../grafana-image-renderer/README.md | 7 ------ .../grafana-image-renderer/config.json | 25 ------------------- services/redis-commander/Makefile | 2 +- services/registry/Makefile | 2 +- services/traefik/Makefile | 4 +-- services/vendors/Makefile | 2 +- 9 files changed, 13 insertions(+), 45 deletions(-) delete mode 100644 services/monitoring/grafana-image-renderer/README.md delete mode 100644 services/monitoring/grafana-image-renderer/config.json diff --git a/scripts/common.Makefile b/scripts/common.Makefile index 553ec38d..b1077133 100644 --- a/scripts/common.Makefile +++ b/scripts/common.Makefile @@ -253,13 +253,13 @@ venv: $(REPO_BASE_DIR)/.venv/bin/activate ## Creates a python virtual environmen ifeq ($(shell test -f j2cli_customization.py && echo -n yes),yes) define jinja - $(REPO_BASE_DIR)/.venv/bin/j2 --format=env $(1) .env -o $(2) --customize j2cli_customization.py + $(REPO_BASE_DIR)/.venv/bin/j2 --format=env $(1) $(2) -o $(3) --customize j2cli_customization.py endef else define jinja - $(REPO_BASE_DIR)/.venv/bin/j2 --format=env $(1) .env -o $(2) + $(REPO_BASE_DIR)/.venv/bin/j2 --format=env $(1) $(2) -o $(3) endef endif diff --git a/services/maintenance-page/Makefile b/services/maintenance-page/Makefile index 30593119..b81c926a 100644 --- a/services/maintenance-page/Makefile +++ b/services/maintenance-page/Makefile @@ -33,7 +33,7 @@ up-master: up .PHONY: docker-compose.yml docker-compose.yml: .venv .env - @$(call jinja, docker-compose.yml.j2, docker-compose.yml.unlinted) && \ + @$(call jinja, docker-compose.yml.j2, .env, docker-compose.yml.unlinted) && \ $(_yq) docker-compose.yml.unlinted > docker-compose.yml; \ rm docker-compose.yml.unlinted >/dev/null 2>&1; diff --git a/services/monitoring/Makefile b/services/monitoring/Makefile index 1827363a..71be12e8 100644 --- a/services/monitoring/Makefile +++ b/services/monitoring/Makefile @@ -74,7 +74,7 @@ ${TEMP_COMPOSE}-local: docker-compose.yml docker-compose.letsencrypt.dns.yml con @${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< docker-compose.letsencrypt.dns.yml > $@ docker-compose.yml: docker-compose.yml.j2 .env .venv pgsql_query_exporter_config.yaml - $(call jinja,$<,$@) + $(call jinja,$<,.env,$@) .PHONY: update.grafana.pwd update.grafana.pwd: .env ## Change grafana pwd @@ -101,7 +101,7 @@ grafana-import: grafana/assets .venv ## Imports AND OVERWRITES the remote grafan .PHONY: config.grafana.dashboards config.grafana.dashboards: grafana/templates-provisioning/dashboards/simcore/Metrics-dashboard.json.j2 .venv #Configure dashboards for aws or dalco clusters - $(call jinja, $<, grafana/provisioning/dashboards/simcore/Metrics-dashboard.json) + $(call jinja, $<, .env, grafana/provisioning/dashboards/simcore/Metrics-dashboard.json) .PHONY: config.monitoring config.monitoring: grafana/template-config.monitoring ${REPO_CONFIG_LOCATION} @@ -133,7 +133,7 @@ config.prometheus.ceph.simcore: ${REPO_CONFIG_LOCATION} .venv @set -o allexport; \ source $<; \ set +o allexport; \ - $(call jinja, prometheus/prometheus-ceph.yml.j2, prometheus/prometheus-ceph.yml); \ + $(call jinja, prometheus/prometheus-ceph.yml.j2, .env, prometheus/prometheus-ceph.yml); \ cat prometheus/prometheus-base.yml | $(_yq) '. *+ load("prometheus/prometheus-simcore.yml")' | cat | \ $(_yq) '. *+ load("prometheus/prometheus-ceph.yml")' > prometheus/prometheus.yml; \ envsubst < prometheus/prometheus.yml > prometheus/prometheus.temp.yml; \ @@ -148,10 +148,10 @@ config.prometheus: ${REPO_CONFIG_LOCATION} .venv mv prometheus/prometheus.temp.yml prometheus/prometheus.yml pgsql_query_exporter_config.yaml: pgsql_query_exporter_config.yaml.j2 ${REPO_CONFIG_LOCATION} .env .venv - $(call jinja, $<, $@); + $(call jinja, $<, .env, $@); smokeping_prober_config.yaml: smokeping_prober_config.yaml.j2 ${REPO_CONFIG_LOCATION} .env .venv - $(call jinja, $<, $@); + $(call jinja, $<, .env, $@); .PHONY: grafana/assets grafana/assets: ${REPO_CONFIG_LOCATION} diff --git a/services/monitoring/grafana-image-renderer/README.md b/services/monitoring/grafana-image-renderer/README.md deleted file mode 100644 index 0c804551..00000000 --- a/services/monitoring/grafana-image-renderer/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# the grafana image renderer - -Process that allows generation of PNGs out of panels. - -Must run in a separate process when used inside a docker container - -https://grafana.com/docs/grafana/latest/administration/image_rendering/ diff --git a/services/monitoring/grafana-image-renderer/config.json b/services/monitoring/grafana-image-renderer/config.json deleted file mode 100644 index 99f6fa13..00000000 --- a/services/monitoring/grafana-image-renderer/config.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "service": { - "metrics": { - "enabled": false - }, - "logging": { - "level": "debug", - "console": { - "json": false, - "colorize": false - } - } - }, - "rendering": { - "mode": "clustered", - "clustering": { - "mode": "context", - "maxConcurrency": 5, - "timeout": 600 - }, - "timezone": "Europe/Zurich", - "verboseLogging": true, - "dumpio": false - } -} diff --git a/services/redis-commander/Makefile b/services/redis-commander/Makefile index d883d163..a8da08c7 100644 --- a/services/redis-commander/Makefile +++ b/services/redis-commander/Makefile @@ -52,6 +52,6 @@ ${TEMP_COMPOSE}-letsencrypt-dns: docker-compose.yml docker-compose.letsencrypt.d config.json: config.json.j2 .env .venv # generate $@ - @$(call jinja, $<, $@) + @$(call jinja, $<, .env, $@) # validate and format $@ @cat $@ | jq > /dev/null diff --git a/services/registry/Makefile b/services/registry/Makefile index f00ab1b3..ecf10fcc 100644 --- a/services/registry/Makefile +++ b/services/registry/Makefile @@ -52,7 +52,7 @@ up-public: up-dalco # Helpers ------------------------------------------------- docker-compose.yml: docker-compose.yml.j2 .venv .env - @$(call jinja, $<, $@) + @$(call jinja, $<, .env, $@) .PHONY: ${TEMP_COMPOSE}-local ${TEMP_COMPOSE}-local: docker-compose.yml docker-compose.self-signed.yml .env diff --git a/services/traefik/Makefile b/services/traefik/Makefile index 28ac3332..9521b323 100644 --- a/services/traefik/Makefile +++ b/services/traefik/Makefile @@ -101,13 +101,13 @@ ${TEMP_COMPOSE}-master: docker-compose.yml docker-compose.master.yml .env .PHONY: docker-compose.letsencrypt.dns.yml docker-compose.letsencrypt.dns.yml: .venv .env - @$(call jinja, docker-compose.letsencrypt.dns.yml.j2, docker-compose.letsencrypt.dns.yml.unlinted) && \ + @$(call jinja, docker-compose.letsencrypt.dns.yml.j2, .env, docker-compose.letsencrypt.dns.yml.unlinted) && \ $(_yq) docker-compose.letsencrypt.dns.yml.unlinted > docker-compose.letsencrypt.dns.yml; \ rm docker-compose.letsencrypt.dns.yml.unlinted >/dev/null 2>&1; .PHONY: docker-compose.yml docker-compose.yml: traefik_dynamic_config.yml .venv .env - @$(call jinja, docker-compose.yml.j2, docker-compose.yml.unlinted) && \ + @$(call jinja, docker-compose.yml.j2, .env, docker-compose.yml.unlinted) && \ $(_yq) docker-compose.yml.unlinted > docker-compose.yml; \ rm docker-compose.yml.unlinted >/dev/null 2>&1; diff --git a/services/vendors/Makefile b/services/vendors/Makefile index f65c210b..2885edfc 100644 --- a/services/vendors/Makefile +++ b/services/vendors/Makefile @@ -32,7 +32,7 @@ up-local: up .PHONY: docker-compose.yml docker-compose.yml: .venv .env - @$(call jinja, docker-compose.yml.j2, docker-compose.yml.unlinted) && \ + @$(call jinja, docker-compose.yml.j2, .env, docker-compose.yml.unlinted) && \ $(_yq) docker-compose.yml.unlinted > docker-compose.yml; \ rm docker-compose.yml.unlinted >/dev/null 2>&1;