From 36f019f606275e53051386af8a882febf15b6afc Mon Sep 17 00:00:00 2001 From: mishaschwartz <4380924+mishaschwartz@users.noreply.github.com> Date: Fri, 9 Feb 2024 12:23:30 -0500 Subject: [PATCH 1/6] add option to unregister weaver providers if they are no longer in the providers list --- birdhouse/components/weaver/default.env | 3 +++ .../components/weaver/post-docker-compose-up | 19 +++++++++++++++++++ birdhouse/env.local.example | 4 ++++ 3 files changed, 26 insertions(+) diff --git a/birdhouse/components/weaver/default.env b/birdhouse/components/weaver/default.env index 9b27a8831..aa7816711 100644 --- a/birdhouse/components/weaver/default.env +++ b/birdhouse/components/weaver/default.env @@ -98,6 +98,9 @@ export WEAVER_WPS_PROVIDERS_RETRY_AFTER=5 export WEAVER_MONGODB_DATA_DIR='${DATA_PERSIST_ROOT}/mongodb_weaver_persist' +# If True, providers that are no longer listed in WEAVER_WPS_PROVIDERS but are still present in the weaver database +# will be unregistered. This is useful when deploying weaver with fewer providers than a previous deployment. +export WEAVER_UNREGISTER_DROPPED_PROVIDERS="False" export DELAYED_EVAL=" $DELAYED_EVAL diff --git a/birdhouse/components/weaver/post-docker-compose-up b/birdhouse/components/weaver/post-docker-compose-up index 10de53a85..0e3ffa23e 100755 --- a/birdhouse/components/weaver/post-docker-compose-up +++ b/birdhouse/components/weaver/post-docker-compose-up @@ -333,6 +333,25 @@ for prov in ${WEAVER_WPS_PROVIDERS}; do done echo "${PREFIX}All Weaver remote WPS providers registered successfully!" +if [ x"${WEAVER_UNREGISTER_DROPPED_PROVIDERS}" = x"True" ]; then + resp=$( \ + curl_cmd --insecure --silent --location \ + -m ${REQUEST_TIMEOUT} \ + -b "${cookie}" \ + "${WEAVER_URL}/providers?check=false&detail=false" \ + ) + for prov in $(echo "$resp" | sed -e 's/.*"providers":\[//' -e 's/\].*//' -e 's/[",]/ /g'); do + if echo "${WEAVER_WPS_PROVIDERS}" | grep -wqv "$prov" ; then + # unregister provider that is no longer specified in WEAVER_WPS_PROVIDERS + echo "${PREFIX}Unregistering the remote WPS provider matching [${prov}] not in WEAVER_WPS_PROVIDERS." + curl_cmd --insecure --silent --location \ + -m ${REQUEST_TIMEOUT} \ + -b "${cookie}" \ + -X DELETE \ + "${WEAVER_URL}/providers/${prov}" + fi + done +fi echo "${PREFIX}Starting Weaver WebApp/Worker Celery tasks validation..." CUR_SCRIPT_DIR="$(dirname "$(realpath "$0")")" diff --git a/birdhouse/env.local.example b/birdhouse/env.local.example index 02b4a5c7f..e17c1b365 100644 --- a/birdhouse/env.local.example +++ b/birdhouse/env.local.example @@ -542,6 +542,10 @@ export THREDDS_ADDITIONAL_CATALOG="" # (note: if using 'DATA_PERSIST_ROOT', it must be defined earlier, either in this file or from 'default.env') #export WEAVER_MONGODB_DATA_DIR='${DATA_PERSIST_ROOT}/mongodb_weaver_persist' +# If "True", providers that are no longer listed in WEAVER_WPS_PROVIDERS but are still present in the weaver database +# will be unregistered. This is useful when deploying weaver with fewer providers than a previous deployment. +#export WEAVER_UNREGISTER_DROPPED_PROVIDERS="True" + # If "True", requests to the geoserver endpoint will not be authorized through twitcher/magpie # (note: this is NOT recommended but will slightly improve performance when accessing geoserver endpoints) #export GEOSERVER_SKIP_AUTH=True From ac6079b0a3a13399991170964602c4d00956db7a Mon Sep 17 00:00:00 2001 From: mishaschwartz <4380924+mishaschwartz@users.noreply.github.com> Date: Fri, 9 Feb 2024 13:33:56 -0500 Subject: [PATCH 2/6] only unregister if not responding --- birdhouse/components/weaver/default.env | 5 +++-- .../components/weaver/post-docker-compose-up | 17 +++++++++++++---- birdhouse/env.local.example | 5 +++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/birdhouse/components/weaver/default.env b/birdhouse/components/weaver/default.env index aa7816711..6dccc8370 100644 --- a/birdhouse/components/weaver/default.env +++ b/birdhouse/components/weaver/default.env @@ -98,8 +98,9 @@ export WEAVER_WPS_PROVIDERS_RETRY_AFTER=5 export WEAVER_MONGODB_DATA_DIR='${DATA_PERSIST_ROOT}/mongodb_weaver_persist' -# If True, providers that are no longer listed in WEAVER_WPS_PROVIDERS but are still present in the weaver database -# will be unregistered. This is useful when deploying weaver with fewer providers than a previous deployment. +# If "True", Weaver providers that are no longer working (not responding when deployed) and are not named in +# WEAVER_WPS_PROVIDERS will be unregistered. This is useful when deploying Weaver with fewer providers than a previous +# deployment. export WEAVER_UNREGISTER_DROPPED_PROVIDERS="False" export DELAYED_EVAL=" diff --git a/birdhouse/components/weaver/post-docker-compose-up b/birdhouse/components/weaver/post-docker-compose-up index 0e3ffa23e..4b79b2893 100755 --- a/birdhouse/components/weaver/post-docker-compose-up +++ b/birdhouse/components/weaver/post-docker-compose-up @@ -334,15 +334,24 @@ done echo "${PREFIX}All Weaver remote WPS providers registered successfully!" if [ x"${WEAVER_UNREGISTER_DROPPED_PROVIDERS}" = x"True" ]; then - resp=$( \ + # Get all registered providers whether they are working or not + all_providers_resp=$( \ curl_cmd --insecure --silent --location \ -m ${REQUEST_TIMEOUT} \ -b "${cookie}" \ "${WEAVER_URL}/providers?check=false&detail=false" \ ) - for prov in $(echo "$resp" | sed -e 's/.*"providers":\[//' -e 's/\].*//' -e 's/[",]/ /g'); do - if echo "${WEAVER_WPS_PROVIDERS}" | grep -wqv "$prov" ; then - # unregister provider that is no longer specified in WEAVER_WPS_PROVIDERS + # Get all registered working providers + working_providers_resp=$( \ + curl_cmd --insecure --silent --location \ + -m ${REQUEST_TIMEOUT} \ + -b "${cookie}" \ + "${WEAVER_URL}/providers?check=true&detail=false" \ + ) + working_providers=$(echo "$working_providers_resp" | sed -e 's/.*"providers":\[//' -e 's/\].*//' -e 's/[",]/ /g') + for prov in $(echo "$all_providers_resp" | sed -e 's/.*"providers":\[//' -e 's/\].*//' -e 's/[",]/ /g'); do + if echo "${WEAVER_WPS_PROVIDERS}" | grep -wqv "$prov" && echo "${working_providers}" | grep -wqv "$prov"; then + # unregister provider that is no longer specified in WEAVER_WPS_PROVIDERS and is no longer working echo "${PREFIX}Unregistering the remote WPS provider matching [${prov}] not in WEAVER_WPS_PROVIDERS." curl_cmd --insecure --silent --location \ -m ${REQUEST_TIMEOUT} \ diff --git a/birdhouse/env.local.example b/birdhouse/env.local.example index e17c1b365..871d9bef7 100644 --- a/birdhouse/env.local.example +++ b/birdhouse/env.local.example @@ -542,8 +542,9 @@ export THREDDS_ADDITIONAL_CATALOG="" # (note: if using 'DATA_PERSIST_ROOT', it must be defined earlier, either in this file or from 'default.env') #export WEAVER_MONGODB_DATA_DIR='${DATA_PERSIST_ROOT}/mongodb_weaver_persist' -# If "True", providers that are no longer listed in WEAVER_WPS_PROVIDERS but are still present in the weaver database -# will be unregistered. This is useful when deploying weaver with fewer providers than a previous deployment. +# If "True", Weaver providers that are no longer working (not responding when deployed) and are not named in +# WEAVER_WPS_PROVIDERS will be unregistered. This is useful when deploying Weaver with fewer providers than a previous +# deployment. #export WEAVER_UNREGISTER_DROPPED_PROVIDERS="True" # If "True", requests to the geoserver endpoint will not be authorized through twitcher/magpie From 79022895ceec1dedbda2bfced494d4c594ab76a9 Mon Sep 17 00:00:00 2001 From: mishaschwartz <4380924+mishaschwartz@users.noreply.github.com> Date: Fri, 9 Feb 2024 13:37:41 -0500 Subject: [PATCH 3/6] update CHANGES.md --- CHANGES.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 9a3670b74..1511fb379 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,7 +15,19 @@ [Unreleased](https://github.com/bird-house/birdhouse-deploy/tree/master) (latest) ------------------------------------------------------------------------------------------------------------------ -[//]: # (list changes here, using '-' for each new entry, remove this when items are added) +## Changes + +- Weaver: add option to automatically unregister old providers + + Introduces the `WEAVER_UNREGISTER_DROPPED_PROVIDERS` variable. If set to "True", Weaver providers that are no longer + working (not responding when deployed) and are not named in `WEAVER_WPS_PROVIDERS` will be unregistered. This is + useful when deploying Weaver with fewer providers than a previous deployment. + + For example, if the stack is deployed with the Weaver, Finch, and Raven components. Then later deployed with jus + Weaver and Raven, the Finch provider will be unregistered from weaver. + + Previously, the Finch provider would have remained as a Weaver provider despite the fact that it has been removed from + the stack. [2.0.5](https://github.com/bird-house/birdhouse-deploy/tree/2.0.5) (2024-01-22) ------------------------------------------------------------------------------------------------------------------ From 44badad81ce476dc344cb746e46ae4cefa83b011 Mon Sep 17 00:00:00 2001 From: mishaschwartz <4380924+mishaschwartz@users.noreply.github.com> Date: Fri, 9 Feb 2024 15:43:27 -0500 Subject: [PATCH 4/6] typo fix --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 1511fb379..bef52ea7f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,7 +23,7 @@ working (not responding when deployed) and are not named in `WEAVER_WPS_PROVIDERS` will be unregistered. This is useful when deploying Weaver with fewer providers than a previous deployment. - For example, if the stack is deployed with the Weaver, Finch, and Raven components. Then later deployed with jus + For example, if the stack is deployed with the Weaver, Finch, and Raven components. Then later deployed with just Weaver and Raven, the Finch provider will be unregistered from weaver. Previously, the Finch provider would have remained as a Weaver provider despite the fact that it has been removed from From 87eb7de283ec0706dc1680db5fa8189c5e7e82ae Mon Sep 17 00:00:00 2001 From: mishaschwartz <4380924+mishaschwartz@users.noreply.github.com> Date: Tue, 13 Feb 2024 10:18:00 -0500 Subject: [PATCH 5/6] deal with providers with ids that span word boundaries --- birdhouse/components/weaver/post-docker-compose-up | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/birdhouse/components/weaver/post-docker-compose-up b/birdhouse/components/weaver/post-docker-compose-up index 4b79b2893..29e90c1d3 100755 --- a/birdhouse/components/weaver/post-docker-compose-up +++ b/birdhouse/components/weaver/post-docker-compose-up @@ -348,9 +348,12 @@ if [ x"${WEAVER_UNREGISTER_DROPPED_PROVIDERS}" = x"True" ]; then -b "${cookie}" \ "${WEAVER_URL}/providers?check=true&detail=false" \ ) - working_providers=$(echo "$working_providers_resp" | sed -e 's/.*"providers":\[//' -e 's/\].*//' -e 's/[",]/ /g') + working_providers=$(echo "$working_providers_resp" | tr '\n' ' ' | \ + sed -e 's/.*"providers":\[//' -e 's/\].*//' -e 's/[",]/ /g') for prov in $(echo "$all_providers_resp" | sed -e 's/.*"providers":\[//' -e 's/\].*//' -e 's/[",]/ /g'); do - if echo "${WEAVER_WPS_PROVIDERS}" | grep -wqv "$prov" && echo "${working_providers}" | grep -wqv "$prov"; then + # Note: both WEAVER_WPS_PROVIDERS and working_providers are whitespace delimited with no newlines + if echo " ${WEAVER_WPS_PROVIDERS} " | grep -qv "[[:space:]]${prov}[[:space:]]" && \ + echo " ${working_providers} " | grep -qv "[[:space:]]${prov}[[:space:]]"; then # unregister provider that is no longer specified in WEAVER_WPS_PROVIDERS and is no longer working echo "${PREFIX}Unregistering the remote WPS provider matching [${prov}] not in WEAVER_WPS_PROVIDERS." curl_cmd --insecure --silent --location \ From 80b7c198f944c94e42a2652e3717db7b14206a66 Mon Sep 17 00:00:00 2001 From: mishaschwartz <4380924+mishaschwartz@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:29:02 -0500 Subject: [PATCH 6/6] =?UTF-8?q?Bump=20version:=202.0.5=20=E2=86=92=202.0.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 6 +++--- CHANGES.md | 5 +++++ Makefile | 2 +- README.rst | 8 ++++---- RELEASE.txt | 2 +- .../canarie-api/docker_configuration.py.template | 8 ++++---- docs/source/conf.py | 4 ++-- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a49355a61..95d6841af 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.0.5 +current_version = 2.0.6 commit = True tag = False tag_name = {new_version} @@ -30,11 +30,11 @@ search = {current_version} replace = {new_version} [bumpversion:file:RELEASE.txt] -search = {current_version} 2024-01-22T04:23:33Z +search = {current_version} 2024-02-15T16:29:01Z replace = {new_version} {utcnow:%Y-%m-%dT%H:%M:%SZ} [bumpversion:part:releaseTime] -values = 2024-01-22T04:23:33Z +values = 2024-02-15T16:29:01Z [bumpversion:file(version):birdhouse/components/canarie-api/docker_configuration.py.template] search = 'version': '{current_version}' diff --git a/CHANGES.md b/CHANGES.md index bef52ea7f..746156b99 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,11 @@ [Unreleased](https://github.com/bird-house/birdhouse-deploy/tree/master) (latest) ------------------------------------------------------------------------------------------------------------------ +[//]: # (list changes here, using '-' for each new entry, remove this when items are added) + +[2.0.6](https://github.com/bird-house/birdhouse-deploy/tree/2.0.6) (2024-02-15) +------------------------------------------------------------------------------------------------------------------ + ## Changes - Weaver: add option to automatically unregister old providers diff --git a/Makefile b/Makefile index 4bf7aa456..c21836bfa 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Generic variables override SHELL := bash override APP_NAME := birdhouse-deploy -override APP_VERSION := 2.0.5 +override APP_VERSION := 2.0.6 # utility to remove comments after value of an option variable override clean_opt = $(shell echo "$(1)" | $(_SED) -r -e "s/[ '$'\t'']+$$//g") diff --git a/README.rst b/README.rst index 2a09feb10..82436e237 100644 --- a/README.rst +++ b/README.rst @@ -14,13 +14,13 @@ for a full-fledged production platform. * - releases - | |latest-version| |commits-since| -.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/2.0.5.svg +.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/2.0.6.svg :alt: Commits since latest release - :target: https://github.com/bird-house/birdhouse-deploy/compare/2.0.5...master + :target: https://github.com/bird-house/birdhouse-deploy/compare/2.0.6...master -.. |latest-version| image:: https://img.shields.io/badge/tag-2.0.5-blue.svg?style=flat +.. |latest-version| image:: https://img.shields.io/badge/tag-2.0.6-blue.svg?style=flat :alt: Latest Tag - :target: https://github.com/bird-house/birdhouse-deploy/tree/2.0.5 + :target: https://github.com/bird-house/birdhouse-deploy/tree/2.0.6 .. |readthedocs| image:: https://readthedocs.org/projects/birdhouse-deploy/badge/?version=latest :alt: ReadTheDocs Build Status (latest version) diff --git a/RELEASE.txt b/RELEASE.txt index 7f4a0920d..652e5ffbe 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -1 +1 @@ -2.0.5 2024-01-22T04:23:33Z +2.0.6 2024-02-15T16:29:01Z diff --git a/birdhouse/components/canarie-api/docker_configuration.py.template b/birdhouse/components/canarie-api/docker_configuration.py.template index 8561192ee..2a3aed472 100644 --- a/birdhouse/components/canarie-api/docker_configuration.py.template +++ b/birdhouse/components/canarie-api/docker_configuration.py.template @@ -109,8 +109,8 @@ SERVICES = { # NOTE: # Below version and release time auto-managed by 'make VERSION=x.y.z bump'. # Do NOT modify it manually. See 'Tagging policy' in 'birdhouse/README.rst'. - 'version': '2.0.5', - 'releaseTime': '2024-01-22T04:23:33Z', + 'version': '2.0.6', + 'releaseTime': '2024-02-15T16:29:01Z', 'institution': 'Ouranos', 'researchSubject': 'Climatology', 'supportEmail': '${SUPPORT_EMAIL}', @@ -142,8 +142,8 @@ PLATFORMS = { # NOTE: # Below version and release time auto-managed by 'make VERSION=x.y.z bump'. # Do NOT modify it manually. See 'Tagging policy' in 'birdhouse/README.rst'. - 'version': '2.0.5', - 'releaseTime': '2024-01-22T04:23:33Z', + 'version': '2.0.6', + 'releaseTime': '2024-02-15T16:29:01Z', 'institution': 'Ouranos', 'researchSubject': 'Climatology', 'supportEmail': '${SUPPORT_EMAIL}', diff --git a/docs/source/conf.py b/docs/source/conf.py index 3b825228e..a92ab3649 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -69,9 +69,9 @@ # built documents. # # The short X.Y version. -version = '2.0.5' +version = '2.0.6' # The full version, including alpha/beta/rc tags. -release = '2.0.5' +release = '2.0.6' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.