From f51defd6cd32d8d9dbe7d2deca402661bc810a43 Mon Sep 17 00:00:00 2001 From: euanmillar Date: Wed, 4 Dec 2024 17:17:51 +0000 Subject: [PATCH 1/2] Set node options and initialise elastic index in setup script --- setup.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/setup.sh b/setup.sh index 13cb5807039..d8297ca530f 100755 --- a/setup.sh +++ b/setup.sh @@ -154,6 +154,7 @@ elif [ "$(uname)" == "Darwin" ]; then echo -e "\033[32m::::::::::::::::::::::::: You are running Mac OSX. :::::::::::::::::::::::::\033[0m" echo OS="MAC" + export NODE_OPTIONS="--dns-result-order=ipv4first" else echo "Sorry your operating system is not supported." echo "YOU MUST BE RUNNING A SUPPORTED OS: MAC or UBUNTU > 18.04" @@ -367,6 +368,28 @@ fi DOCKER_STARTED=1 echo "wait-on tcp:3447" && wait-on -l tcp:3447 echo "wait-on http://localhost:9200" && wait-on -l http://localhost:9200 +function create_elastic_index { + local body=$1 + local index_name=$2 + + local -i result=1 + local output + + output=$(curl -s -D- -m15 -w "%{http_code}" -X PUT "http://localhost:9200/$index_name" -H 'Content-Type: application/json' -d "$body") + + echo "${output}" + + if [[ "${output: -3}" -eq 200 ]]; then + result=0 + fi + + if ((result)); then + echo -e "\n${output::-3}\n" + fi + + return $result +} +create_elastic_index "{\"settings\":{\"number_of_replicas\":0}}" "ocrvs" echo "wait-on tcp:9200" && wait-on -l tcp:9200 echo "wait-on tcp:27017" && wait-on -l tcp:27017 echo "wait-on tcp:6379" && wait-on -l tcp:6379 @@ -379,6 +402,9 @@ set -- $(stty size) #$1=rows, $2=columns #start a new session in dettached mode with resizable panes tmux new-session -s opencrvs -n opencrvs -d -x "$2" -y "$(($1 - 1))" TMUX_STARTED=1 +if [ "$(uname)" == "Darwin" ]; then + tmux set-environment NODE_OPTIONS "--dns-result-order=ipv4first" +fi tmux set -p @mytitle "opencrvs-core-working" tmux send-keys -t opencrvs "bash development-environment/summary.sh" C-m tmux split-window -h -l '30%' From 020b2c03613fb38bbcadb2dddd0d534239586309 Mon Sep 17 00:00:00 2001 From: euanmillar Date: Wed, 4 Dec 2024 17:24:40 +0000 Subject: [PATCH 2/2] remove elastic index creation --- setup.sh | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/setup.sh b/setup.sh index d8297ca530f..428f9fc7279 100755 --- a/setup.sh +++ b/setup.sh @@ -368,28 +368,6 @@ fi DOCKER_STARTED=1 echo "wait-on tcp:3447" && wait-on -l tcp:3447 echo "wait-on http://localhost:9200" && wait-on -l http://localhost:9200 -function create_elastic_index { - local body=$1 - local index_name=$2 - - local -i result=1 - local output - - output=$(curl -s -D- -m15 -w "%{http_code}" -X PUT "http://localhost:9200/$index_name" -H 'Content-Type: application/json' -d "$body") - - echo "${output}" - - if [[ "${output: -3}" -eq 200 ]]; then - result=0 - fi - - if ((result)); then - echo -e "\n${output::-3}\n" - fi - - return $result -} -create_elastic_index "{\"settings\":{\"number_of_replicas\":0}}" "ocrvs" echo "wait-on tcp:9200" && wait-on -l tcp:9200 echo "wait-on tcp:27017" && wait-on -l tcp:27017 echo "wait-on tcp:6379" && wait-on -l tcp:6379