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

Create an image to load schemas into the ConfigDB #61

Merged
merged 6 commits into from
Oct 15, 2024

Conversation

amrc-benmorrow
Copy link
Contributor

Create a Dockerfile which builds an image, to be run from service-setup, which loads the current set of schemas into the ConfigDB.

Schema information is loaded under two different ConfigDB Apps: one contains the actual schema, the other contains the metadata (name, version and so on) the Manager needs to display the schema selection screen.

The $id and $ref fields of the schemas are rewritten to use URLs under the urn:uuid: scheme. This URL scheme simply names a UUID without providing any address information. It will be necessary to have direct access to the schema UUID so that refs can be followed to other schemas. If necessary this can be changed to some other scheme; there are various possibilities, from a well-known scheme using factoryplus.app.amrc.co.uk to working out the ConfigDB URL of the schema config entry itself. But this is simpler and I think will be sufficient for now.

If we want to load the schemas into the ConfigDB they cannot keep their
current $ids. There is no straightforward way to resolve an $id under
https://raw.githubusercontent.com into a ConfigDB entry. Create a script
to be run from the Dockerfile which fixes up the schemas themselves and
extracts the metadata the Manager will need later.

For now give the metric schemas $ids using the urn:uuid: scheme. I'm not
sure this will be the best policy going forward, as now we have both
metric schemas and ConfigDB app schemas using this format; in principle
there could be overlap. We could allocate a well-known metric schema
base URL under factoryplus.app.amrc.co.uk, or something. In practice
there won't be a problem as resolving code will always know which type
of schema it's looking for.

Try where possible to identify schema problems at build time. We really
don't want a bad schema build getting pushed out to installations.
The Service schema has a $ref which doesn't follow the standard format.
This schema is never used from within the Manager so this hasn't been
picked up before.
This relies on the tidied up schema file generated by find-schemas.

We can't simply call the dump-load endpoint as the ConfigDB rejects the
request with 'request entity too large'. So just go one at a time.
This builds an image containing the information needed to import the
schemas into the ConfigDB.
* Rename the Metric Schema app to JSON Schema. We can find usable metric
  schemas from the Metric Schema Info app giving name and version.
* Create a Private Configuration class; the cluster manager could also
  use this for the bootstrap and template entries.
* Push the Manager's private schemas as Private Configuration entries.
We get this from the git history. It would be possible to record author
information too.
@amrc-benmorrow amrc-benmorrow changed the base branch from main to bmz/monorepo October 15, 2024 11:20
@amrc-benmorrow amrc-benmorrow merged commit 21d0eb5 into bmz/monorepo Oct 15, 2024
1 check passed
@amrc-benmorrow amrc-benmorrow deleted the bmz/service-setup branch October 15, 2024 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant