Skip to content

Commit

Permalink
fix: reset metabase only when opencrvs version changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jamil314 committed Nov 6, 2024
1 parent 0c37040 commit 3db7810
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion infrastructure/deployment/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set -e
BASEDIR=$(dirname $(realpath $0))
INFRASTRUCTURE_DIRECTORY=$(dirname $BASEDIR)
PROJECT_ROOT=$(pwd)
PREVIOUS_VERSION='v1.5.0'

while [ "$PROJECT_ROOT" != "/" ]; do
if [ -f "$PROJECT_ROOT/package.json" ]; then
Expand Down Expand Up @@ -299,6 +300,11 @@ docker_stack_deploy() {
docker stack deploy --prune -c '$(split_and_join " " " -c " "$(to_remote_paths $COMPOSE_FILES_USED)")' --with-registry-auth opencrvs'
}

get_docker_version() {
echo "Getting previous docker version"
PREVIOUS_VERSION=$(configured_ssh "docker service ls | grep opencrvs_base | awk -F ':' '{print $NF}'")
}

reset_metabase() {
echo "Reseting metabase"
configured_ssh "ls /data/metabase/ && \
Expand Down Expand Up @@ -422,7 +428,13 @@ EMAIL_PAYLOAD='{
"to": "{{ALERT_EMAIL}}"
}'

reset_metabase
get_docker_version

if [[ "$VERSION" == "$PREVIOUS_VERSION" ]]; then
echo "No reset needed for Metabase."
else
reset_metabase
fi

configured_ssh "docker run --rm --network=opencrvs_overlay_net appropriate/curl \
-X POST 'http://countryconfig:3040/email' \
Expand Down

0 comments on commit 3db7810

Please sign in to comment.