Skip to content

Commit cf54b20

Browse files
authored
fix CanarieAPI config to support Python 3.x (#284)
## Overview Please include a summary of the changes and which issues are fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. ## Breaking changes - CanarieAPI: update to `0.7.1`. - The Docker running `CanarieAPI` is now using Python 3 (since `0.4.x` tags). Configurations need to be updated if any specific Python 2 definitions were used. See [2to3](https://docs.python.org/3/library/2to3.html) to help migrate configurations automatically if necessary. - Update the [CanarieAPI configuration](birdhouse/config/canarie-api/docker_configuration.py.template) to use Python 3.x executable code. ## Changes - CanarieAPI: update to `0.7.1`. - The server node now provides a generic ``server`` configuration for the current ``platform`` definition. - Added multiple missing docuementation references for all the services included within `CanarieAPI` configurations. - With new `CanarieAPI` version, a slightly improved UI with more service details are provided for the active server: ![image](https://user-images.githubusercontent.com/19194484/232822454-e39c0111-54dc-4f9b-adf6-5ea6e59d67e3.png) - Add optional variables witht defaults to define reference Docker image version tags. Following optional variables are defined by default. These are used as reference in the respective Docker compose service definition of these components, as well as in their `CanarieAPI` configuration to retrieve the release time of the tag, and refer to relevant URL references as needed. - `CATALOG_VERSION` - `FINCH_VERSION` - `FLYINGPIGEON_VERSION` - `GEOSERVER_VERSION` - `HUMMINGBIRD_VERSION` - `MALLEEFOWL_VERSION` - `RAVEN_VERSION` ## Fixes: - CanarieAPI: update to `0.7.1`. - Fixes an `AttributeError` raised due to misconfiguration of the Web Application with Flask 2.x definitions (relates to [Ouranosinc/CanarieAPI#10](Ouranosinc/CanarieAPI#10)). - Skip over `0.4.x`, `0.5.x`, `0.6.x` versions to avoid issue related to `cron` job monitoring and log parser command failures in order to collect configured service statistics and statuses (see also [Ouranosinc/CanarieAPI#14](Ouranosinc/CanarieAPI#14)). - Weaver: update CanarieAPI monitoring definitions - Move monitoring of public endpoint under [optional-components/canarie-api-full-monitoring][canarie-monitor]. - Add monitoring of private endpoint by default when using Weaver component. - Cowbird: update CanarieAPI monitoring definitions - Add monitoring of public endpoint under [optional-components/canarie-api-full-monitoring][canarie-monitor]. - Add public Magpie permission on Cowbird entrypoint only to allow its monitoring. ## Additional Information Resolves the following log error. ``` proxy | [2023-01-31 19:37:01 +0000] [37] [DEBUG] GET /canarie/ proxy | [2023-01-31 19:37:01,708] [37] [INFO] app_object : Disconnecting from database proxy | [2023-01-31 19:37:01,709] [37] [DEBUG] app_object : Using db filename : /opt/local/src/CanarieAPI/stats.db proxy | [2023-01-31 19:37:01 +0000] [37] [DEBUG] Closing connection. proxy | [2023-01-31 19:37:02 +0000] [37] [DEBUG] GET /canarie/background.jpg proxy | [2023-01-31 19:37:02,176] [37] [INFO] app_object : Disconnecting from database proxy | [2023-01-31 19:37:02,176] [37] [DEBUG] app_object : Using db filename : /opt/local/src/CanarieAPI/stats.db proxy | [2023-01-31 19:37:02 +0000] [37] [ERROR] Error handling request /canarie/background.jpg proxy | Traceback (most recent call last): proxy | File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/async.py", line 56, in handle proxy | self.handle_request(listener_name, req, client, addr) proxy | File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/ggevent.py", line 152, in handle_request proxy | super(GeventWorker, self).handle_request(*args) proxy | File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/async.py", line 107, in handle_request proxy | respiter = self.wsgi(environ, resp.start_response) proxy | File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1997, in __call__ proxy | return self.wsgi_app(environ, start_response) proxy | File "/opt/local/src/CanarieAPI/canarieapi/reverse_proxied.py", line 33, in __call__ proxy | return self.app(environ, start_response) proxy | File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1985, in wsgi_app proxy | response = self.handle_exception(e) proxy | File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1532, in handle_exception proxy | handler = self._find_error_handler(InternalServerError()) proxy | File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1449, in _find_error_handler proxy | .get(code)) proxy | File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1440, in find_handler proxy | handler = handler_map.get(cls) proxy | AttributeError: 'function' object has no attribute 'get' ``` The above problem lead to unresponsive CanarieAPI, which in turn caused the platform to fail responding with successful monitoring statuses for requests toward the configured services, which in turn, caused the stack to never completely boot. When the stack failed to boot, the *End2End Test Results* (example: #283 (comment)) could not run due to the unresponsive instance, which is the cause of the incomplete output: ````` Tests URL : NOTEBOOK TEST RESULTS ```` </code> `` ````` # To Do (in follow-up PRs) - remove deprecated configs deleted in #287 - remove deprecated configs deleted in #291 - remove deprecated configs deleted in #292
2 parents a93ccf0 + 5bbf294 commit cf54b20

File tree

64 files changed

+972
-164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+972
-164
lines changed

.bumpversion.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.25.7
2+
current_version = 1.26.0
33
commit = True
44
tag = False
55
tag_name = {new_version}
@@ -30,11 +30,11 @@ search = {current_version}
3030
replace = {new_version}
3131

3232
[bumpversion:file:RELEASE.txt]
33-
search = {current_version} 2023-04-20T14:15:34Z
33+
search = {current_version} 2023-04-20T20:42:31Z
3434
replace = {new_version} {utcnow:%Y-%m-%dT%H:%M:%SZ}
3535

3636
[bumpversion:part:releaseTime]
37-
values = 2023-04-20T14:15:34Z
37+
values = 2023-04-20T20:42:31Z
3838

3939
[bumpversion:file(version):birdhouse/config/canarie-api/docker_configuration.py.template]
4040
search = 'version': '{current_version}'

CHANGES.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,64 @@
1717

1818
[//]: # (list changes here, using '-' for each new entry, remove this when items are added)
1919

20+
[1.26.0](https://github.com/bird-house/birdhouse-deploy/tree/1.26.0) (2023-04-20)
21+
------------------------------------------------------------------------------------------------------------------
22+
23+
24+
## Breaking changes
25+
26+
- CanarieAPI: update to `0.7.1`.
27+
28+
- The Docker running `CanarieAPI` is now using Python 3 (since `0.4.x` tags).
29+
Configurations need to be updated if any specific Python 2 definitions were used.
30+
See [2to3](https://docs.python.org/3/library/2to3.html) to help migrate configurations automatically if necessary.
31+
- Update the [CanarieAPI configuration](birdhouse/config/canarie-api/docker_configuration.py.template) to use
32+
Python 3.x executable code.
33+
34+
## Changes
35+
36+
- CanarieAPI: update to `0.7.1`.
37+
38+
- The server node now provides a generic ``server`` configuration for the current ``platform`` definition.
39+
- Added multiple missing docuementation references for all the services included within `CanarieAPI` configurations.
40+
- With new `CanarieAPI` version, a slightly improved UI with more service details are provided for the active server:
41+
42+
![image](https://user-images.githubusercontent.com/19194484/232822454-e39c0111-54dc-4f9b-adf6-5ea6e59d67e3.png)
43+
44+
- Add optional variables witht defaults to define reference Docker image version tags.
45+
46+
Following optional variables are defined by default. These are used as reference in the respective Docker compose
47+
service definition of these components, as well as in their `CanarieAPI` configuration to retrieve the release time
48+
of the tag, and refer to relevant URL references as needed.
49+
50+
- `CATALOG_VERSION`
51+
- `FINCH_VERSION`
52+
- `FLYINGPIGEON_VERSION`
53+
- `GEOSERVER_VERSION`
54+
- `HUMMINGBIRD_VERSION`
55+
- `MALLEEFOWL_VERSION`
56+
- `RAVEN_VERSION`
57+
58+
## Fixes:
59+
60+
- CanarieAPI: update to `0.7.1`.
61+
62+
- Fixes an `AttributeError` raised due to misconfiguration of the Web Application with Flask 2.x definitions
63+
(relates to [Ouranosinc/CanarieAPI#10](https://github.com/Ouranosinc/CanarieAPI/pull/10)).
64+
- Skip over `0.4.x`, `0.5.x`, `0.6.x` versions to avoid issue related to `cron` job monitoring and log parser
65+
command failures in order to collect configured service statistics and statuses
66+
(see also [Ouranosinc/CanarieAPI#14](https://github.com/Ouranosinc/CanarieAPI/pull/14)).
67+
68+
- Weaver: update CanarieAPI monitoring definitions
69+
- Move monitoring of public endpoint under [optional-components/canarie-api-full-monitoring][canarie-monitor].
70+
- Add monitoring of private endpoint by default when using Weaver component.
71+
72+
- Cowbird: update CanarieAPI monitoring definitions
73+
- Add monitoring of public endpoint under [optional-components/canarie-api-full-monitoring][canarie-monitor].
74+
- Add public Magpie permission on Cowbird entrypoint only to allow its monitoring.
75+
76+
[canarie-monitor]: birdhouse/optional-components/canarie-api-full-monitoring
77+
2078
[1.25.7](https://github.com/bird-house/birdhouse-deploy/tree/1.25.7) (2023-04-20)
2179
------------------------------------------------------------------------------------------------------------------
2280

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Generic variables
22
override SHELL := bash
33
override APP_NAME := birdhouse-deploy
4-
override APP_VERSION := 1.25.7
4+
override APP_VERSION := 1.26.0
55

66
# utility to remove comments after value of an option variable
77
override clean_opt = $(shell echo "$(1)" | $(_SED) -r -e "s/[ '$'\t'']+$$//g")

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ for a full-fledged production platform.
1414
* - releases
1515
- | |latest-version| |commits-since|
1616

17-
.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/1.25.7.svg
17+
.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/1.26.0.svg
1818
:alt: Commits since latest release
19-
:target: https://github.com/bird-house/birdhouse-deploy/compare/1.25.7...master
19+
:target: https://github.com/bird-house/birdhouse-deploy/compare/1.26.0...master
2020

21-
.. |latest-version| image:: https://img.shields.io/badge/tag-1.25.7-blue.svg?style=flat
21+
.. |latest-version| image:: https://img.shields.io/badge/tag-1.26.0-blue.svg?style=flat
2222
:alt: Latest Tag
23-
:target: https://github.com/bird-house/birdhouse-deploy/tree/1.25.7
23+
:target: https://github.com/bird-house/birdhouse-deploy/tree/1.26.0
2424

2525
.. |readthedocs| image:: https://readthedocs.org/projects/birdhouse-deploy/badge/?version=latest
2626
:alt: ReadTheDocs Build Status (latest version)

RELEASE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.25.7 2023-04-20T14:15:34Z
1+
1.26.0 2023-04-20T20:42:31Z

birdhouse/components/cowbird/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ config/cowbird/config.yml
33
config/cowbird/cowbird.ini
44
config/magpie/config.yml
55
config/proxy/conf.extra-service.d/cowbird.conf
6+
config/proxy/canarie_api_monitoring.py
67

78
# Old paths. Keep these so that old config files remain uncommittable after updates.
89
conf.extra-service.d/cowbird.conf
10+
config/canarie-api/cowbird_config.py

birdhouse/components/cowbird/config/magpie/config.yml.template

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ permissions:
1818
permission: write
1919
group: administrators
2020
action: create
21+
# Allow validating/monitoring the service entrypoint and its version
22+
# Everything else should remain admin-protected since it manages other user/group permissions.
23+
- service: cowbird
24+
permission: read-match
25+
group: anonymous
26+
action: create
27+
- service: cowbird
28+
resource: /version
29+
permission: read-match
30+
group: anonymous
31+
action: create
2132

2233
# Definitions of all the webhooks urls that will be called when creating or deleting a user.
2334
webhooks:
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
SERVICES['Cowbird'] = {
2+
'info': {
3+
'name': 'Cowbird',
4+
'synopsis': 'Cowbird is a middleware that manages interactions between various birds of the bird-house stack.',
5+
'version': "${COWBIRD_VERSION}",
6+
'institution': 'Ouranos, CRIM',
7+
'releaseTime': get_release_time_from_repo_tag("github", "Ouranosinc/cowbird", "${COWBIRD_VERSION}"),
8+
'researchSubject': 'Any',
9+
'supportEmail': '${SUPPORT_EMAIL}',
10+
'category': 'Security',
11+
'tags': ['Security', 'Management', 'Access', 'Policy Decision Point']
12+
},
13+
'stats': {
14+
'method': '.*',
15+
'route': "/cowbird/.*"
16+
},
17+
'redirect': {
18+
'doc': 'https://pavics-cowbird.readthedocs.io/',
19+
'releasenotes': 'https://github.com/Ouranosinc/cowbird//blob/master/CHANGES.rst',
20+
'support': 'https://github.com/Ouranosinc/cowbird//issues',
21+
'source': 'https://github.com/Ouranosinc/cowbird/',
22+
'tryme': 'https://${PAVICS_FQDN_PUBLIC}/cowbird/',
23+
'licence': 'https://github.com/Ouranosinc/cowbird//blob/${COWBIRD_VERSION}/LICENSE',
24+
'provenance': 'https://github.com/Ouranosinc/cowbird/'
25+
},
26+
"monitoring": {
27+
"Cowbird": {
28+
'request': {
29+
'url': 'http://cowbird:7000/'
30+
},
31+
'response': {
32+
'text': '\{.*"title":.*"Cowbird REST API".*\}'
33+
}
34+
}
35+
}
36+
}
37+
38+
# vi: tabstop=8 expandtab shiftwidth=4 softtabstop=4 syntax=python

birdhouse/components/cowbird/config/proxy/docker-compose-extra.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,12 @@ services:
55
proxy:
66
volumes:
77
- ./components/cowbird/config/proxy/conf.extra-service.d:/etc/nginx/conf.extra-service.d/cowbird:ro
8+
# NOTE:
9+
# Prefix '0_' to the mounted file name to ensure it is loaded first by 'birdhouse/config/canarie-api/docker_configuration.py'
10+
# This ensures that the alphabetical loading order it defines will first load the default configs, then will load
11+
# the Cowbird config, and then all python configuration within 'optional-components/canarie-api-full-monitoring'.
12+
# It is important to load Cowbird before, as the full monitoring need to know if 'Cowbird' service is added to the
13+
# stack in order to apply the corresponding public endpoint conditionally.
14+
- ./components/cowbird/config/proxy/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/0_cowbird_config.py:ro
815
links:
916
- cowbird
Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,38 @@
1-
SERVICES['node']['monitoring'].update({
2-
'Weaver': {
3-
'request': {
4-
'url': 'https://${PAVICS_FQDN_PUBLIC}/weaver'
5-
},
1+
SERVICES['Weaver'] = {
2+
'info': {
3+
'name': 'Weaver',
4+
'synopsis': 'Weaver is an OGC-API flavored Execution Management Service (EMS) that allows the execution of workflows chaining various applications and Web Processing Services (WPS) inputs and outputs. Remote execution is deferred by the EMS to one or many Application, Deployment and Execution Service (ADES) or remote service providers, and employs Common Workflow Language (CWL) configurations to define an OGC Application Package deployed for each process.',
5+
'version': "${WEAVER_VERSION}",
6+
'institution': 'CRIM',
7+
'releaseTime': get_release_time_from_repo_tag("github", "crim-ca/weaver", "${WEAVER_VERSION}"),
8+
'researchSubject': 'Any',
9+
'supportEmail': '${SUPPORT_EMAIL}',
10+
'category': 'Processing',
11+
'tags': ['Workflow', 'Processes', 'Deployment', 'Distribution', 'EMS', 'ADES', 'CWL', 'OGC']
612
},
7-
})
13+
'stats': {
14+
'method': '.*',
15+
'route': "/weaver/.*"
16+
},
17+
'redirect': {
18+
'doc': 'https://pavics-weaver.readthedocs.io/',
19+
'releasenotes': 'https://github.com/crim-ca/weaver/blob/master/CHANGES.rst',
20+
'support': 'https://github.com/crim-ca/weaver/issues',
21+
'source': 'https://github.com/crim-ca/weaver',
22+
'tryme': 'https://${PAVICS_FQDN_PUBLIC}/weaver/',
23+
'licence': 'https://github.com/crim-ca/weaver/blob/${WEAVER_VERSION}/LICENSE.txt',
24+
'provenance': 'https://github.com/crim-ca/weaver'
25+
},
26+
"monitoring": {
27+
"Weaver": {
28+
'request': {
29+
'url': 'http://weaver:4001/'
30+
},
31+
'response': {
32+
'text': '\{.*"message":.*"Weaver Information".*\}'
33+
}
34+
}
35+
}
36+
}
837

938
# vi: tabstop=8 expandtab shiftwidth=4 softtabstop=4 syntax=python

0 commit comments

Comments
 (0)