Skip to content

Commit

Permalink
Update deploy test script to 2.40.4
Browse files Browse the repository at this point in the history
  • Loading branch information
tokland committed Jul 3, 2024
1 parent e0d8ae6 commit 01a44ae
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
10 changes: 5 additions & 5 deletions deploy/clone-pro-to-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ set -e -u -o pipefail

# Actions:
#
# - Clone instance in proj-dhis-prod to localhost.
# - Setup of the local docker
# - In PRO: Create docker image and push to Harbor.
# - In TEST: Pull docker from Harbor and start.

# Requirements: Open vendorlink (ip-pro + ip-tst) before running the script:
# Requirements: Open vendorlink (spintldhis01, stintldhis01)

cd "$(dirname "$0")"
source "./lib.sh"

#run boone-ip-pro bash push-pro-docker.sh
run boone-ip-test bash deploy-test-from-pro.sh
run spintldhis01 bash push-pro-docker.sh
run stintldhis01 bash deploy-test-from-pro.sh
34 changes: 22 additions & 12 deletions deploy/deploy-test-from-pro.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,39 @@ script_dir=$(pwd)
source "./lib.sh"
source "./tasks.sh"

post_clone() {
local url=$1
set_email_password "$url"
change_server_name "$url" "SP Platform - Test"
set_logos "$url" "$script_dir/test-icons"
}
image_test="docker.eyeseetea.com/samaritans/dhis2-data:40.4.0-sp-ip-test"

start_from_pro() {
local url=$1
local image_test_running

image_test_running=$(d2-docker list | grep RUN | awk '{print $1}' | grep -m1 ip-test) || true
if test "$image_test_running"; then
d2-docker commit "$image_test_running"
d2-docker copy "$image_test_running" "backup/sp-ip-test-$(timestamp)"
d2-docker stop "$image_test_running"
fi

d2-docker pull "$image_pro"
d2-docker commit "$image_test"
d2-docker copy "$image_test" "backup/sp-ip-test-$(timestamp)"
d2-docker stop "$image_test"
d2-docker copy "$image_pro" "$image_test"

sudo /usr/local/bin/start-dhis2-test
sudo image=$image_test /usr/local/bin/start-dhis2-test

wait_for_dhis2_server "$url"
}

post_clone() {
local url=$1

#set_email_password "$url"
change_server_name "$url" "SP Platform - Test"
set_logos "$url" "$script_dir/test-icons"
}

main() {
local url
url=$(get_url 80)
start_from_pro

start_from_pro "$url"
post_clone "$url"
}

Expand Down
3 changes: 2 additions & 1 deletion deploy/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ script_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]:-$0}")")"
source "$script_dir/auth.sh"

export image_pro="docker.eyeseetea.com/eyeseetea/dhis2-data:2.36.11.1-sp-ip-pro"
export image_test="docker.eyeseetea.com/samaritans/dhis2-data:2.36.11.1-sp-ip-test"
export image_dev="docker.eyeseetea.com/samaritans/dhis2-data:2.36.11.1-sp-ip-dev"
export image_training="docker.eyeseetea.com/samaritans/dhis2-data:2.36.11.1-sp-ip-training"

Expand Down Expand Up @@ -59,13 +58,15 @@ get_user_role_ids() {

change_server_name() {
local url=$1 title=$2

debug "Change server name: $title"
curl -sS -X POST "$url/api/systemSettings/applicationTitle" \
-d "$title" -H "Content-Type: application/json"
}

join_by() {
local IFS="$1"

shift
echo "$*"
}

0 comments on commit 01a44ae

Please sign in to comment.