From d082bd3c3d8f4913a0362bcf39614b5b6d831344 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 21 Dec 2023 22:22:12 +0100 Subject: [PATCH] Cleanup + upgrade to 22.1.11 --- consul/config/service-defaults/diagrams.hcl | 2 +- consul/config/service-intentions/diagrams.hcl | 4 ++-- diagrams.nomad.hcl | 16 ++++++++-------- images/diagrams/Dockerfile | 4 ++-- prep.d/10-mv-conf.sh | 2 +- variables.yml | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/consul/config/service-defaults/diagrams.hcl b/consul/config/service-defaults/diagrams.hcl index a6d977d..f3ad32f 100644 --- a/consul/config/service-defaults/diagrams.hcl +++ b/consul/config/service-defaults/diagrams.hcl @@ -1,3 +1,3 @@ Kind = "service-defaults" -Name = "[[ .diagrams.instance ]][[ .consul.suffix ]]" +Name = "[[ .instance ]][[ .consul.suffix ]]" Protocol = "http" diff --git a/consul/config/service-intentions/diagrams.hcl b/consul/config/service-intentions/diagrams.hcl index 6017f20..badab36 100644 --- a/consul/config/service-intentions/diagrams.hcl +++ b/consul/config/service-intentions/diagrams.hcl @@ -1,8 +1,8 @@ Kind = "service-intentions" -Name = "[[ .diagrams.instance ]][[ .consul.suffix ]]" +Name = "[[ .instance ]][[ .consul.suffix ]]" Sources = [ { - Name = "[[ .traefik.instance ]]" + Name = "[[ (merge .diagrams .).traefik.instance ]]" Permissions = [ { Action = "allow" diff --git a/diagrams.nomad.hcl b/diagrams.nomad.hcl index 3fe17bd..5d6b98c 100644 --- a/diagrams.nomad.hcl +++ b/diagrams.nomad.hcl @@ -1,5 +1,5 @@ [[ $c := merge .diagrams . -]] -job [[ .diagrams.instance | toJSON ]] { +job [[ .instance | toJSON ]] { [[ template "common/job_start.tpl" $c ]] @@ -9,7 +9,7 @@ job [[ .diagrams.instance | toJSON ]] { } service { - name = "[[ .diagrams.instance ]][[ .consul.suffix ]]" + name = "[[ .instance ]][[ .consul.suffix ]]" port = 8282 [[ template "common/connect.tpl" $c ]] @@ -31,21 +31,21 @@ job [[ .diagrams.instance | toJSON ]] { "[[ $c.traefik.instance ]].enable=[[ $c.traefik.enabled ]]", # Define a middleware to set custom CSP headers - "[[ $c.traefik.instance ]].http.middlewares.[[ .diagrams.instance ]]-headers[[ .consul.suffix ]].headers.contentsecuritypolicy=[[ range $k, $v := $c.traefik.csp ]][[ $k ]] [[ $v ]];[[ end ]]", + "[[ $c.traefik.instance ]].http.middlewares.[[ .instance ]]-headers[[ .consul.suffix ]].headers.contentsecuritypolicy=[[ range $k, $v := $c.traefik.csp ]][[ $k ]] [[ $v ]];[[ end ]]", [[- if not (regexp.Match "^/?$" (urlParse $c.public_url).Path) ]] # Diagrams exposed by traefik on a subpath. Define a middleware to strip the prefix before passing the request to the backend - "[[ $c.traefik.instance ]].http.middlewares.[[ .diagrams.instance ]]-prefix[[ .consul.suffix ]].stripprefix.prefixes=[[ (urlParse .diagrams.public_url).Path ]]", + "[[ $c.traefik.instance ]].http.middlewares.[[ .instance ]]-prefix[[ .consul.suffix ]].stripprefix.prefixes=[[ (urlParse .diagrams.public_url).Path ]]", [[- end ]] # Main app router - "[[ $c.traefik.instance ]].http.routers.[[ .diagrams.instance ]][[ .consul.suffix ]].rule=Host(`[[ (urlParse $c.public_url).Hostname ]]`) + "[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].rule=Host(`[[ (urlParse $c.public_url).Hostname ]]`) [[- if not (regexp.Match "^/?$" (urlParse $c.public_url).Path) ]] && PathPrefix(`[[ (urlParse $c.public_url).Path ]]`)[[ end ]]", - "[[ $c.traefik.instance ]].http.routers.[[ .diagrams.instance ]][[ .consul.suffix ]].entrypoints=[[ join $c.traefik.entrypoints "," ]]", + "[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].entrypoints=[[ join $c.traefik.entrypoints "," ]]", [[- if not (regexp.Match "^/?$" (urlParse $c.public_url).Path) ]] - "[[ $c.traefik.instance ]].http.routers.[[ .diagrams.instance ]][[ .consul.suffix ]].middlewares=[[ .diagrams.instance ]]-prefix[[ $c.consul.suffix ]],[[ .diagrams.instance ]]-headers[[ .consul.suffix ]],[[ template "common/traefik_middlewares.tpl" $c.traefik ]]", + "[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ .instance ]]-prefix[[ $c.consul.suffix ]],[[ .instance ]]-headers[[ .consul.suffix ]],[[ template "common/traefik_middlewares.tpl" $c.traefik ]]", [[- else ]] - "[[ $c.traefik.instance ]].http.routers.[[ .diagrams.instance ]][[ .consul.suffix ]].middlewares=[[ .diagrams.instance ]]-headers[[ .consul.suffix ]],[[ template "common/traefik_middlewares.tpl" $c.traefik ]]", + "[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ .instance ]]-headers[[ .consul.suffix ]],[[ template "common/traefik_middlewares.tpl" $c.traefik ]]", [[- end ]] ] } diff --git a/images/diagrams/Dockerfile b/images/diagrams/Dockerfile index d29e72f..39f30e2 100644 --- a/images/diagrams/Dockerfile +++ b/images/diagrams/Dockerfile @@ -1,8 +1,8 @@ FROM [[ .docker.repo ]][[ .docker.base_images.java17.image ]] MAINTAINER [[ .docker.maintainer ]] -ARG TOMCAT_VERSION=9.0.83 \ - DIAGRAMS_VERSION=22.1.7 +ARG TOMCAT_VERSION=9.0.84 \ + DIAGRAMS_VERSION=22.1.11 ENV CATALINA_HOME=/opt/tomcat \ TOMCAT_PORT=8282 \ diff --git a/prep.d/10-mv-conf.sh b/prep.d/10-mv-conf.sh index 50c339d..f93f765 100755 --- a/prep.d/10-mv-conf.sh +++ b/prep.d/10-mv-conf.sh @@ -1 +1 @@ -[[ template "common/mv_conf.sh.tpl" dict "ctx" . "services" (dict "diagrams" .diagrams.instance) ]] +[[ template "common/mv_conf.sh.tpl" dict "ctx" . "services" (dict "diagrams" .instance) ]] diff --git a/variables.yml b/variables.yml index c211b85..f930546 100644 --- a/variables.yml +++ b/variables.yml @@ -1,8 +1,8 @@ --- +instance: diagrams diagrams: - instance: diagrams - image: danielberteaud/diagrams:22.1.7-1 + image: '[[ .docker.repo ]]diagrams:22.1.11-1' env: {} public_url: https://draw.example.org traefik: