Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions deploy/deploy_protocol_gw.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,27 @@ func (d *DeployScriptGenerator) GetBaseProtocolGWDeployScript() string {
export WEKA_PASSWORD="$(echo $fetch_result | jq -r .password)"
set -x

function retry_command {
retry_max=60
retry_sleep=30
count=$retry_max
command=$1
msg=$2

while [ $count -gt 0 ]; do
$command && break
count=$(($count - 1))
echo "Retrying $msg in $retry_sleep seconds..."
sleep $retry_sleep
done
[ $count -eq 0 ] && {
echo "$msg failed after $retry_max attempts"
echo "$(date -u):$msg failed"
return 1
}
return 0
}

weka local stop
weka local rm default --force

Expand Down Expand Up @@ -103,8 +124,9 @@ func (d *DeployScriptGenerator) GetBaseProtocolGWDeployScript() string {
join_ips=$LOAD_BALANCER_IP
fi

weka local setup container --name frontend0 --base-port 14000 --cores $FRONTEND_CONTAINER_CORES_NUM --frontend-dedicated-cores $FRONTEND_CONTAINER_CORES_NUM --allow-protocols true --core-ids $frontend_core_ids $net --dedicate --join-ips $join_ips

setup_frontend_cmd="weka local setup container --name frontend0 --base-port 14000 --cores $FRONTEND_CONTAINER_CORES_NUM --frontend-dedicated-cores $FRONTEND_CONTAINER_CORES_NUM --allow-protocols true --core-ids $frontend_core_ids $net --dedicate --join-ips $join_ips"
retry_command "$setup_frontend_cmd" "weka frontend setup"

echo "$(date -u): success to run weka frontend container"

ready_containers=0
Expand All @@ -120,7 +142,9 @@ func (d *DeployScriptGenerator) GetBaseProtocolGWDeployScript() string {
protect "{\"vm\": \"$VM\", \"protocol\": \"$PROTOCOL\"}"
set +x
echo "$(date -u): try to run weka login command"
weka user login $WEKA_USERNAME $WEKA_PASSWORD

retry_command "weka user login $WEKA_USERNAME $WEKA_PASSWORD" "weka login"

echo "$(date -u): success to run weka login command"
set -x
weka local ps
Expand Down