You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by dg...@apache.org on 2021/06/11 12:06:58 UTC

[unomi] branch unomi-1.5.x updated: [UNOMI-479] Docker: Checks if there is auth needed for ES and adds credentials to url in entrypoint.sh. (#304)

This is an automated email from the ASF dual-hosted git repository.

dgriffon pushed a commit to branch unomi-1.5.x
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/unomi-1.5.x by this push:
     new 31480d9  [UNOMI-479] Docker: Checks if there is auth needed for ES and adds credentials to url in entrypoint.sh. (#304)
31480d9 is described below

commit 31480d9a32d4c4e7f43d507cdd47ab9e66b16413
Author: atompie <ri...@gmail.com>
AuthorDate: Fri Jun 11 11:43:16 2021 +0200

    [UNOMI-479] Docker: Checks if there is auth needed for ES and adds credentials to url in entrypoint.sh. (#304)
    
    Co-authored-by: risto <ri...@gmail.com>
---
 docker/src/main/docker/entrypoint.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/docker/src/main/docker/entrypoint.sh b/docker/src/main/docker/entrypoint.sh
index 80f5ee0..8ffbadd 100755
--- a/docker/src/main/docker/entrypoint.sh
+++ b/docker/src/main/docker/entrypoint.sh
@@ -18,10 +18,17 @@
 ################################################################################
 # Wait for heathy ElasticSearch
 # next wait for ES status to turn to Green
-health_check="$(curl -fsSL "$UNOMI_ELASTICSEARCH_ADDRESSES/_cat/health?h=status")"
+
+if [ -v UNOMI_ELASTICSEARCH_USERNAME ] && [ -v UNOMI_ELASTICSEARCH_PASSWORD ]; then
+  elasticsearch_addresses="$UNOMI_ELASTICSEARCH_USERNAME:$UNOMI_ELASTICSEARCH_PASSWORD@$UNOMI_ELASTICSEARCH_ADDRESSES/_cat/health?h=status"
+else
+  elasticsearch_addresses="$UNOMI_ELASTICSEARCH_ADDRESSES/_cat/health?h=status"
+fi
+
+health_check="$(curl -fsSL "$elasticsearch_addresses")"
 
 until ([ "$health_check" = 'yellow' ] || [ "$health_check" = 'green' ]); do
-    health_check="$(curl -fsSL "$UNOMI_ELASTICSEARCH_ADDRESSES/_cat/health?h=status")"
+    health_check="$(curl -fsSL $elasticsearch_addresses)"
     >&2 echo "Elastic Search is not yet available - waiting (health check=$health_check)..."
     sleep 1
 done