You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: os-sso72/added/openshift-launch.sh
+31Lines changed: 31 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,40 @@ function clean_shutdown() {
11
11
wait$!
12
12
}
13
13
14
+
# CLOUD-2453 Connect-retry loop to wait for the service to become reachable over network
15
+
functionwait_for_service() {
16
+
local -r curl_conn_refused_exit_code="7"
17
+
if [ -n"${SERVICE_WAIT_NAME}" ];then
18
+
local -r connect_retry_message="${SERVICE_WAIT_MESSAGE:-"Waiting for the \"${SERVICE_WAIT_NAME}\" service to become available ..."}"
19
+
local service="${SERVICE_WAIT_NAME/-/_}"
20
+
local -r service_host="${service^^}_SERVICE_HOST"
21
+
local -r service_port="${service^^}_SERVICE_PORT"
22
+
if [ -n"${SERVICE_WAIT_RETRY_PERIOD_SECONDS}" ] && [[ !"${SERVICE_WAIT_RETRY_PERIOD_SECONDS}"=~'^[0-9]+\.?[0-9]*$' ]];then
23
+
log_warning "Value of SERVICE_WAIT_RETRY_PERIOD_SECONDS variable can be only arbitrary floating point number. Ignoring \"${SERVICE_WAIT_RETRY_PERIOD_SECONDS}\" setting, defaulting to 10 seconds."
24
+
unset SERVICE_WAIT_RETRY_PERIOD_SECONDS
25
+
fi
26
+
if [ -z"${!service_host}"-o-z"${!service_port}" ];then
27
+
log_warning "Unable to determine target host or port of the \"${SERVICE_WAIT_NAME}\" service. The RH-SSO pod will start without waiting the \"${SERVICE_WAIT_NAME}\" service to be reachable over network. Please make sure you specified correct service name in SERVICE_WAIT_NAME"
28
+
else
29
+
until ( echo> /dev/tcp/"${!service_host}"/"${!service_port}" ) &> /dev/null;do
30
+
if [ -n"${SERVICE_WAIT_CLAIM_MESSAGE}" ];then
31
+
log_warning "${SERVICE_WAIT_CLAIM_MESSAGE}"
32
+
unset SERVICE_WAIT_CLAIM_MESSAGE
33
+
fi
34
+
log_info "${connect_retry_message}"
35
+
sleep "${SERVICE_WAIT_RETRY_PERIOD_SECONDS:-10}s"
36
+
done
37
+
fi
38
+
fi
39
+
}
40
+
14
41
functionrunServer() {
15
42
local instanceDir=$1
16
43
local count=$2
17
44
export NODE_NAME="${NODE_NAME:-node}-${count}"
18
45
46
+
wait_for_service
47
+
19
48
source$JBOSS_HOME/bin/launch/configure.sh
20
49
21
50
log_info "Running $JBOSS_IMAGE_NAME image, version $JBOSS_IMAGE_VERSION"
@@ -47,6 +76,8 @@ if [ "${SPLIT_DATA^^}" = "TRUE" ]; then
0 commit comments