Skip to content

Commit e272fc8

Browse files
committed
review suggestions incorporated
1 parent 73ef08e commit e272fc8

15 files changed

+364
-329
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[id="assembly-install-third-party-plugins-rhdh"]
2+
= Installing third-party plugins in {product}
3+
:context: assembly-install-third-party-plugins-rhdh
4+
5+
You can install a third-party plugins in {product} without rebuilding the {product-very-short} application.
6+
7+
The location of the `dynamic-plugin-config.yaml` file depends on the deployment method. For more details, refer to xref:proc-config-dynamic-plugins-rhdh-operator_rhdh-installing-rhdh-plugins[] and xref:con-install-dynamic-plugin-helm_rhdh-installing-rhdh-plugins[].
8+
9+
Plugins are defined in the `plugins` array within the `dynamic-plugin-config.yaml` file. Each plugin is represented as an object with the following properties:
10+
11+
* `package`: The plugin's package definition, which can be an OCI image, a TGZ file, a JavaScript package, or a directory path
12+
* `disabled`: A boolean value indicating whether the plugin is enabled or disabled.
13+
* `integrity`: The integrity hash of the package, required for TGZ file and JavaScript packages.
14+
* `pluginConfig`: The plugin's configuration. For backend plugins, this is optional; for frontend plugins, it is required. The `pluginConfig` is a fragment of the `app-config.yaml` file, and any added properties are merged with the {product-very-short} `app-config.yaml` file.
15+
16+
[NOTE]
17+
====
18+
You can also load dynamic plugins from a plain directory, though this is intended for development or testing purposes and is not recommended for production, except for plugins included in the {product-very-short} container image.
19+
====
20+
21+
//OCI image
22+
include::../modules/dynamic-plugins/proc-load-plugin-oci-image.adoc[leveloffset=+2]
23+
24+
//TGZ file
25+
include::../modules/dynamic-plugins/proc-load-plugin-tgz-file.adoc[leveloffset=+2]
26+
27+
//JavaScript package
28+
include::../modules/dynamic-plugins/proc-load-plugin-js-package.adoc[leveloffset=+2]
29+
30+
//example third-party plugin installation
31+
include::../modules/dynamic-plugins/ref-example-third-party-plugin-installation.adoc[leveloffset=+2]
32+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[id="assembly-package-publish-third-party-dynamic-plugin"]
2+
= Packaging and publishing third-party plugins as dynamic plugins
3+
:context: assembly-package-publish-third-party-dynamic-plugin
4+
5+
After xref:proc-export-third-party-plugins-rhdh_assembly-third-party-plugins[exporting a third-party plugin], you can package the derived package into one of the following supported formats:
6+
7+
* Open Container Initiative (OCI) image (recommended)
8+
* TGZ file
9+
* JavaScript package
10+
11+
[IMPORTANT]
12+
====
13+
Exported dynamic plugin packages must only be published to private NPM registries.
14+
====
15+
16+
//OCI image
17+
include::../modules/dynamic-plugins/proc-create-plugin-oci-image.adoc[leveloffset=+2]
18+
19+
//TGZ file
20+
include::../modules/dynamic-plugins/proc-create-plugin-tgz-file.adoc[leveloffset=+2]
21+
22+
//JavaScript package
23+
include::../modules/dynamic-plugins/proc-create-plugin-js-package.adoc[leveloffset=+2]

assemblies/dynamic-plugins/assembly-third-party-plugins-installation.adoc

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[id="assembly-third-party-plugins"]
2+
= Third-party plugins in {product}
3+
:context: assembly-third-party-plugins
4+
5+
You can integrate third-party dynamic plugins in {product}. This flexibility allows you to enhance the platform functionality without modifying its source code and rebuilding. To add third-party dynamic plugins, you can export them as derived package.
6+
7+
While exporting the plugin package, you must ensure that dependencies are correctly bundled or marked as shared, depending on their relationship to the {product-short} environment.
8+
9+
To integrate a third-party plugin into {product-short}:
10+
11+
. First, obtain the plugin's source code.
12+
. Export the plugin as a dynamic plugin package. See xref:proc-export-third-party-plugins-rhdh_assembly-third-party-plugins[].
13+
. Package and publish the dynamic plugin. See xref:assembly-package-publish-third-party-dynamic-plugin[].
14+
. Install the plugin in the {product-short} environment. See xref:assembly-install-third-party-plugins-rhdh[].
15+
16+
//Export third-party plugins
17+
include::../modules/dynamic-plugins/proc-export-third-party-plugins-rhdh.adoc[leveloffset=+2]
18+
19+
//package and publish third-party plugins
20+
include::assembly-package-publish-third-party-dynamic-plugin.adoc[leveloffset=+1]
21+
22+
//Install third-party plugin
23+
include::assembly-install-third-party-plugins-rhdh.adoc[leveloffset=+1]
24+
25+
26+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[id="proc-create-plugin-js-package_{context}"]
2+
= Creating a JavaScript package with dynamic packages
3+
4+
[WARNING]
5+
====
6+
The derived dynamic plugin JavaScript packages must not be published to the public NPM registry. If you must publish to the NPM registry, use a private registry.
7+
====
8+
9+
.Prerequisites
10+
* You have exported a third-party dynamic plugin package. For more information, see xref:proc-export-third-party-plugins-rhdh_assembly-third-party-plugins[].
11+
12+
.Procedure
13+
. Navigate to the `dist-dynamic` directory.
14+
. Run the following command to publish the package to your private NPM registry:
15+
+
16+
--
17+
.Example command to publish a plugin package to an NPM registry
18+
[source,bash]
19+
----
20+
npm publish --registry <npm_registry_url>
21+
----
22+
23+
[TIP]
24+
====
25+
You can add the following to your `package.json` file before running the `export` command:
26+
27+
.Example `package.json` file
28+
[source,json]
29+
----
30+
{
31+
"publishConfig": {
32+
"registry": "<npm_registry_url>"
33+
}
34+
}
35+
----
36+
37+
If you modify the `publishConfig` after exporting the dynamic plugin, re-run the `export-dynamic-plugin` command to ensure the correct configuration is included.
38+
====
39+
--
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[id="proc-create-plugin-oci-image_{context}"]
2+
= Creating an OCI image with dynamic packages
3+
4+
.Prerequisites
5+
* You have installed `podman` or `docker`.
6+
* You have exported a third-party dynamic plugin package. For more information, see xref:proc-export-third-party-plugins-rhdh_assembly-third-party-plugins[].
7+
8+
.Procedure
9+
. Navigate to the plugin's root directory (not the `dist-dynamic` directory).
10+
. Run the following command to package the plugin into an OCI image:
11+
+
12+
--
13+
.Example command to package an exported third-party plugin
14+
[source,bash]
15+
----
16+
npx @janus-idp/cli@latest package package-dynamic-plugins --tag quay.io/example/image:v0.0.1
17+
----
18+
19+
In the previous command, the `--tag` argument specifies the image name and tag.
20+
--
21+
. Run one of the following commands to push the image to a registry:
22+
+
23+
--
24+
.Example command to push an image to a registry using podman
25+
[source,bash]
26+
----
27+
podman push quay.io/example/image:v0.0.1
28+
----
29+
30+
.Example command to push an image to a registry using docker
31+
[source,bash]
32+
----
33+
docker push quay.io/example/image:v0.0.1
34+
----
35+
36+
The output of the `package-dynamic-plugins` command provides the plugin's path for use in the `dynamic-plugin-config.yaml` file.
37+
--
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
[id="proc-create-plugin-tgz-file_{context}"]
2+
= Creating a TGZ file with dynamic packages
3+
4+
.Prerequisites
5+
* You have exported a third-party dynamic plugin package. For more information, see xref:proc-export-third-party-plugins-rhdh_assembly-third-party-plugins[].
6+
7+
.Procedure
8+
. Navigate to the `dist-dynamic` directory.
9+
. Run the following command to create a `tgz` archive:
10+
+
11+
--
12+
.Example command to create a `tgz` archive
13+
[source,bash]
14+
----
15+
npm pack
16+
----
17+
You can obtain the integrity hash from the output of the `npm pack` command by using the `--json` flag as follows:
18+
19+
.Example command to obtain the integrity hash of a `tgz` archive
20+
[source,bash]
21+
----
22+
npm pack --json | head -n 10
23+
----
24+
--
25+
26+
. Host the archive on a web server accessible to your {product-very-short} instance, and reference its URL in the `dynamic-plugin-config.yaml` file as follows:
27+
+
28+
--
29+
.Example `dynamic-plugin-config.yaml` file
30+
[source,yaml]
31+
----
32+
plugins:
33+
- package: https://example.com/backstage-plugin-myplugin-1.0.0.tgz
34+
integrity: sha512-<hash>
35+
----
36+
--
37+
. Run the following command to package the plugins:
38+
+
39+
--
40+
.Example command to package a dynamic plugin
41+
[source,bash]
42+
----
43+
npm pack --pack-destination ~/test/dynamic-plugins-root/
44+
----
45+
46+
[TIP]
47+
====
48+
To create a plugin registry using HTTP server on {ocp-short}, run the following commands:
49+
50+
.Example commands to build and deploy an HTTP server in {ocp-short}
51+
[source,bash]
52+
----
53+
oc project rhdh
54+
oc new-build httpd --name=plugin-registry --binary
55+
oc start-build plugin-registry --from-dir=dynamic-plugins-root --wait
56+
oc new-app --image-stream=plugin-registry
57+
----
58+
====
59+
--
60+
61+
. Configure your {product-very-short} to use plugins from the HTTP server by editing the `dynamic-plugin-config.yaml` file:
62+
+
63+
--
64+
.Example configuration to use packaged plugins in {product-very-short}
65+
[source,yaml]
66+
----
67+
plugins:
68+
- package: http://plugin-registry:8080/backstage-plugin-myplugin-1.9.6.tgz
69+
----
70+
--

modules/dynamic-plugins/proc-export-third-party-plugins-rhdh.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[id="proc-export-third-party-plugins-rhdh_{context}"]
22
= Exporting third-party plugins in {product}
33

4-
To use plugins in {product}, the plugins must be exported as derived dynamic plugin package. These packages contain the plugin code and dependencies, ready for dynamic plugin integration into {product-short}.
4+
To use plugins in {product}, you can export plugins as derived dynamic plugin packages. These packages contain the plugin code and dependencies, ready for dynamic plugin integration into {product-short}.
55

66
Backend plugins::
77
+
@@ -118,7 +118,7 @@ The resulting derived package will be located in the `dist-dynamic` subfolder. T
118118

119119
[WARNING]
120120
====
121-
The derived dynamic plugin JavaScript packages must not be published to the public NPM registry. For more appropriate packaging options, see xref:proc-package-third-party-dynamic-plugin_{context}[]. If you must publish to the NPM registry, use a private registry.
121+
The derived dynamic plugin JavaScript packages must not be published to the public NPM registry. For more appropriate packaging options, see xref:assembly-package-publish-third-party-dynamic-plugin[]. If you must publish to the NPM registry, use a private registry.
122122
====
123123

124124

0 commit comments

Comments
 (0)