-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
optional-components/stac-data-proxy
(#403)
## Overview Provide a way to host local data that STAC API can refer to for use/download. Currently, any STAC Asset that is referenced within responses by STAC-API Collections/Items must either be already hosted by another service of the stack (eg: CMIP6 netCDF in THREDDS), or point at some other external resource not on the server. Instead of having a custom config and mount point for each node, this optional component defines a standard way to define it. ## Changes **Non-breaking changes** - `optional-components/stac-data-proxy`: add a new feature to allow hosting of local STAC assets. The new component defines variables `STAC_DATA_PROXY_DIR_PATH` (default `${DATA_PERSIST_ROOT}/stac-data`) and `STAC_DATA_PROXY_URL_PATH` (default `/data/stac`) that are aliased (mapped) under `nginx` to provide a URL where locally hosted STAC assets can be downloaded from. This allows a server node to be a proper data provider, where its STAC-API can return Catalog, Collection and Item definitions that points at these local assets available through the `STAC_DATA_PROXY_URL_PATH` endpoint. When enabled, this component can be combined with `optional-components/secure-data-proxy` to allow per-resource access control of the contents under `STAC_DATA_PROXY_DIR_PATH` by setting relevant Magpie permissions under service `secure-data-proxy` for children resources that correspond to `STAC_DATA_PROXY_URL_PATH`. Otherwise, the path and all of its contents are publicly available, in the same fashion that WPS outputs are managed without `optional-components/secure-data-proxy`. More details are provided in https://github.com/bird-house/birdhouse-deploy/blob/stac-data-proxy/birdhouse/optional-components/README.rst#provide-a-proxy-for-local-stac-asset-hosting **Breaking changes** - n/a ## Related Issue / Discussion - Relates to crim-ca/stac-populator#31 - Relates to contents in https://github.com/ai-extensions/stac-data-loader/tree/main/data/EuroSAT/stac - Relates to https://github.com/ai-extensions/stac-data-loader/blob/main/notebooks/stac_eurosat.ipynb STAC metadata generated from above notebook (see subset for example), will be able to use a location such as `https://${PAVICS_FQDN_PUBLIC}${STAC_DATA_PROXY_URL_PATH}/EuroSAT/...` instead of the temporary raw-GitHub content URLs. The STAC populator (with `DirectoryLoading` implementation), will be able to push the STAC Collection/Items toward that instances. The STAC Assets that they refer to will be placed under `${STAC_DATA_PROXY_DIR_PATH}/EuroSAT` to make them accessible externally.
- Loading branch information
Showing
17 changed files
with
173 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.39.2 2023-11-30T15:28:22Z | ||
1.40.0 2023-11-30T18:27:41Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
config/proxy/conf.extra-service.d/stac-proxy-data.conf | ||
config/secure-data-proxy/permissions.cfg |
5 changes: 5 additions & 0 deletions
5
...omponents/stac-data-proxy/config/proxy/conf.extra-service.d/stac-proxy-data.conf.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
location ${STAC_DATA_PROXY_URL_PATH}/ { | ||
${SECURE_DATA_PROXY_AUTH_INCLUDE} | ||
|
||
alias /stac-data-proxy/; | ||
} |
7 changes: 7 additions & 0 deletions
7
birdhouse/optional-components/stac-data-proxy/config/proxy/docker-compose-extra.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: "3.4" | ||
services: | ||
proxy: | ||
volumes: | ||
- ./optional-components/stac-data-proxy/config/proxy/conf.extra-service.d:/etc/nginx/conf.extra-service.d/stac-data-proxy:ro | ||
# NOTE: data for hosted STAC assets, not to be confused with 'stac-db' for internal STAC catalog definitions | ||
- ${STAC_DATA_PROXY_DIR_PATH}:/stac-data-proxy |
5 changes: 5 additions & 0 deletions
5
...use/optional-components/stac-data-proxy/config/secure-data-proxy/docker-compose-extra.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version: "3.4" | ||
services: | ||
magpie: | ||
volumes: | ||
- ./optional-components/stac-data-proxy/config/secure-data-proxy/permissions.cfg:${MAGPIE_PERMISSIONS_CONFIG_PATH}/stac-data-proxy.cfg:ro |
12 changes: 12 additions & 0 deletions
12
...use/optional-components/stac-data-proxy/config/secure-data-proxy/permissions.cfg.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# NOTE: | ||
# Assume 'secure-data-proxy' would exist if needed (other component dependency). | ||
# Since sorted load order of 'secure-data-proxy' < 'stac-data-proxy' in Magpie, 'secure-data-proxy' should exist. | ||
permissions: | ||
# following permission does not change anything technically (full access for admins) | ||
# it is employed only to set up the relevant resource path and make permission customization easier by Magpie API/UI | ||
- service: secure-data-proxy | ||
resource: ${STAC_DATA_PROXY_URL_PATH} | ||
type: route | ||
permission: read | ||
group: administrators | ||
action: create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/sh | ||
|
||
# All env in this default.env can be overridden by env.local. | ||
|
||
# All env in this default.env must NOT depend on any other env. If they do, they | ||
# must use single quotes to avoid early expansion before overrides in env.local | ||
# are applied and must be added to the list of DELAYED_EVAL. | ||
|
||
# add any new variables not already in 'VARS' or 'OPTIONAL_VARS' that must be replaced in templates here | ||
# single quotes are important in below list to keep variable names intact until 'pavics-compose' parses them | ||
EXTRA_VARS=' | ||
$STAC_DATA_PROXY_DIR_PATH | ||
$STAC_DATA_PROXY_URL_PATH | ||
' | ||
|
||
# extend the original 'VARS' from 'birdhouse/pavics-compose.sh' to employ them for template substitution | ||
# adding them to 'VARS', they will also be validated in case of override of 'default.env' using 'env.local' | ||
VARS="$VARS $EXTRA_VARS" | ||
|
||
# Directory path that will be used as volume mount for storing hosted STAC assets data | ||
# NOTE: | ||
# Hosting is not performed by the API itself. Data is expected to already reside in that | ||
# location when referenced by STAC Collections and Items to make them accessible externally. | ||
export STAC_DATA_PROXY_DIR_PATH='${DATA_PERSIST_ROOT}/stac-data' | ||
|
||
# URL path (after PAVICS_FQDN_PUBLIC) that will be used to proxy local STAC assets data | ||
export STAC_DATA_PROXY_URL_PATH="/data/stac" | ||
|
||
DELAYED_EVAL=" | ||
$DELAYED_EVAL | ||
STAC_DATA_PROXY_DIR_PATH | ||
" | ||
|
||
# add any component that this component requires to run | ||
# NOTE: | ||
# './optional-component/secure-data-proxy' is purposely omitted from dependencies | ||
# if 'EXTRA_CONF_DIRS' enabled it as well, the proxy path/alias will have relevant auth request enabled | ||
# otherwise, it will use by default the public access with no prior nginx auth validation | ||
COMPONENT_DEPENDENCIES=" | ||
./components/stac | ||
./config/proxy | ||
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
config/stac-data-proxy/permissions.cfg |
5 changes: 5 additions & 0 deletions
5
...se/optional-components/stac-public-access/config/stac-data-proxy/docker-compose-extra.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version: "3.4" | ||
services: | ||
magpie: | ||
volumes: | ||
- ./optional-components/stac-public-access/config/stac-data-proxy/permissions.cfg:${MAGPIE_PERMISSIONS_CONFIG_PATH}/stac-data-proxy-public.cfg:ro |
10 changes: 10 additions & 0 deletions
10
...se/optional-components/stac-public-access/config/stac-data-proxy/permissions.cfg.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# NOTE: | ||
# Assume 'secure-data-proxy' would exist if needed. | ||
# Since 'secure-data-proxy' < 'stac-data-proxy-public', it should be loaded first. | ||
permissions: | ||
- service: secure-data-proxy | ||
resource: ${STAC_DATA_PROXY_URL_PATH} | ||
type: route | ||
permission: read | ||
group: anonymous | ||
action: create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters