Design of multi-tenant-based access to a single shacl-vue deployment #387

Closed
opened 2026-09-03 15:08:32 +00:00 by jsheunis · 3 comments
Owner

The context for this issue is the following:

We need to move to a position, where we consider the entire stack more as an interoperable/compatible system.

We need to be able to have ONE deployment of this stack that can serve many independent consumers. All while keeping "tenant-separation" in mind.

[it should be] possible to have ONE dumpthings backend API to serve many users, just as much as one forgejo can do that. Same for shacl-vue. Have one deployment with properly factored out config sourced from a consumer specific location.

E.g. https://pool.cerebra.fz-juelich.de/<forgejo-org>/{api|ui}, where <forgejo-org> is the key for making both dumpthings and shacl-vue access the respective forgejo site and org, and a dedicated repo (maybe with a standard name) that hosts the actual config.

This puts the org owner in the pilot seat.

Somehow the tools need to be allowed to read the config from private repos. Maybe we will have a dedicated forgejo user that org owners can give read access to, and where the deployments of the tools can operate with adequate access tokens for that user.

So the idea would be to have a single shacl-vue deployment attached to a single forgejo deployment, and the UI would be accessible via e.g. https://pool.cerebra.fz-juelich.de/<forgejo-org>/ui. Some initial thoughts:

  1. Our "single deployment" would probably be many concurrent deployments of the latest X number of versions of shacl-vue, which would allow tenants to specify which UI version they want to use; my feeling is that this should also be part of the URL path, e.g. https://pool.cerebra.fz-juelich.de/<forgejo-org>/ui/v2.0.2. This would allow us to build a single deployment workflow that could automatically deposit the shacl-vue build files at a version-specific path.
  2. The suggested URL path approach (base url, then <forgejo-org>, then ui) implies the need for routing, because our single shacl-vue deployment wouldn't physically live at https://pool.cerebra.fz-juelich.de/<forgejo-org>/ui, because that would be at the tenant level and we want a single deployment for all tenants, e.g. at https://pool.cerebra.fz-juelich.de/ui. Unless I'm missing some important detail, I think a simpler approach (one that doesn't need another component to handle routing) would be to use e.g. https://pool.cerebra.fz-juelich.de/ui/v2.3.4/?forgejo-org=<forgejo-org>. This way the single shacl-vue deployment can be accessed at a single (version-specific) location without routing, and the shacl-vue app itself will do the work of extracting the forgejo-org and then fetching the dedicated config. This implies shacl-vue should gain the ability know that a forgejo-org URL query param means it should fetch a configuration file somewhere in a forgejo repo. I wonder if such a forgejo-specific feature is the way to go, or if it should be somehow more generic.
  3. Authorization also becomes a question: should shacl-vue need to access a config file in a private forgejo repository, how would it receive the necessary credentials to add to the GET request? This wouldn't come from the client-side, so would we need to implement a server side component for this? Or should we decide from the start that all shacl-vue config files should be publicly accessible?
The context for this issue is the following: > We need to move to a position, where we consider the entire stack more as an interoperable/compatible system. > > We need to be able to have ONE deployment of this stack that can serve many independent consumers. All while keeping "tenant-separation" in mind. > > [it should be] possible to have ONE dumpthings backend API to serve many users, just as much as one forgejo can do that. Same for `shacl-vue`. Have one deployment with properly factored out config sourced from a consumer specific location. > > E.g. `https://pool.cerebra.fz-juelich.de/<forgejo-org>/{api|ui}`, where `<forgejo-org>` is the key for making both dumpthings and shacl-vue access the respective forgejo site and org, and a dedicated repo (maybe with a standard name) that hosts the actual config. > > This puts the org owner in the pilot seat. > > Somehow the tools need to be allowed to read the config from private repos. Maybe we will have a dedicated forgejo user that org owners can give read access to, and where the deployments of the tools can operate with adequate access tokens for that user. So the idea would be to have a single `shacl-vue` deployment attached to a single forgejo deployment, and the UI would be accessible via e.g. `https://pool.cerebra.fz-juelich.de/<forgejo-org>/ui`. Some initial thoughts: 1. Our "single deployment" would probably be many concurrent deployments of the latest X number of versions of `shacl-vue`, which would allow tenants to specify which UI version they want to use; my feeling is that this should also be part of the URL path, e.g. `https://pool.cerebra.fz-juelich.de/<forgejo-org>/ui/v2.0.2`. This would allow us to build a single deployment workflow that could automatically deposit the `shacl-vue` build files at a version-specific path. 2. The suggested URL path approach (base url, then `<forgejo-org>`, then `ui`) implies the need for routing, because our single `shacl-vue` deployment wouldn't physically live at `https://pool.cerebra.fz-juelich.de/<forgejo-org>/ui`, because that would be at the tenant level and we want a single deployment for all tenants, e.g. at `https://pool.cerebra.fz-juelich.de/ui`. Unless I'm missing some important detail, I think a simpler approach (one that doesn't need another component to handle routing) would be to use e.g. `https://pool.cerebra.fz-juelich.de/ui/v2.3.4/?forgejo-org=<forgejo-org>`. This way the single shacl-vue deployment can be accessed at a single (version-specific) location without routing, and the `shacl-vue` app itself will do the work of extracting the `forgejo-org` and then fetching the dedicated config. This implies `shacl-vue` should gain the ability know that a `forgejo-org` URL query param means it should fetch a configuration file somewhere in a forgejo repo. I wonder if such a forgejo-specific feature is the way to go, or if it should be somehow more generic. 3. Authorization also becomes a question: should `shacl-vue` need to access a config file in a private forgejo repository, how would it receive the necessary credentials to add to the GET request? This wouldn't come from the client-side, so would we need to implement a server side component for this? Or should we decide from the start that all `shacl-vue` config files should be publicly accessible?
Author
Owner

In a discussion with @cmo and @bpoldrack the need for a server-side component to handle routing and possible (credential-based) config fetching came up again. A reason for shifting such a tool's implementation outside the scope of shacl-vue would be to not overfit shacl-vue's design to the multi-tenant forgejo-based integration. Ideally, shacl-vue should be usable with a standard api in any context, and without having to implement new support for an additional use-case every time these arise. However, shacl-vue still needs to support this "standard API". More specifically: shacl-vue should gain the ability to receive its configuration (either a json object or a URL) from an external source upon startup. And in the general case this means: a shacl-vue deployment should be able to receive arguments that are unknown before build time.

There could be different ways to achieve this. Here are ones that I could think of:

  1. add the URL for the external config to the shacl-vue deployment URL query parameters, e.g.
https://pool.cerebra.fz-juelich.de/ui/v2.3.4/?config-url=https://my-forgejo-deployment/my-tenant-org/my-config-repo/shacl-vue.yaml

This assumes that the config file is publicly accessible via http request. I am not concerned about this parameter clogging the url and causing bad UX because shacl-vue could be updated to read the URL query parameter on startup and then clearing it as soon as it has been used to fetch the config. I do think, though, that adding the full config object to the url is too majestic and trigger happy.

  1. Inject the config url or config into the HTML before it is served back to the client, e.g.:
    <script>
        window.__APP_CONFIG__ = {
            "configUrl": "https://my-forgejo-deployment/my-tenant-org/my-config-repo/shacl-vue.yaml"
        };
    </script>

This definitely would require a server-side intervention. Then shacl-vue could be updated to always check if the application has an embedded config attached to the window object, and make that take preference above the current standard way of providing a config file.

In a discussion with @cmo and @bpoldrack the need for a server-side component to handle routing and possible (credential-based) config fetching came up again. A reason for shifting such a tool's implementation outside the scope of `shacl-vue` would be to not overfit `shacl-vue`'s design to the multi-tenant forgejo-based integration. Ideally, `shacl-vue` should be usable with a standard api in any context, and without having to implement new support for an additional use-case every time these arise. However, `shacl-vue` still needs to support this "standard API". More specifically: `shacl-vue` should gain the ability to receive its configuration (either a json object or a URL) from an external source upon startup. And in the general case this means: a `shacl-vue` deployment should be able to receive arguments that are unknown before build time. There could be different ways to achieve this. Here are ones that I could think of: 1. add the URL for the external config to the `shacl-vue` deployment URL query parameters, e.g. ``` https://pool.cerebra.fz-juelich.de/ui/v2.3.4/?config-url=https://my-forgejo-deployment/my-tenant-org/my-config-repo/shacl-vue.yaml ``` This assumes that the config file is publicly accessible via http request. I am not concerned about this parameter clogging the url and causing bad UX because `shacl-vue` could be updated to read the URL query parameter on startup and then clearing it as soon as it has been used to fetch the config. I do think, though, that adding the full config object to the url is too majestic and trigger happy. 2. Inject the config url or config into the HTML before it is served back to the client, e.g.: ```html <script> window.__APP_CONFIG__ = { "configUrl": "https://my-forgejo-deployment/my-tenant-org/my-config-repo/shacl-vue.yaml" }; </script> ``` This definitely would require a server-side intervention. Then `shacl-vue` could be updated to always check if the application has an embedded config attached to the `window` object, and make that take preference above the current standard way of providing a config file.
Author
Owner

It was trivial to implement option 1. Demo:

It was trivial to implement option 1. Demo: <video src="/attachments/5aa3ab2d-603b-4cb9-9713-6155ec371d36" title="config_param" controls></video>
Author
Owner

53e5b0f5e1 (and later updates) introduced the ability to get the config url from the x-shacl-vue-config header in a HEAD request to the deployment's own base URL.

The multi-tenant system was designed on the server-side to grab parameters from the original url, e.g. https://hub.trr379.de/~mui/1/dfgsurvey/2026/ where the parameters are:

  • organization: dfgsurvey
  • repo: 2026

and then grab a shacl-vue.yaml file from that repo, then return the content of this config file in the response header x-shacl-vue-config.

These parameter grabbing and rerouting steps are all done server-side by caddy.

https://hub.psychoinformatics.de/orinoco/shacl-vue/commit/53e5b0f5e11350051efcc7f1f90b402e24de2910 (and later updates) introduced the ability to get the config url from the `x-shacl-vue-config` header in a HEAD request to the deployment's own base URL. The multi-tenant system was designed on the server-side to grab parameters from the original url, e.g. `https://hub.trr379.de/~mui/1/dfgsurvey/2026/` where the parameters are: - organization: `dfgsurvey` - repo: `2026` and then grab a `shacl-vue.yaml` file from that repo, then return the content of this config file in the response header `x-shacl-vue-config`. These parameter grabbing and rerouting steps are all done server-side by `caddy`.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
orinoco/shacl-vue#387
No description provided.