From 68b8bc9f34dfffd123eae745bfc919bb6edb8cd2 Mon Sep 17 00:00:00 2001
From: ipatini <ipatini@mail.ntua.gr>
Date: Thu, 9 May 2024 13:10:58 +0300
Subject: [PATCH] RD: Updated wait_for_mongodb.sh script and commented out
 liveness and readiness checks

Change-Id: I989b153f1c3df8016b838488672b30e062ef2656
---
 .../templates/deployment.yaml                    | 16 ++++++++--------
 resource-discovery/wait_for_mongodb.sh           |  6 +++---
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/charts/nebulous-resource-manager/templates/deployment.yaml b/charts/nebulous-resource-manager/templates/deployment.yaml
index fc1d651..2e15628 100644
--- a/charts/nebulous-resource-manager/templates/deployment.yaml
+++ b/charts/nebulous-resource-manager/templates/deployment.yaml
@@ -42,14 +42,14 @@ spec:
             - name: http
               containerPort: 8080
               protocol: TCP
-          livenessProbe:
-            httpGet:
-              path: /
-              port: http
-          readinessProbe:
-            httpGet:
-              path: /
-              port: http
+#          livenessProbe:
+#            httpGet:
+#              path: /
+#              port: http
+#          readinessProbe:
+#            httpGet:
+#              path: /
+#              port: http
           resources:
             {{- toYaml .Values.resources | nindent 12 }}
         - name: {{ .Chart.Name }}-mongodb
diff --git a/resource-discovery/wait_for_mongodb.sh b/resource-discovery/wait_for_mongodb.sh
index 400ef54..f61f994 100644
--- a/resource-discovery/wait_for_mongodb.sh
+++ b/resource-discovery/wait_for_mongodb.sh
@@ -1,12 +1,12 @@
 #!/bin/bash
 
 # Define MongoDB connection details
-MONGODB_HOST="localhost"
-MONGODB_PORT="27017"
+if [ -z "$MONGODB_HOST" ]; then MONGODB_HOST="localhost"; fi
+if [ -z "$MONGODB_PORT" ]; then MONGODB_PORT="27017"; fi
 
 # Function to check if MongoDB is ready
 wait_for_mongodb() {
-    echo "Waiting for MongoDB to be ready..."
+    echo "Waiting for MongoDB ($MONGODB_HOST:$MONGODB_PORT) to be ready..."
     until nc -z $MONGODB_HOST $MONGODB_PORT
     do
         sleep 1