Skip to content

Commit

Permalink
Bump canarie api 1.0.0 (#452)
Browse files Browse the repository at this point in the history
## Overview

This version of canarie-api permits running the proxy (nginx) container
independently of the canarie-api application. This makes it easier to
monitor the logs of canarie-api and proxy containers simultaneously and
allows for the configuration files for canarie-api to be mapped to the
canarie-api containers where appropriate.

## Changes

**Non-breaking changes**
- New component version canarie-api:1.0.0

**Breaking changes**

## Related Issue / Discussion

- Resolves [issue id](url)

## Additional Information

Links to other issues or sources.

- This might make parsing the nginx logs slightly easier as well which
could help with #12 and #444

## CI Operations

<!--
The test suite can be run using a different DACCS config with
``birdhouse_daccs_configs_branch: branch_name`` in the PR description.
To globally skip the test suite regardless of the commit message use
``birdhouse_skip_ci`` set to ``true`` in the PR description.
Note that using ``[skip ci]``, ``[ci skip]`` or ``[no ci]`` in the
commit message will override ``birdhouse_skip_ci`` from the PR
description.
-->

birdhouse_daccs_configs_branch: master
birdhouse_skip_ci: false
  • Loading branch information
mishaschwartz authored May 14, 2024
2 parents 8038856 + 5a63d49 commit 444a7c3
Show file tree
Hide file tree
Showing 48 changed files with 171 additions and 69 deletions.
6 changes: 3 additions & 3 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.2.2
current_version = 2.3.0
commit = True
tag = False
tag_name = {new_version}
Expand Down Expand Up @@ -30,11 +30,11 @@ search = {current_version}
replace = {new_version}

[bumpversion:file:RELEASE.txt]
search = {current_version} 2024-05-11T03:52:01Z
search = {current_version} 2024-05-14T13:43:50Z
replace = {new_version} {utcnow:%Y-%m-%dT%H:%M:%SZ}

[bumpversion:part:releaseTime]
values = 2024-05-11T03:52:01Z
values = 2024-05-14T13:43:50Z

[bumpversion:file(version):birdhouse/components/canarie-api/docker_configuration.py.template]
search = 'version': '{current_version}'
Expand Down
11 changes: 11 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@

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

[2.3.0](https://github.com/bird-house/birdhouse-deploy/tree/2.3.0) (2024-05-14)
------------------------------------------------------------------------------------------------------------------

## Changes

- bump canarie-api version to [1.0.0](https://github.com/Ouranosinc/CanarieAPI/releases/tag/1.0.0)

- This version of canarie-api permits running the proxy (nginx) container independently of the canarie-api
application. This makes it easier to monitor the logs of canarie-api and proxy containers simultaneously and
allows for the configuration files for canarie-api to be mapped to the canarie-api containers where appropriate.

[2.2.2](https://github.com/bird-house/birdhouse-deploy/tree/2.2.2) (2024-05-11)
------------------------------------------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generic variables
override SHELL := bash
override APP_NAME := birdhouse-deploy
override APP_VERSION := 2.2.2
override APP_VERSION := 2.3.0

# utility to remove comments after value of an option variable
override clean_opt = $(shell echo "$(1)" | $(_SED) -r -e "s/[ '$'\t'']+$$//g")
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ for a full-fledged production platform.
* - citation
- | |citation|

.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/2.2.2.svg
.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/2.3.0.svg
:alt: Commits since latest release
:target: https://github.com/bird-house/birdhouse-deploy/compare/2.2.2...master
:target: https://github.com/bird-house/birdhouse-deploy/compare/2.3.0...master

.. |latest-version| image:: https://img.shields.io/badge/tag-2.2.2-blue.svg?style=flat
.. |latest-version| image:: https://img.shields.io/badge/tag-2.3.0-blue.svg?style=flat
:alt: Latest Tag
:target: https://github.com/bird-house/birdhouse-deploy/tree/2.2.2
:target: https://github.com/bird-house/birdhouse-deploy/tree/2.3.0

.. |readthedocs| image:: https://readthedocs.org/projects/birdhouse-deploy/badge/?version=latest
:alt: ReadTheDocs Build Status (latest version)
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.2 2024-05-11T03:52:01Z
2.3.0 2024-05-14T13:43:50Z
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
location /canarie/ {
proxy_pass http://127.0.0.1:2000;
proxy_pass http://canarie-api:2000/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $real_scheme;
proxy_set_header X-Script-Name /canarie;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,4 @@ services:
proxy:
volumes:
- ./components/canarie-api/config/proxy/conf.extra-service.d:/etc/nginx/conf.extra-service.d/canarie-api:ro
- ./components/canarie-api/docker_configuration.py:/config/docker_configuration.py
- ./components/canarie-api/entrypoint:/entrypoint:ro
environment:
CANARIE_API_CONFIG_FN: /config/docker_configuration.py
CANARIE_MONITORING_EXTRA_CONF_DIR: ${CANARIE_MONITORING_EXTRA_CONF_DIR}
entrypoint: /entrypoint
- proxy-logs:${PROXY_LOG_DIR}
9 changes: 8 additions & 1 deletion birdhouse/components/canarie-api/default.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# Folder inside "proxy" container to drop extra monitoring config
export CANARIE_MONITORING_EXTRA_CONF_DIR="/conf.d"

export PROXY_IMAGE="pavics/canarieapi:0.7.1"
export CANARIE_DOCKER=pavics/canarieapi
export CANARIE_VERSION=1.0.0
export CANARIE_IMAGE='${CANARIE_DOCKER}:${CANARIE_VERSION}'

export DELAYED_EVAL="
$DELAYED_EVAL
CANARIE_IMAGE
"

# add any component that this component requires to run
COMPONENT_DEPENDENCIES="
Expand Down
45 changes: 45 additions & 0 deletions birdhouse/components/canarie-api/docker-compose-extra.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: "3.4"

x-logging:
&default-logging
driver: "json-file"
options:
max-size: "50m"
max-file: "10"

services:
canarie-api:
image: ${CANARIE_IMAGE}
container_name: canarie-api
volumes:
- canarie-data:/data/
- ./components/canarie-api/docker_configuration.py:/config/docker_configuration.py:ro
- ./components/canarie-api/entrypoint:/entrypoint:ro
environment:
CANARIE_API_CONFIG_FN: /config/docker_configuration.py
CANARIE_MONITORING_EXTRA_CONF_DIR: ${CANARIE_MONITORING_EXTRA_CONF_DIR}
restart: always
entrypoint: /entrypoint
logging: *default-logging

canarie-api-cron:
image: ${CANARIE_IMAGE}
container_name: canarie-api-cron
depends_on:
- canarie-api
# The volumes and environment should be the same as the canarie-api container except for the proxy-logs volume
volumes:
- canarie-data:/data/
- ./components/canarie-api/docker_configuration.py:/config/docker_configuration.py:ro
- ./components/canarie-api/entrypoint-cron:/entrypoint:ro
- proxy-logs:/logs/:ro # aligns with the DATABASE["access_log"] value in docker_configuration.py.template
environment:
CANARIE_API_CONFIG_FN: /config/docker_configuration.py
CANARIE_MONITORING_EXTRA_CONF_DIR: ${CANARIE_MONITORING_EXTRA_CONF_DIR}
restart: always
entrypoint: /entrypoint
logging: *default-logging

volumes:
canarie-data:
proxy-logs:
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ logger = logging.getLogger("canarie-api-config")
MY_SERVER_NAME = 'https://${PAVICS_FQDN_PUBLIC}/canarie'

DATABASE = {
'filename': '/opt/local/src/CanarieAPI/stats.db',
'access_log': '/var/log/nginx/access_file.log',
'log_pid': '/var/run/nginx.pid'
'filename': '/data/stats.db',
'access_log': '/logs/${PROXY_LOG_FILE}'
}


Expand Down Expand Up @@ -109,8 +108,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.2.2',
'releaseTime': '2024-05-11T03:52:01Z',
'version': '2.3.0',
'releaseTime': '2024-05-14T13:43:50Z',
'institution': '${SERVER_INSTITUTION}',
'researchSubject': '${SERVER_SUBJECT}',
'supportEmail': '${SUPPORT_EMAIL}',
Expand Down Expand Up @@ -142,8 +141,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.2.2',
'releaseTime': '2024-05-11T03:52:01Z',
'version': '2.3.0',
'releaseTime': '2024-05-14T13:43:50Z',
'institution': '${SERVER_INSTITUTION}',
'researchSubject': '${SERVER_SUBJECT}',
'supportEmail': '${SUPPORT_EMAIL}',
Expand Down
9 changes: 0 additions & 9 deletions birdhouse/components/canarie-api/entrypoint
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
#!/bin/sh -x

# hack needed for Boreas and Medus only else cronjob do not fire
# this hack should still work for other deployments
# remove if cause problem with newer version of canarieapi
touch /etc/cron.d/canarieapi-cron

pip install requests-cache

# chain existing cmd
exec /bin/sh -c "\
env >> /etc/environment && \
cron && \
nginx && \
gunicorn -b 0.0.0.0:2000 --workers 1 --log-level=DEBUG --timeout 30 -k gevent canarieapi.wsgi \
"
14 changes: 14 additions & 0 deletions birdhouse/components/canarie-api/entrypoint-cron
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh -x

# hack needed for Boreas and Medus only else cronjob do not fire
# this hack should still work for other deployments
# remove if cause problem with newer version of canarieapi
touch /etc/cron.d/canarieapi-cron

pip install requests-cache

# chain existing cmd
exec /bin/sh -c "\
env >> /etc/environment && \
cron -f
"
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
version: "3.4"

services:
proxy:
canarie-api: &canarie-volumes
volumes:
# NOTE:
# Prefix '0_' to the mounted file name to ensure it is loaded first by 'birdhouse/components/canarie-api/docker_configuration.py'
# This ensures that the alphabetical loading order it defines will first load the default configs, then will load
# the Cowbird config, and then all python configuration within 'optional-components/canarie-api-full-monitoring'.
# It is important to load Cowbird before, as the full monitoring need to know if 'Cowbird' service is added to the
# stack in order to apply the corresponding public endpoint conditionally.
- ./components/cowbird/config/proxy/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/0_cowbird_config.py:ro
- ./components/cowbird/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/0_cowbird_config.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./components/finch/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/finch_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./components/geoserver/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/geoserver_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./components/hummingbird/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/hummingbird_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./components/jupyterhub/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/jupyterhub_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./components/magpie/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/magpie_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
7 changes: 7 additions & 0 deletions birdhouse/components/proxy/default.env
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ export PROXY_ROOT_LOCATION="return 302 https://\$host/jupyter/hub/login;"

export INCLUDE_FOR_PORT_80='$([ x"$ALLOW_UNSECURE_HTTP" = x"True" ] && echo "include /etc/nginx/conf.d/all-services.include;" || echo "include /etc/nginx/conf.d/redirect-to-https.include;")'

export PROXY_LOG_DIR="/var/log/nginx/"
export PROXY_LOG_FILE="access_file.log"
export PROXY_LOG_PATH='${PROXY_LOG_DIR}/${PROXY_LOG_FILE}'

export DELAYED_EVAL="
$DELAYED_EVAL
INCLUDE_FOR_PORT_80
PROXY_LOG_PATH
"

# add any new variables not already in 'VARS' or 'OPTIONAL_VARS' that must be replaced in templates here
Expand All @@ -33,4 +38,6 @@ export OPTIONAL_VARS="
\$INCLUDE_FOR_PORT_80
\$PROXY_READ_TIMEOUT_VALUE
\$PROXY_ROOT_LOCATION
\$PROXY_LOG_FILE
\$PROXY_LOG_PATH
"
2 changes: 1 addition & 1 deletion birdhouse/components/proxy/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ http {
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access_file.log main;
access_log ${PROXY_LOG_PATH} main;

sendfile on;
#tcp_nopush on;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./components/raven/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/raven_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./components/stac/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/stac_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./components/thredds/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/thredds_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./components/twitcher/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/twitcher_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.4"

services:
# extend proxy configuration with weaver endpoints
proxy:
canarie-api: &canarie-volumes
volumes:
# NOTE:
# Prefix '0_' to the mounted file name to ensure it is loaded first by 'birdhouse/components/canarie-api/docker_configuration.py'
Expand All @@ -12,3 +12,4 @@ services:
# stack in order to apply the corresponding public endpoint conditionally.
- ./components/weaver/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/0_weaver_config.py:ro
- ./components/weaver/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/weaver_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./components/wps_outputs-volume/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/wps_outputs-volume_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./deprecated-components/catalog/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/catalog_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./deprecated-components/flyingpigeon/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/flyingpigeon_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./deprecated-components/frontend/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/frontend_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./deprecated-components/malleefowl/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/malleefowl_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.4"
services:
proxy:
canarie-api: &canarie-volumes
volumes:
- ./deprecated-components/phoenix/config/canarie-api/canarie_api_monitoring.py:${CANARIE_MONITORING_EXTRA_CONF_DIR}/phoenix_canarie_api_monitoring.py:ro
canarie-api-cron: *canarie-volumes
Loading

0 comments on commit 444a7c3

Please sign in to comment.