Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.1.0 #552

Open
wants to merge 65 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
1a26250
poc: Use approval app as plugin
tokland Jun 12, 2024
10ccd8a
Use plugin.html with query strings
tokland Jul 10, 2024
757d1f3
Use @dhis2/app-runtime plugin
tokland Jul 10, 2024
9d6cf26
add ability to clone projects
eperedo Aug 20, 2024
8dd9827
Use full-switch for branches over action type
tokland Aug 28, 2024
223e607
Update deploy
tokland Aug 29, 2024
aaa87ff
Update deploy to version changes
tokland Sep 27, 2024
39c5216
Use data approval as plugin + pass info with query strings
tokland Oct 10, 2024
5c66140
Set width to 1000
tokland Oct 10, 2024
8928512
Merge pull request #541 from EyeSeeTea/poc/use-data-approval-as-plugin
adrianq Oct 10, 2024
83be733
Merge pull request #546 from EyeSeeTea/feature/update-deploy
adrianq Oct 10, 2024
03b535f
Merge remote-tracking branch 'origin/development' into feature/clone-…
tokland Oct 10, 2024
af86d71
fix lint warning
tokland Oct 10, 2024
6d4aa37
Refactor deploy for dev/training
tokland Oct 14, 2024
b6caa4d
fix incorrect summary for documents
eperedo Oct 15, 2024
567abaf
Merge branch 'feature/clone-projects' of https://github.com/EyeSeeTea…
eperedo Oct 15, 2024
97b6c8a
Save+Delete periods
eperedo Oct 19, 2024
62ba313
add unique indicators step
eperedo Oct 23, 2024
4838eca
fixed tests
eperedo Oct 23, 2024
5036f56
add project indicators validation
eperedo Oct 26, 2024
b691307
update i18n
eperedo Oct 26, 2024
bf6bdc4
Run analytics in cloning process
tokland Nov 5, 2024
fe92784
Fix linting warning
tokland Nov 5, 2024
120ebde
add country project indicators report
eperedo Nov 6, 2024
8156728
update i18n
eperedo Nov 6, 2024
494e0f0
update i18n
eperedo Nov 6, 2024
74522dc
update i18n
eperedo Nov 6, 2024
49823aa
remove estimation file
eperedo Nov 6, 2024
a04dd4c
add validations for periods + pr observations
eperedo Nov 11, 2024
01e9151
update i18n
eperedo Nov 11, 2024
5a7914c
fixed errors in project indicators validation
eperedo Nov 11, 2024
a783a89
fix errors in country project and indicators
eperedo Nov 12, 2024
80060ef
refactor hook for confirm changes in form
eperedo Nov 12, 2024
f27173f
improvements for periods and indicator report
eperedo Nov 13, 2024
aada02e
validate periods with the same months
eperedo Nov 13, 2024
3a64f2f
update i18n
eperedo Nov 13, 2024
645520e
avoid generate indicators on saving periods
eperedo Nov 14, 2024
325d051
add period information in country report
eperedo Nov 14, 2024
daefb03
Merge pull request #544 from EyeSeeTea/feature/clone-projects
adrianq Nov 15, 2024
08f1668
Merge branch 'development' into feature/support-40-for-dev-training
adrianq Nov 15, 2024
646ce4f
Merge pull request #548 from EyeSeeTea/feature/support-40-for-dev-tra…
adrianq Nov 15, 2024
896d487
Merge pull request #551 from EyeSeeTea/feature/unique-beneficiaries
adrianq Nov 15, 2024
facca49
bump version
adrianq Nov 15, 2024
d6916cf
fix jest tests
Ramon-Jimenez Nov 15, 2024
450dfc4
Add task analyze (use source-map-explorer)
tokland Nov 18, 2024
24ca45a
allow data reviewers to clone projects
eperedo Nov 18, 2024
1d44278
Merge pull request #554 from EyeSeeTea/feature/clone-action-permissions
Ramon-Jimenez Nov 18, 2024
5aee4e6
add year for indicators validation and unique beneficiaries report
eperedo Nov 19, 2024
8a86beb
Move xlsx to devDependencies + useCase to the script
tokland Nov 19, 2024
e17494b
Merge pull request #553 from EyeSeeTea/feature/add-build-deps-analyze
Ramon-Jimenez Nov 19, 2024
b16e212
check year to validate if report is not available
eperedo Nov 19, 2024
47e0009
update i18n
eperedo Nov 19, 2024
5139248
include year in excel filename
eperedo Nov 19, 2024
ed34876
get values for ub report by year and fix period validation
eperedo Nov 20, 2024
fc473dc
update titles in project wizard
eperedo Nov 20, 2024
d3b043d
show warning message for cloning projects
eperedo Nov 20, 2024
3b15692
Merge pull request #555 from EyeSeeTea/feature/unique-beneficiaries-year
Ramon-Jimenez Nov 20, 2024
c2a876f
hide reports in unique beneficiaries report
eperedo Nov 21, 2024
971e4aa
filter reports by year
eperedo Nov 21, 2024
a5e915b
Merge pull request #556 from EyeSeeTea/feature/hide-reports-withoutyear
Ramon-Jimenez Nov 21, 2024
dc01705
show non active projects in UB report
eperedo Dec 11, 2024
fe28205
update i18n
eperedo Dec 11, 2024
28fba06
Merge pull request #558 from EyeSeeTea/fix/ub-include-closedprojects
Ramon-Jimenez Dec 12, 2024
cfcd8f1
order years in unique beneficiaries report
eperedo Dec 12, 2024
2a864eb
Merge pull request #559 from EyeSeeTea/fix/ub-include-closedprojects
Ramon-Jimenez Dec 12, 2024
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
15 changes: 0 additions & 15 deletions deploy/clone-pro-to-test.sh

This file was deleted.

20 changes: 0 additions & 20 deletions deploy/clone-pro-to-training.sh

This file was deleted.

30 changes: 30 additions & 0 deletions deploy/clone-pro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -e -u -o pipefail

# Requirements: vendorlink SSH channel open with spintldhis01, stintldhis01, sdintldhis01.

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

clone() {
setup_training
image_pro=$(run spintldhis01 bash -x push-pro-docker.sh --skip_dump)
run stintldhis01 bash deploy-test-from-pro.sh "$image_pro"
run stintldhis01 bash -x deploy-training-from-pro.sh "$image_pro"
run sdintldhis01 bash -x deploy-dev-from-pro.sh "$image_pro"
}

setup_training() {
local repo_url="https://github.com/eyeseetea/project-monitoring-app"

if test -e "project-monitoring-app"; then
cd "project-monitoring-app"
git fetch
cd ..
else
git clone "$repo_url"
fi

}

clone
49 changes: 49 additions & 0 deletions deploy/deploy-dev-from-pro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
# shellcheck disable=SC2001

set -e -u -o pipefail

cd "$(dirname "$0")"
script_dir=$(pwd)
source "./lib.sh"
source "./tasks.sh"

start_from_pro() {
local url=$1 image_pro=$2
image=$(echo "$image_pro" | sed "s/ip-pro/ip-dev/")

export TMPDIR=/data/tmp

local image_running
image_running=$(d2-docker list | grep RUN | awk '{print $1}' | grep -m1 ip-dev) || true

if test "$image_running"; then
d2-docker commit "$image_running"
docker tag "$image_running" "$image_running-$(timestamp)"
d2-docker stop "$image_running"
fi

d2-docker pull "$image_pro"
docker tag "$image_pro" "$image"
sudo image="$image" /usr/local/bin/start-dhis2-dev

wait_for_dhis2_server "$url"
}

post_clone() {
local url=$1

change_server_name "$url" "SP Platform - DEV"
set_logos "$url" "$script_dir/icons/dev"
set_email_password "$url"
}

main() {
local image_pro=$1
url=$(get_url 80)

start_from_pro "$url" "$image_pro"
post_clone "$url"
}

main "$@"
24 changes: 13 additions & 11 deletions deploy/deploy-test-from-pro.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ script_dir=$(pwd)
source "./lib.sh"
source "./tasks.sh"

image_test="docker.eyeseetea.com/samaritans/dhis2-data:40.4.0-sp-ip-test"

start_from_pro() {
local url=$1
local image_test_running
local url=$1 image_pro=$2
# shellcheck disable=SC2001
image_test=$(echo "$image_pro" | sed "s/ip-pro/ip-test/")

local running_image
running_image=$(d2-docker list | grep RUN | awk '{print $1}' | grep -m1 ip-test) || true

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"
if test "$running_image"; then
d2-docker commit "$running_image"
docker tag "$running_image" "$running_image-$(timestamp)"
d2-docker stop "$running_image"
fi

d2-docker pull "$image_pro"
d2-docker copy "$image_pro" "$image_test"
docker tag "$image_pro" "$image_test"
sudo image=$image_test /usr/local/bin/start-dhis2-test

wait_for_dhis2_server "$url"
Expand All @@ -29,9 +30,10 @@ start_from_pro() {
post_clone() {
local url=$1

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

main() {
Expand Down
100 changes: 100 additions & 0 deletions deploy/deploy-training-from-pro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/bin/bash
set -e -u -o pipefail

cd "$(dirname "$0")"
script_dir=$(pwd)
source "./lib.sh"
source "./tasks.sh"

load_training_projects() {
local url=$1
cd "$script_dir/project-monitoring-app" || return 1
yarn ts-node src/scripts/projects.ts --url="$url" import training-projects.json
}

training_post_clone() {
local url=$1
set_email_password "$url"
enable_users "$url" "traindatareviewer,traindataviewer,traindataentry"
change_server_name "$url" "SP Platform - Training"
add_users_to_maintainer_roles "$url"
set_logos "$url" "$script_dir/icons/training"
run_analytics "$url"
}

get_app_version() {
local url=$1
curl -sS -u "$auth" "$url/api/apps" |
jq '.[] | select(.key == "Data-Management-App").version' -r
}

get_project_monitoring_app_source() {
local url=$1

app_version=$(get_app_version "$url")
cd "$script_dir" || return 1

# Connection to github is flaky from SP servers, clone locally and rsync it (before the script is run)
cd "project-monitoring-app" || return 1

git checkout v"$app_version" -f
yarn install
yarn add [email protected]
yarn localize
}

save_last_training_projects() {
local url=$1
date=$(date --date="60 day ago" "+%Y-%m-%d")
cd "$script_dir/project-monitoring-app" || return 1
yarn ts-node src/scripts/projects.ts --url="$url" --from="$date" export training-projects.json
}

delete_projects() {
local image_training=$1
d2-docker run-sql -i "$image_training" "$script_dir/sql/create-guest-user.sql"
d2-docker run-sql -i "$image_training" "$script_dir/sql/empty_data_tables_228.sql"
d2-docker run-sql -i "$image_training" "$script_dir/sql/delete-projects.sql"
}

start_from_pro() {
local url=$1 image_pro=$2
# shellcheck disable=SC2001
image_training=$(echo "$image_pro" | sed "s/ip-pro/ip-training/")

{
d2-docker pull "$image_pro"
if test 1 = 2; then
current_image=$(d2-docker list | grep RUN | awk '{print $1}' | grep -m1 ip-training) || true

if test "$current_image"; then
d2-docker commit "$current_image"
docker tag "$current_image" "$current_image-$(timestamp)"
d2-docker stop "$current_image"
fi

docker tag "$image_pro" "$image_training"
sudo image="$image_training" /usr/local/bin/start-dhis2-training
wait_for_dhis2_server "$url"
fi
} >&2

echo "$image_training"
}

main() {
local image_pro=$1
url=$(get_url 81)

if curl -s "$url"; then
get_project_monitoring_app_source "$url"
save_last_training_projects "$url"
fi

image_training=$(start_from_pro "$url" "$image_pro")
delete_projects "$image_training"
load_training_projects "$url"
training_post_clone "$url"
}

main "$@"
Binary file added deploy/icons/dev/logo_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added deploy/icons/dev/logo_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added deploy/icons/training/logo_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added deploy/icons/training/logo_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 2 additions & 6 deletions deploy/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,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_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"

debug() {
echo "$@" >&2
}
Expand All @@ -20,7 +16,7 @@ run() {
local command=$2
shift 2

debug "Copy deploy folder"
debug "Copy deploy folder to $host"
rsync -a . "$host":deploy/
debug "Run: $command $*"
ssh "$host" "cd deploy &&" "$command" "$@"
Expand All @@ -30,7 +26,7 @@ wait_for_dhis2_server() {
local url=$url
local port
port=$(echo "$url" | grep -o ':[[:digit:]]*$' | cut -d: -f2)
echo "Wait for server: port=$port"
debug "Wait for server: port=$port"

while ! curl -sS -f "http://localhost:$port"; do
sleep 10
Expand Down
Loading
Loading