janus-idp / backstage-plugins

Plugins for Backstage
https://janus-idp.io
Apache License 2.0
126 stars 127 forks source link

Create a Dynamic Plugins Guide #953

Open nickboldt opened 7 months ago

nickboldt commented 7 months ago

What do you want to improve?

We need a guide to how dynamic plugins work

What does the current documentation state?

Nothing about dynamic plugins / installation.

What would you like to be added/updated in the documentation?

Draft from Tom's message in slack:

The "dynamic plugins" are completely separate from "declarative integration". They are complementary, yes, however the relation is a bit more complicated: The upstream "declarative integration" system is not fully implemented. Its implementation deviated pretty heavily from the RFC and we can't be building something on an ever changing unstable and incomplete API. Therefore we implement our own similar logic to achieve similar results without all the under the hood changes in Backstage core, using the current Backstage core facilities. The "dynamic plugins" allows you to sideload plugins into a containerized instance. That means - to add a plugin you do not have to recompile your codebase and rebuild container. In contrast, "declarative integration" is totally oblivious to this and works with local runtime only e.g. the plugin already has to be part of the codebase (installed as a NPM) and bundled in the application in order to configure it's placement. You can't decide to add a plugin later, not without of the cost of producing a new image. With "dynamic plugins" we do not require the plugin to be present in build time, we pull it in, sideload it into the runtime and that's it. In addition to that, we offer similar features as "declarative integration" by allowing users to define UI element placements etc. - because just loading something is useless unless you surface it to users, right? And again, since the "declarative integration" is not complete at this moment, we can't rely on it so we have built our own solution. "Dynamic plugins" are a Janus/RHDH only solution at this point and our intention is to bring the same to upstream and introduce the "dynamic plugins" on top of "declarative intergation" for upstream Backstage. One additional way to look at this is - "declarative integration" is a brand new frontend system they want to introduce upstream. It requires both instance and plugin code changes. These changes are quite substantial and breaking. On the other hand "dynamic plugins" do not require any code changes for 90% of the plugins and should work out of the box. From plugin developer point of view it only requires you to produce additional set of assets and have a compatible core instance. However as I said before, the current "dynamic plugins" implementation is for Janus/RHDH only - so only instanced based on our codebase are compatible with such plugins at the moment. Other instances will not work.

nickboldt commented 7 months ago

See also https://github.com/janus-idp/backstage-showcase/blob/main/showcase-docs/dynamic-plugins.md