Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions birdhouse/components/dggs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
config/dggs/pydggsapi-config.json
config/magpie/config.yml
config/proxy/conf.extra-service.d/dggs.conf
config/data-proxy/conf.extra-service.d/dggs.conf
service-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
location ${DGGS_DATA_PROXY_URL_PATH}/ {
${SECURE_DATA_PROXY_AUTH_INCLUDE}

alias /data/data-proxy/${DGGS_API_NAME}/;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:
proxy:
volumes:
- ./components/dggs/config/data-proxy/conf.extra-service.d/dggs.conf:/etc/nginx/conf.extra-service.d/data-proxy/dggs.conf:ro
- ${DGGS_DATA_PROXY_DIR_PATH}:/data/data-proxy/${DGGS_API_NAME}:ro
16 changes: 15 additions & 1 deletion birdhouse/components/dggs/default.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,21 @@ export DGGS_IMAGE='ghcr.io/${DGGS_DOCKER}:${DGGS_VERSION}'
export DGGS_IMAGE_URI='${DGGS_IMAGE}'

# can be used to load local data into the container and cross-referencing it in the PyDGGS-API configuration
# otherwise, 'optional-components/secure-data-proxy' can be used to provide access to data via the Web
# otherwise, 'optional-components/data-proxy' (see below) can be used to provide access to data via the Web
# static files placed under 'DGGS_DATA_DIR' will be mapped to '/data' within the container, but NOT served on the Web
# this location *could* be used by the service to cache precomputed data to accelerate future access
export DGGS_DATA_DIR='${BIRDHOUSE_DATA_PERSIST_ROOT}/dggs'

# following applies when 'optional-components/data-proxy' is enabled (public by default)
# can be protected when combined with 'optional-components/secure-data-proxy'
# data placed under 'DGGS_DATA_PROXY_DIR_PATH' on the host will be served on the web via 'DGGS_DATA_PROXY_URL_PATH'
# NOTE:
# while serving PyDGGS-API data from this location is possible,
# it is NOT recommended as it would be much slower that using the local 'DGGS_DATA_DIR'
# the service will also have trouble accessing the file if protected by 'optional-components/secure-data-proxy'
export DGGS_DATA_PROXY_DIR_PATH='${BIRDHOUSE_DATA_PERSIST_ROOT}/data-proxy/dggs'
export DGGS_DATA_PROXY_URL_PATH='/data/${DGGS_API_NAME}'

# path of the configuration file known to PyDGGS-API
# by default, uses the file generated from the sample template to provide one example allowing API startup
# if other DGGRS definitions or DGGS data sources are desired, it should be overridden entirely within this variable
Expand Down Expand Up @@ -88,6 +98,8 @@ OPTIONAL_VARS="
\$DGGS_API_TITLE
\$DGGS_API_DESCRIPTION
\$DGGS_API_CONTACT
\$DGGS_DATA_PROXY_DIR_PATH
\$DGGS_DATA_PROXY_URL_PATH
\$SECURE_DATA_PROXY_AUTH_INCLUDE
"

Expand All @@ -98,6 +110,8 @@ export DELAYED_EVAL="
DGGS_DATA_DIR
DGGS_API_PATH
DGGS_TILES_PATH
DGGS_DATA_PROXY_DIR_PATH
DGGS_DATA_PROXY_URL_PATH
"

COMPONENT_DEPENDENCIES="
Expand Down
32 changes: 32 additions & 0 deletions birdhouse/optional-components/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,38 @@ The anonymous user will now have all the permissions described in |magpie-public
.. |magpie-public-perms| replace:: optional-components/all-public-access/all-public-access-magpie-permission.cfg
.. _env.local.example: ../env.local.example


.. _optional-components_data-proxy:

Provide web access to generic data
--------------------------------------------------------

It is possible to serve static data files through Nginx by mapping a directory to a specific URL path.
This optional component provides a configurable location to serve such data.

.. seealso::
Can be combined with :ref:`optional-components/secure-data-proxy <optional-components_secure-data-proxy>`
to control access to the data. Otherwise, it is public by default.

This component does not do anything on its own. It has to be combined with other components to make their
corresponding locations available through the web.

Enabling ``components/<SERVICE>`` with ``optional-components/data-proxy`` will make the following variables available:
- ``<SERVICE>_DATA_PROXY_URL_PATH``: web access location to the data
- ``<SERVICE>_DATA_PROXY_DIR_PATH``: host machine directory to the data
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, what is enforcing or forcing the pattern <SERVICE>_DATA_PROXY_URL_PATH and <SERVICE>_DATA_PROXY_DIR_PATH?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


By default, all services will employ ``/data/data-proxy/<service>`` as the host directory and ``/data/<service>``
as web serving location. They can be configured globally or per service using relevant configuration variables.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see what is enforcing or forcing this default "all services will employ /data/data-proxy/<service> as the host directory and /data/<service> as web serving location"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing is actually enforced. If we move forward with this concept, I think we would just make it an agreed upon default when writing the corresponding vars for all default.env of each service.


How to enable in ``env.local`` (a copy from `env.local.example`_ (:download:`download </birdhouse/env.local.example>`)):

* Add ``./optional-components/data-proxy`` to ``BIRDHOUSE_EXTRA_CONF_DIRS``.
* Optionally, configure alternate locations.
* Optionally, combine with ``./optional-components/secure-data-proxy`` to control access to the data.
* Enable another component supporting this cross-component capability.

.. _optional-components_secure-data-proxy:

Control secured access to generic data
--------------------------------------------------------

Expand Down
3 changes: 3 additions & 0 deletions birdhouse/optional-components/data-proxy/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ensure the component is detected when added to 'BIRDHOUSE_EXTRA_CONF_DIRS'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure but I don't think this will make data-proxy "detected". I think for a component to be detected it needs to either have default.env or docker-compose-extra.yml file.

But if you want a DATA_PROXY_LOCATIONS var that can be used ad-hoc in env.local, then you have your default.env and docker-compose-extra.yml for this component :D

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure it needs more testing. I've only pushed what I had drafted up to realizing #583 (comment).

# However, specific configurations for it are defined across other services
# Look for '..._DATA_PROXY_...' variables
Loading