From 41bf89144eecf750ce19536d4781aa0941a81e47 Mon Sep 17 00:00:00 2001 From: Francis Charette Migneault Date: Wed, 20 Sep 2023 11:04:19 -0400 Subject: [PATCH 1/5] move STAC service Magpie definition under its component --- birdhouse/components/stac/.gitignore | 1 + .../components/stac/config/magpie/config.yml.template | 9 +++++++++ .../stac/config/magpie/docker-compose-extra.yml | 4 ++++ .../config/magpie/config.yml.template | 10 ---------- .../config/magpie/docker-compose-extra.yml | 1 - 5 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 birdhouse/components/stac/config/magpie/config.yml.template create mode 100644 birdhouse/components/stac/config/magpie/docker-compose-extra.yml diff --git a/birdhouse/components/stac/.gitignore b/birdhouse/components/stac/.gitignore index 7ebb0c623..d4f1fa13d 100644 --- a/birdhouse/components/stac/.gitignore +++ b/birdhouse/components/stac/.gitignore @@ -1,2 +1,3 @@ +config/magpie/config.yml config/proxy/conf.extra-service.d/stac.conf config/canarie-api/canarie_api_monitoring.py diff --git a/birdhouse/components/stac/config/magpie/config.yml.template b/birdhouse/components/stac/config/magpie/config.yml.template new file mode 100644 index 000000000..3329cede2 --- /dev/null +++ b/birdhouse/components/stac/config/magpie/config.yml.template @@ -0,0 +1,9 @@ +providers: + # definition of STAC service for API access + stac: + url: http://stac:8000 + title: STAC + public: true + c4i: false + type: api + sync_type: api diff --git a/birdhouse/components/stac/config/magpie/docker-compose-extra.yml b/birdhouse/components/stac/config/magpie/docker-compose-extra.yml new file mode 100644 index 000000000..46fb85ef1 --- /dev/null +++ b/birdhouse/components/stac/config/magpie/docker-compose-extra.yml @@ -0,0 +1,4 @@ +services: + magpie: + volumes: + - ./components/stac/config/magpie/config.yml:${MAGPIE_PROVIDERS_CONFIG_PATH}/stac.yml:ro diff --git a/birdhouse/optional-components/stac-public-access/config/magpie/config.yml.template b/birdhouse/optional-components/stac-public-access/config/magpie/config.yml.template index 6e0454d93..e27447723 100644 --- a/birdhouse/optional-components/stac-public-access/config/magpie/config.yml.template +++ b/birdhouse/optional-components/stac-public-access/config/magpie/config.yml.template @@ -1,13 +1,3 @@ -providers: - # definition of STAC service for API access - stac: - url: http://stac:8000 - title: STAC - public: true - c4i: false - type: api - sync_type: api - permissions: - service: stac permission: read diff --git a/birdhouse/optional-components/stac-public-access/config/magpie/docker-compose-extra.yml b/birdhouse/optional-components/stac-public-access/config/magpie/docker-compose-extra.yml index f117b5613..d49d442ea 100644 --- a/birdhouse/optional-components/stac-public-access/config/magpie/docker-compose-extra.yml +++ b/birdhouse/optional-components/stac-public-access/config/magpie/docker-compose-extra.yml @@ -3,4 +3,3 @@ services: magpie: volumes: - ./optional-components/stac-public-access/config/magpie/config.yml:${MAGPIE_PERMISSIONS_CONFIG_PATH}/stac-public-access.yml:ro - - ./optional-components/stac-public-access/config/magpie/config.yml:${MAGPIE_PROVIDERS_CONFIG_PATH}/stac-public-access.yml:ro From db675351a736222c69a3de6ee4d8eaed91f62a0e Mon Sep 17 00:00:00 2001 From: Francis Charette Migneault Date: Wed, 20 Sep 2023 11:15:49 -0400 Subject: [PATCH 2/5] add initial Mapige /stac/stac resource creation --- CHANGES.md | 9 ++++++++- .../components/stac/config/magpie/config.yml.template | 10 ++++++++++ .../stac/config/magpie/docker-compose-extra.yml | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index ef376f9d9..ab51e9bc2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,7 +15,14 @@ [Unreleased](https://github.com/bird-house/birdhouse-deploy/tree/master) (latest) ------------------------------------------------------------------------------------------------------------------ -[//]: # (list changes here, using '-' for each new entry, remove this when items are added) +## Fixes + +- Move initial ``stac`` service Magpie definition under its component configuration. + - Before this change, ``optional-components/stac-public-access`` was mandatory since the ``stac`` service under + Magpie was not created otherwise, leading to "*service not found*" error when requesting the ``/stac`` endpoint. + - Ensure that the first ``stac`` resource under ``stac`` service in Magpie is created by default. + Without this resource being defined initially, it is very easy to forget creating it, which would not take into + account the required ``/stac/stac`` request path to properly resolve the real endpoints where STAC API is served. [1.31.2](https://github.com/bird-house/birdhouse-deploy/tree/1.31.2) (2023-09-13) ------------------------------------------------------------------------------------------------------------------ diff --git a/birdhouse/components/stac/config/magpie/config.yml.template b/birdhouse/components/stac/config/magpie/config.yml.template index 3329cede2..f8157469f 100644 --- a/birdhouse/components/stac/config/magpie/config.yml.template +++ b/birdhouse/components/stac/config/magpie/config.yml.template @@ -7,3 +7,13 @@ providers: c4i: false type: api sync_type: api + +permissions: + # create a default 'stac' resource under 'stac' service + # because of the '/stac/stac' path prefix required to resolve the API links properly, + # all permissions must be nested under this 'stac' resource for requests and permissions to be resolved accordingly + - service: stac + resource: /stac + permission: read + group: administrator # they already have access, just using admins to create the resource by default + action: create diff --git a/birdhouse/components/stac/config/magpie/docker-compose-extra.yml b/birdhouse/components/stac/config/magpie/docker-compose-extra.yml index 46fb85ef1..1a786c4dc 100644 --- a/birdhouse/components/stac/config/magpie/docker-compose-extra.yml +++ b/birdhouse/components/stac/config/magpie/docker-compose-extra.yml @@ -2,3 +2,4 @@ services: magpie: volumes: - ./components/stac/config/magpie/config.yml:${MAGPIE_PROVIDERS_CONFIG_PATH}/stac.yml:ro + - ./components/stac/config/magpie/config.yml:${MAGPIE_PERMISSIONS_CONFIG_PATH}/stac.yml:ro From 929faa2c4c6b4e91f7791a2a690abd60081279ed Mon Sep 17 00:00:00 2001 From: Francis Charette Migneault Date: Wed, 20 Sep 2023 14:57:17 -0400 Subject: [PATCH 3/5] remove stac-public-access dependnecy under all-public-access --- CHANGES.md | 5 +++++ birdhouse/optional-components/README.rst | 5 +++++ birdhouse/optional-components/all-public-access/default.env | 1 - 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index ab51e9bc2..1134b1dbc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -24,6 +24,11 @@ Without this resource being defined initially, it is very easy to forget creating it, which would not take into account the required ``/stac/stac`` request path to properly resolve the real endpoints where STAC API is served. +- Remove `optional-components/stac-public-access` dependency under `optional-components/all-public-access` + to avoid indirectly enforcing `components/stac` when `optional-components/all-public-access` is enabled. + Users that desire using `optional-components/stac-public-access` will have to add it explicitly to the list + of `EXTRA_CONF_DIRS`. + [1.31.2](https://github.com/bird-house/birdhouse-deploy/tree/1.31.2) (2023-09-13) ------------------------------------------------------------------------------------------------------------------ diff --git a/birdhouse/optional-components/README.rst b/birdhouse/optional-components/README.rst index 3670112d2..44fa6b778 100644 --- a/birdhouse/optional-components/README.rst +++ b/birdhouse/optional-components/README.rst @@ -163,6 +163,11 @@ How to enable in ``env.local`` (a copy from `env.local.example`_ (:download:`dow The anonymous user will now have all the permissions described in |magpie-public-perms|_ (:download:`download `). +.. note:: + If using the ``./components/stac`` feature, the corresponding ``./optional-components/stac-public-access`` + must be applied as well to obtain similar functionalities to ``./optional-components/all-public-access``. + This optional component is kept separate since ``./components/stac`` is not required by default, and therefore + cannot be enforced as a component dependency. .. _magpie-public-perms: ./all-public-access/all-public-access-magpie-permission.cfg .. |magpie-public-perms| replace:: optional-components/all-public-access/all-public-access-magpie-permission.cfg diff --git a/birdhouse/optional-components/all-public-access/default.env b/birdhouse/optional-components/all-public-access/default.env index 95a8fba37..1dfd6f35b 100644 --- a/birdhouse/optional-components/all-public-access/default.env +++ b/birdhouse/optional-components/all-public-access/default.env @@ -3,5 +3,4 @@ # add any component that this component requires to run COMPONENT_DEPENDENCIES=" ./config/magpie - ./optional-components/stac-public-access " From 89f5f60c33b558c167d4d8f6c7e24de67840a0e8 Mon Sep 17 00:00:00 2001 From: Francis Charette Migneault Date: Wed, 20 Sep 2023 15:19:02 -0400 Subject: [PATCH 4/5] rename stac magpie config.yml to permissions.cfg --- CHANGES.md | 4 ++++ birdhouse/optional-components/stac-public-access/.gitignore | 2 ++ .../stac-public-access/config/magpie/docker-compose-extra.yml | 2 +- .../magpie/{config.yml.template => permissions.cfg.template} | 0 4 files changed, 7 insertions(+), 1 deletion(-) rename birdhouse/optional-components/stac-public-access/config/magpie/{config.yml.template => permissions.cfg.template} (100%) diff --git a/CHANGES.md b/CHANGES.md index 1134b1dbc..3d9f6eb9e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -29,6 +29,10 @@ Users that desire using `optional-components/stac-public-access` will have to add it explicitly to the list of `EXTRA_CONF_DIRS`. +- Rename `optional-components/stac-public-access/config/magpie/config.yml.template` to + `optional-components/stac-public-access/config/magpie/permissions.yml.template` in order to align + with permissions-specific contents as accomplished with other components. + [1.31.2](https://github.com/bird-house/birdhouse-deploy/tree/1.31.2) (2023-09-13) ------------------------------------------------------------------------------------------------------------------ diff --git a/birdhouse/optional-components/stac-public-access/.gitignore b/birdhouse/optional-components/stac-public-access/.gitignore index d3f2f4d4b..5d1605ad6 100644 --- a/birdhouse/optional-components/stac-public-access/.gitignore +++ b/birdhouse/optional-components/stac-public-access/.gitignore @@ -1 +1,3 @@ +config/magpie/permissions.cfg +# old name for backward compatibility: config/magpie/config.yml diff --git a/birdhouse/optional-components/stac-public-access/config/magpie/docker-compose-extra.yml b/birdhouse/optional-components/stac-public-access/config/magpie/docker-compose-extra.yml index d49d442ea..6a188b184 100644 --- a/birdhouse/optional-components/stac-public-access/config/magpie/docker-compose-extra.yml +++ b/birdhouse/optional-components/stac-public-access/config/magpie/docker-compose-extra.yml @@ -2,4 +2,4 @@ version: "3.4" services: magpie: volumes: - - ./optional-components/stac-public-access/config/magpie/config.yml:${MAGPIE_PERMISSIONS_CONFIG_PATH}/stac-public-access.yml:ro + - ./optional-components/stac-public-access/config/magpie/permissions.cfg:${MAGPIE_PERMISSIONS_CONFIG_PATH}/stac-public-access-permissions.cfg:ro diff --git a/birdhouse/optional-components/stac-public-access/config/magpie/config.yml.template b/birdhouse/optional-components/stac-public-access/config/magpie/permissions.cfg.template similarity index 100% rename from birdhouse/optional-components/stac-public-access/config/magpie/config.yml.template rename to birdhouse/optional-components/stac-public-access/config/magpie/permissions.cfg.template From e0a6e0d8dfe2bac5969bad9cdb120ba016022d7a Mon Sep 17 00:00:00 2001 From: Francis Charette Migneault Date: Wed, 20 Sep 2023 15:31:06 -0400 Subject: [PATCH 5/5] rename to plain stac magpie permissions.cfg (no template) --- CHANGES.md | 2 +- birdhouse/optional-components/stac-public-access/.gitignore | 3 --- .../magpie/{permissions.cfg.template => permissions.cfg} | 0 3 files changed, 1 insertion(+), 4 deletions(-) rename birdhouse/optional-components/stac-public-access/config/magpie/{permissions.cfg.template => permissions.cfg} (100%) diff --git a/CHANGES.md b/CHANGES.md index 3d9f6eb9e..07c1fcf6c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -30,7 +30,7 @@ of `EXTRA_CONF_DIRS`. - Rename `optional-components/stac-public-access/config/magpie/config.yml.template` to - `optional-components/stac-public-access/config/magpie/permissions.yml.template` in order to align + `optional-components/stac-public-access/config/magpie/permissions.cfg` in order to align with permissions-specific contents as accomplished with other components. [1.31.2](https://github.com/bird-house/birdhouse-deploy/tree/1.31.2) (2023-09-13) diff --git a/birdhouse/optional-components/stac-public-access/.gitignore b/birdhouse/optional-components/stac-public-access/.gitignore index 5d1605ad6..e69de29bb 100644 --- a/birdhouse/optional-components/stac-public-access/.gitignore +++ b/birdhouse/optional-components/stac-public-access/.gitignore @@ -1,3 +0,0 @@ -config/magpie/permissions.cfg -# old name for backward compatibility: -config/magpie/config.yml diff --git a/birdhouse/optional-components/stac-public-access/config/magpie/permissions.cfg.template b/birdhouse/optional-components/stac-public-access/config/magpie/permissions.cfg similarity index 100% rename from birdhouse/optional-components/stac-public-access/config/magpie/permissions.cfg.template rename to birdhouse/optional-components/stac-public-access/config/magpie/permissions.cfg