From 60863a5e40204d6d180b0e402dfc3fe23efe2572 Mon Sep 17 00:00:00 2001 From: Julien Georges Date: Tue, 12 Dec 2023 16:19:15 +0100 Subject: [PATCH] Story #12096: Fix service registration when colocalisation with consul server. Consul server is not bind to localhost. --- deployment/environments/hosts-ui.example | 18 +----------------- deployment/environments/hosts.local | 16 ---------------- .../archive-search-external/application.yml.j2 | 1 + .../archive-search-internal/application.yml.j2 | 1 + .../templates/cas-server/application.yml.j2 | 1 + .../collect-external/application.yml.j2 | 1 + .../collect-internal/application.yml.j2 | 1 + .../templates/iam-external/application.yml.j2 | 1 + .../templates/iam-internal/application.yml.j2 | 1 + .../ingest-external/application.yml.j2 | 1 + .../ingest-internal/application.yml.j2 | 1 + .../pastis-external/application.yml.j2 | 1 + .../referential-external/application.yml.j2 | 1 + .../referential-internal/application.yml.j2 | 1 + .../security-internal/application.yml.j2 | 1 + .../ui-archive-search/application.yml.j2 | 1 + .../templates/ui-collect/application.yml.j2 | 1 + .../ui-identity-admin/application.yml.j2 | 1 + .../templates/ui-identity/application.yml.j2 | 1 + .../templates/ui-ingest/application.yml.j2 | 1 + .../templates/ui-pastis/application.yml.j2 | 1 + .../templates/ui-portal/application.yml.j2 | 1 + .../ui-referential/application.yml.j2 | 2 ++ 23 files changed, 23 insertions(+), 33 deletions(-) diff --git a/deployment/environments/hosts-ui.example b/deployment/environments/hosts-ui.example index 070942611d7..a5a222141f8 100644 --- a/deployment/environments/hosts-ui.example +++ b/deployment/environments/hosts-ui.example @@ -185,10 +185,6 @@ hosts_vitamui_consul_server ################################################################################ [vitam:children] hosts_consul_server -hosts_ingest_external -hosts_access_external -hosts_functionnal_admin -hosts_security_internal hosts_elasticsearch_log # MINIMUM REQUIRED IN ZONE VITAM @@ -196,20 +192,8 @@ hosts_elasticsearch_log # EDIT: Mandatory unless [hosts_vitamui_consul_server] is defined # Choose between [hosts_consul_server] and [hosts_vitamui_consul_server]. If both defined [hosts_vitamui_consul_server] will be used by default. -[hosts_ingest_external] -# EDIT: Mandatory - -[hosts_access_external] -# EDIT: Mandatory - -[hosts_functionnal_admin] -# EDIT: Mandatory - -[hosts_security_internal] -# EDIT: Mandatory - [hosts_elasticsearch_log] -# EDIT: Mandatory +# EDIT: Mandatory when [hosts_vitamui_logstash] is defined ################################################################################ diff --git a/deployment/environments/hosts.local b/deployment/environments/hosts.local index 7a77ada32e9..7a8aa67eefe 100644 --- a/deployment/environments/hosts.local +++ b/deployment/environments/hosts.local @@ -206,31 +206,15 @@ hosts_vitamui_consul_server ################################################################################ [vitam:children] hosts_consul_server -hosts_ingest_external -hosts_access_external hosts_elasticsearch_log -hosts_functionnal_admin -hosts_security_internal # MINIMUM REQUIRED IN ZONE VITAM [hosts_consul_server] localhost -[hosts_ingest_external] -localhost - -[hosts_access_external] -localhost - [hosts_elasticsearch_log] localhost -[hosts_functionnal_admin] -localhost - -[hosts_security_internal] -localhost - ################################################################################ # ZONE TOOLS ################################################################################ diff --git a/deployment/roles/vitamui/templates/archive-search-external/application.yml.j2 b/deployment/roles/vitamui/templates/archive-search-external/application.yml.j2 index 8bc3c8c94af..2aa2067708d 100644 --- a/deployment/roles/vitamui/templates/archive-search-external/application.yml.j2 +++ b/deployment/roles/vitamui/templates/archive-search-external/application.yml.j2 @@ -3,6 +3,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/archive-search-internal/application.yml.j2 b/deployment/roles/vitamui/templates/archive-search-internal/application.yml.j2 index a944d9d9f37..bda3b3b3a56 100644 --- a/deployment/roles/vitamui/templates/archive-search-internal/application.yml.j2 +++ b/deployment/roles/vitamui/templates/archive-search-internal/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/cas-server/application.yml.j2 b/deployment/roles/vitamui/templates/cas-server/application.yml.j2 index 2ea7d9de0f8..f015a960bcc 100644 --- a/deployment/roles/vitamui/templates/cas-server/application.yml.j2 +++ b/deployment/roles/vitamui/templates/cas-server/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/collect-external/application.yml.j2 b/deployment/roles/vitamui/templates/collect-external/application.yml.j2 index b98f35dc001..f18fce44b3f 100644 --- a/deployment/roles/vitamui/templates/collect-external/application.yml.j2 +++ b/deployment/roles/vitamui/templates/collect-external/application.yml.j2 @@ -3,6 +3,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/collect-internal/application.yml.j2 b/deployment/roles/vitamui/templates/collect-internal/application.yml.j2 index c6279f727fe..ff571acdcae 100644 --- a/deployment/roles/vitamui/templates/collect-internal/application.yml.j2 +++ b/deployment/roles/vitamui/templates/collect-internal/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/iam-external/application.yml.j2 b/deployment/roles/vitamui/templates/iam-external/application.yml.j2 index acd7c3c7bce..c957bc065d5 100644 --- a/deployment/roles/vitamui/templates/iam-external/application.yml.j2 +++ b/deployment/roles/vitamui/templates/iam-external/application.yml.j2 @@ -3,6 +3,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/iam-internal/application.yml.j2 b/deployment/roles/vitamui/templates/iam-internal/application.yml.j2 index 68a57280685..b9010e38e3b 100644 --- a/deployment/roles/vitamui/templates/iam-internal/application.yml.j2 +++ b/deployment/roles/vitamui/templates/iam-internal/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/ingest-external/application.yml.j2 b/deployment/roles/vitamui/templates/ingest-external/application.yml.j2 index 908c7bb1ebf..4ea3b7920cb 100644 --- a/deployment/roles/vitamui/templates/ingest-external/application.yml.j2 +++ b/deployment/roles/vitamui/templates/ingest-external/application.yml.j2 @@ -3,6 +3,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/ingest-internal/application.yml.j2 b/deployment/roles/vitamui/templates/ingest-internal/application.yml.j2 index a4639fb3833..12c27f1b41a 100644 --- a/deployment/roles/vitamui/templates/ingest-internal/application.yml.j2 +++ b/deployment/roles/vitamui/templates/ingest-internal/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/pastis-external/application.yml.j2 b/deployment/roles/vitamui/templates/pastis-external/application.yml.j2 index 40b0c71f5d2..58457875de2 100644 --- a/deployment/roles/vitamui/templates/pastis-external/application.yml.j2 +++ b/deployment/roles/vitamui/templates/pastis-external/application.yml.j2 @@ -16,6 +16,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/referential-external/application.yml.j2 b/deployment/roles/vitamui/templates/referential-external/application.yml.j2 index 38c4e7452f4..b24cac407ff 100644 --- a/deployment/roles/vitamui/templates/referential-external/application.yml.j2 +++ b/deployment/roles/vitamui/templates/referential-external/application.yml.j2 @@ -3,6 +3,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/referential-internal/application.yml.j2 b/deployment/roles/vitamui/templates/referential-internal/application.yml.j2 index 15796579083..6f915fbccf8 100644 --- a/deployment/roles/vitamui/templates/referential-internal/application.yml.j2 +++ b/deployment/roles/vitamui/templates/referential-internal/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/security-internal/application.yml.j2 b/deployment/roles/vitamui/templates/security-internal/application.yml.j2 index 4ef648f037a..ecd47ed898c 100644 --- a/deployment/roles/vitamui/templates/security-internal/application.yml.j2 +++ b/deployment/roles/vitamui/templates/security-internal/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/ui-archive-search/application.yml.j2 b/deployment/roles/vitamui/templates/ui-archive-search/application.yml.j2 index d824f13b0c9..7813d926397 100644 --- a/deployment/roles/vitamui/templates/ui-archive-search/application.yml.j2 +++ b/deployment/roles/vitamui/templates/ui-archive-search/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/ui-collect/application.yml.j2 b/deployment/roles/vitamui/templates/ui-collect/application.yml.j2 index 2515c3ed6d1..bec88cbd612 100644 --- a/deployment/roles/vitamui/templates/ui-collect/application.yml.j2 +++ b/deployment/roles/vitamui/templates/ui-collect/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/ui-identity-admin/application.yml.j2 b/deployment/roles/vitamui/templates/ui-identity-admin/application.yml.j2 index 1fe3fe19753..6185db24c7d 100644 --- a/deployment/roles/vitamui/templates/ui-identity-admin/application.yml.j2 +++ b/deployment/roles/vitamui/templates/ui-identity-admin/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/ui-identity/application.yml.j2 b/deployment/roles/vitamui/templates/ui-identity/application.yml.j2 index be28b60c4cf..565f5d96497 100644 --- a/deployment/roles/vitamui/templates/ui-identity/application.yml.j2 +++ b/deployment/roles/vitamui/templates/ui-identity/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/ui-ingest/application.yml.j2 b/deployment/roles/vitamui/templates/ui-ingest/application.yml.j2 index 35d33a22c9b..90d61f2b491 100644 --- a/deployment/roles/vitamui/templates/ui-ingest/application.yml.j2 +++ b/deployment/roles/vitamui/templates/ui-ingest/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/ui-pastis/application.yml.j2 b/deployment/roles/vitamui/templates/ui-pastis/application.yml.j2 index 261954eac03..f8860f44c5b 100644 --- a/deployment/roles/vitamui/templates/ui-pastis/application.yml.j2 +++ b/deployment/roles/vitamui/templates/ui-pastis/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/ui-portal/application.yml.j2 b/deployment/roles/vitamui/templates/ui-portal/application.yml.j2 index 7f172d70300..80ae844533d 100644 --- a/deployment/roles/vitamui/templates/ui-portal/application.yml.j2 +++ b/deployment/roles/vitamui/templates/ui-portal/application.yml.j2 @@ -2,6 +2,7 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} diff --git a/deployment/roles/vitamui/templates/ui-referential/application.yml.j2 b/deployment/roles/vitamui/templates/ui-referential/application.yml.j2 index e02ef19057d..6cef8f9735f 100644 --- a/deployment/roles/vitamui/templates/ui-referential/application.yml.j2 +++ b/deployment/roles/vitamui/templates/ui-referential/application.yml.j2 @@ -2,10 +2,12 @@ spring: cloud: consul: enabled: true + host: {{ hostvars[inventory_hostname][consul.network] if (inventory_hostname in groups['hosts_vitamui_consul_server'] or inventory_hostname in groups['hosts_consul_server']) else 'localhost' }} discovery: preferIpAddress: true tags: {{ consul_tags }} instanceId: {{ vitamui_struct.vitamui_component }}-${server.port}-${spring.cloud.client.hostname} + deregister: false servlet: multipart: max-file-size: -1