shacl-vue/docs/deploy-multi-tenant.md
Stephan Heunis 64f7aad4ed
All checks were successful
Deploy on webserver / Build docs and deploy (push) Successful in 34s
Build shacl-vue / build (push) Successful in 48s
docs: update deployment features documentation
2026-11-05 21:35:32 +02:00

3.8 KiB

layout
doc

Deployment feature: Multi-tenant system

shacl-vue can be used in a multi-tenant system where a single UI deployment feeds multiple user bases via separate configuration sources. This is possible because of shacl-vue's dynamic approach to configuration loading, which happens in the browser on app start-up. The main benefit of using a multi-tenant approach is that only a single shacl-vue needs to be maintained, even while the separate tenants could be driven by diverging or completely unrelated schemas and configurations.

Forjego- and Caddy-based example

An example of an existing tenant deployment is the integrated Forgejo-Caddy-shacl-vue setup at https://cerebra.fz-juelich.de/. A tenant (either a user or an organization of the Forgejo instance) can create a repository containing a custom config file in a dedicated dlocation (<repo>/config_mui1.yaml). This config file can specify all shacl-vue configuration options (SHACL schema source, dumpthings integration endpoints, UI customizations, etc) that will drive the tenant-specific interface. A single shacl-vue instance is built and deployed and served at a path of the Forgejo domain, here https://cerebra.fz-juelich.de/~mui/1 (with the mui being short for "metadata UI" and the 1 referring to a build version). Importantly, the tenant's UI can then be accessed at a relative path using the user/org and repo names as arguments: https://cerebra.fz-juelich.de/~mui/1/<org-or-user>/<repo>/. The webserver takes care of interpreting the <org-or-user> and <repo> arguments, constructing the URL to the tenant-specified config file, and passing that back to the browser such that the config can be fetched in order to render the tenant-specific UI in the browser.

Below we highlight the necessary components of such a multi-tenant deployment, and explain how they work:

1. A shacl-vue deployment

The https://cerebra.fz-juelich.de/service/mui repository serves as the build source for such a deployment. It has shacl-vue as a submodule, a shacl-vue config file that points to a base config file, and a workflow to build and publish the shacl-vue instance. Here the built sources are uploaded as a Forgejo package, from where it is retrieved in order to be served by a web server.

2. A tenant-specified configuration

https://cerebra.fz-juelich.de/s.heunis/my-ui-test is a minimal example of a tenant's specification. It contains a config file, which is the only hard requirement. That specific config file only points to a base config that will be loaded during app startup in the browser, but it can also contain any other supported shacl-vue config options.

3. A server providing the x-shacl-vue-config header

Our webserver is Caddy. It's job in the tenant setup is to:

  • parse the <org-or-user> and <repo> arguments from the browser supplied URL
  • build a URL pointing to the associated config file supplied by the tenant
  • provide that URL in the x-shacl-vue-config header that is part of the response to a HEAD request made by shacl-vue in the browser

shacl-vue prioritizes config URLs supplied via this header x-shacl-vue-config, which means the browser now knows where to load its config from, and the user will see a custom UI based on the URL-supplied arguments, all driven by a single shacl-vue instance.