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

add node services URI and fields #445

Merged
merged 12 commits into from
Apr 18, 2024
Merged

add node services URI and fields #445

merged 12 commits into from
Apr 18, 2024

Conversation

fmigneault
Copy link
Collaborator

@fmigneault fmigneault commented Apr 5, 2024

Overview

Add node services URI and fields.

Changes

Non-breaking changes

  • Node Services: Add definitions and variables for every service represented by
    the DACCS-Climate/Marble-node-registry.

    • Add version field using the corresponding <SERVICE>_VERSION variables.
    • Add types field restricted by specific values instead of previous keywords expected to be extendable.
    • Add <SERVICE>_IMAGE_URI variables to provide rel: service-meta link for every service.

Breaking changes

  • n/a

Related Issue / Discussion

CI Operations

birdhouse_daccs_configs_branch: master
birdhouse_skip_ci: false

@fmigneault fmigneault self-assigned this Apr 5, 2024
@github-actions github-actions bot added component/geoserver Related to GeoServer or one of its underlying services component/jupyterhub Related to JupyterHub as development frontend with notebooks component/STAC Features or components related to STAC component/THREDDS Features or components related to THREDDS component/weaver Related to https://github.com/crim-ca/weaver documentation Improvements or additions to documentation feature/node-registry Related to https://github.com/DACCS-Climate/DACCS-node-registry feature/WPS Feature or service related to Web Processing Service labels Apr 5, 2024
Copy link
Collaborator

@mishaschwartz mishaschwartz left a comment

Choose a reason for hiding this comment

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

Do we also want to update deprecated-components/flyingpigeon as well?

I'm very happy to not update deprecated components but I just wanted to double check that you left it out intentionally.

"version": "${FINCH_VERSION}",
"types": [
"wps"
],
"keywords": [
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we leave these keywords as is if we're moving this information to "types". What if we borrowed some of the tags and categories from canarie-api instead. So for finch we could do something like:

"keywords": ["Climatology", "Cloud", "Data Slicer", "Climate Indices", ...]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. I would like to do this, but until there is a clear-cut version I can refer to, adding these to the keywords will fail schema validation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it. Try now with version 1.2.0?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we going to do this in this PR or in a different one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If possible, I'd prefer to work on this only once.

birdhouse/components/finch/service-config.json.template Outdated Show resolved Hide resolved
Copy link
Collaborator

@tlvu tlvu left a comment

Choose a reason for hiding this comment

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

Ensure template expansion actually work.

Also I do not think this PR introduce a breaking change (in reference to this PR description). The new var has a default value so upgrading to this PR is 100% seamless, no manual intervention required, so nothing "breaking" as per deployment as I can see.

I defer to Misha for review of the content of the .json .

Agree with Misha this PR unified the way to specify all the images so it's a very nice side-effect.

Also, it seems all we need are additional copy/paste to make deprecated-components work so probably cheap enough to make it work as well.

birdhouse/components/finch/service-config.json.template Outdated Show resolved Hide resolved
@mishaschwartz
Copy link
Collaborator

@tlvu

Also, it seems all we need are additional copy/paste to make deprecated-components work so probably cheap enough to make it work as well.

Cheap enough for sure, but can we also plan to stop updating these at some point? I mean, at what point do we actually treat them as deprecated instead of just in another folder that happens to be called deprecated-components?

I guess we do not validate the value in "href", that's why we did not caught the wrong template expansion?

We are, it's just that the lnks schema uses the uri-template string type to check the href value and ${some_string_here} is a valid uri-template according to RFC6570. There's not much we can do about that.

@tlvu
Copy link
Collaborator

tlvu commented Apr 8, 2024

at what point do we actually treat them as deprecated instead of just in another folder that happens to be called deprecated-components?

I guess at the point where it's expensive. I agree "expensive" is very vague so up to you I guess.

@fmigneault
Copy link
Collaborator Author

I did omit flyingpigeon on purpose due to deprecated, but as highlighted, it is fairly easy to update, so I can add it as well.
Will wait for a release that integrates the relevant updates to the schema to update the references.

@fmigneault
Copy link
Collaborator Author

We are, it's just that the lnks schema uses the uri-template string type to check the href value and ${some_string_here} is a valid uri-template according to RFC6570. There's not much we can do about that.

I don't think this is the cause.
According to JSON-schema format is just a hint, not an enforced validation, unless otherwise specified.

jsonschema.validate("^^^!!!! <<SO NOT AN URI>> ???", {"type": "string", "format": "uri-template"})  # OK

Looking up the format check in the validator confirms this (uri and uri-template not checked):

jsonschema.draft202012_format_checker
<FormatChecker checkers=['date', 'email', 'idn-email', 'idn-hostname', 'ipv4', 'ipv6', 'regex', 'uuid']>

So, the real fix would be to add a "pattern": "^https?://" explicitly.

@mishaschwartz
Copy link
Collaborator

According to JSON-schema format is just a hint, not an enforced validation, unless otherwise specified.

Ok that's good to know....

{
"rel": "service-meta",
"type": "application/vnd.oci.image.index.v1+json",
"href": "${FINCH_IMAGE_URI}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just my 2 cents, since the URI, do not start with http, should we name the new field "uri" instead of "href"? "href" would suggest starting with http usually. Ignore if it has to be "href" for compat or other reasons.

Copy link
Collaborator

Choose a reason for hiding this comment

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

"href" is required by the schema so we can't change the name

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A non-http scheme value is a valid URI. It uniquely identifies the resource.
I would prefer to have a docker:// scheme or similar to be more explicit if permitted, but docker does not seem to like it. However, the values provided in the defaults can be used directly (e.g. docker pull 'registry.hub.docker.com/pavics/weaver:5.0.0' works, but http://registry.hub.docker.com/pavics/weaver:5.0.0 doesn't), so I find them more useful although maybe counter-intuitive.

Maybe one way to avoid confusion would be to use index.docker.io/pavics/weaver:5.0.0 instead, since it does not redirect to https://hub.docker.com/ like registry.hub.docker.com does? This alternate location still woks with docker pull 'index.docker.io/pavics/weaver:5.0.0', and it looks slightly more like the type definition. The idea of this link is really to have the exact value that can be plugged in the docker-compose service image field.

…e contents with resolved defaults + use '' from service reference instead of global one
@github-actions github-actions bot added ci/deployment Related to deployment utilities and scripts ci/operations Continuous Integration components labels Apr 10, 2024
@github-actions github-actions bot added the ci/tests Issues or changes related to tests scripts label Apr 10, 2024
tests/test_deployment.py Outdated Show resolved Hide resolved
tests/test_deployment.py Show resolved Hide resolved
tests/requirements.txt Outdated Show resolved Hide resolved
# read and strip leading/trailing whitespaces
SERVICE_CONF="$(cat "${adir}/service-config.json" | sed -z 's/^\s*//;s/\s*$//')"
# merge whether config is an array or a single service
if [ "$(echo "${SERVICE_CONF}" | head -n 1)" = "[" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you just left the stac/service-config.json.template file as is, all of this wouldn't be necessary.

I don't understand why this is needed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Either this, or we patch everywhere that tries to load the JSON.
I add errors when trying to extract the $schema in the tests.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be the only place that tries to load the JSON.
The individual files are not meant to be read by anywhere else, their only purpose is to be concatenated by this script so that they can be displayed as one big list.

One of the reasons we had the files as they were before was so that we didn't have to complicate loading them into one big JSON list like this.

However, if we're going to got this route, I'd be in favour of using a proper json parsing tool like jq instead of hacking together JSON snippets with sed. jq has a docker image that we can use if necessary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I purposely went without the jq approach to avoid introducing this extra dependency since the merge is relatively simple in this case.

One issue with the pseudo-JSON is that it is not obvious (for others) that the incorrectly formed content is intentional to work only once merged. Especially when working with IDEs, or investigating the generated JSON on the server, we get flagged about invalid JSON, which doesn't help maintain them. Since there is a way to make them valid JSON definitions and still work for the aggregation, I would favor using a valid list.

birdhouse/components/thredds/default.env Outdated Show resolved Hide resolved
birdhouse/components/thredds/default.env Outdated Show resolved Hide resolved
"version": "${FINCH_VERSION}",
"types": [
"wps"
],
"keywords": [
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we going to do this in this PR or in a different one?

"name": "finch",
"version": "${FINCH_VERSION}",
"types": [
Copy link
Collaborator

Choose a reason for hiding this comment

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

This hasn't been implemented yet in the schema. Adding this won't cause schema validation to fail but do we plan on updating the schema before or after this PR is merged?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If the schema gets updated to include it beforehand, then we can bump its version right away. Otherwise, it can be done later. As mentioned, it doesn't cause an issue regardless at the moment since it is not validated.

birdhouse/components/hummingbird/default.env Show resolved Hide resolved
Copy link
Collaborator

@tlvu tlvu left a comment

Choose a reason for hiding this comment

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

LGTM. I have not done a deployment test to ensure all template expansions actually work. I also defer to @mishaschwartz to validate the content of the various .json files and the test.

# (see: https://github.com/crim-ca/stac-app/blob/40cad1aa7a094d58fca2d3184182761e248f781d/Dockerfile#L15-L20)
# which corresponds to 2.4.3 release
export STAC_VERSION=2.4.3-crim-main
export STAC_IMAGE='ghcr.io/crim-ca/stac-app:main'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just curious, why not push the image with the actual tag 2.4.3-crim instead of the generic tag main?

Copy link
Collaborator

Choose a reason for hiding this comment

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

See #371 and #346

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I could temporarily push a tag to make the reference more "semver"-like, but like @mishaschwartz highlighted, I would much rather have some work done on using the official image. The one tagged is already 9 months old. I don't want this patch tag to be considered a maintained revision.

# which is some commits ahead of 'v3.0.0-beta.5' (and multiple behind latest official releases)
# version name is slightly tweaked to fulfill schema while leaving an obvious trace
export STAC_BROWSER_VERSION=3.0.0-beta.5-crim-docker-image-push
export STAC_BROWSER_IMAGE='ghcr.io/crim-ca/stac-browser:docker_image_push'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, 3.0.0-beta.5-crim instead of docker_image_push. It is allowed to tag while on a branch.

@fmigneault
Copy link
Collaborator Author

run tests

Copy link
Collaborator

@mishaschwartz mishaschwartz left a comment

Choose a reason for hiding this comment

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

Looks good! Just double checking if there's still more keywords to add or not (see comment here: #445 (comment))

@fmigneault
Copy link
Collaborator Author

For the moment, 1.2.0 still refers to keywords as only a specific set of values. Do you want to push a 1.3.0 right away with updated definitions allowing any value, and using types instead for the specific service type allowed?

@mishaschwartz
Copy link
Collaborator

Right, we're still discussing it here: DACCS-Climate/Marble-node-registry#39

Ok nevermind then

@fmigneault fmigneault merged commit 5a54a1f into master Apr 18, 2024
3 of 4 checks passed
@fmigneault fmigneault deleted the add-service-versions branch April 18, 2024 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/deployment Related to deployment utilities and scripts ci/operations Continuous Integration components ci/tests Issues or changes related to tests scripts component/geoserver Related to GeoServer or one of its underlying services component/jupyterhub Related to JupyterHub as development frontend with notebooks component/STAC Features or components related to STAC component/THREDDS Features or components related to THREDDS component/weaver Related to https://github.com/crim-ca/weaver documentation Improvements or additions to documentation feature/node-registry Related to https://github.com/DACCS-Climate/DACCS-node-registry feature/WPS Feature or service related to Web Processing Service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💡 [Feature] Provide component service version
3 participants