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

fix cron script executions #14

Merged
merged 2 commits into from Feb 17, 2023
Merged

fix cron script executions #14

merged 2 commits into from Feb 17, 2023

Conversation

fmigneault
Copy link
Collaborator

Since 0.4.x versions, the -e installation flag in Docker caused the canarieapi package to not be available from cron call.
Log parsing and monitoring was silently failing and not reporting any update unless /test was manually invoke to generate the corresponding calls.

Fixes the installation such that the python call in the cron command can see the package from anywhere.

@fmigneault fmigneault self-assigned this Feb 17, 2023
@fmigneault fmigneault merged commit 5ee284f into master Feb 17, 2023
@fmigneault fmigneault deleted the fix-cron branch February 17, 2023 03:44
fmigneault added a commit to bird-house/birdhouse-deploy that referenced this pull request Apr 20, 2023
## 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant