During boot, the install-dynamic-plugins container reads the contents of the plugin configuration file and activates, configures, or downloads any plugins listed. RHDH Local supports two ways of specifying dynamic plugin configuration:
-
Default path:
configs/dynamic-plugins/dynamic-plugins.yaml -
User override path:
configs/dynamic-plugins/dynamic-plugins.override.yamlorconfigs/dynamic-plugins.yamlIf present, this file will automatically override the default and be used by theinstall-dynamic-pluginscontainer.configs/dynamic-plugins/dynamic-plugins.override.yamltakes precedence overconfigs/dynamic-plugins.yaml.
In addition, the local-plugins directory is mounted into the install-dynamic-plugins container at /opt/app-root/src/local-plugins. Any plugins placed there can be activated/configured the same way (without downloading).
To load dynamic plugins from your local machine:
- Copy the dynamic plugin binary file into the
local-pluginsdirectory. - Make sure permissions allow the container to read the files (e.g.
chmod -R 777 local-pluginsfor quick testing). - Configure your plugin in one of the supported config files:
- Prefer
configs/dynamic-plugins/dynamic-plugins.override.yamlfor local user overrides. - If no override file is present,
configs/dynamic-plugins/dynamic-plugins.yamlwill be used.
- Prefer
- See Changing Your Configuration for more on updating and reloading configs.
If you're installing dynamic plugins from a private registry or using a proxy, you can customize your own .npmrc file. A .npmrc.example file is provided in the configs/ directory as a template.
-
Copy the example file to create your own
.npmrc:cp configs/.npmrc.example configs/.npmrc
-
Open the newly created
.npmrcfile and add your configuration, such as private registry URLs or authentication tokens://registry.npmjs.org/:_authToken=YOUR_TOKEN registry=https://your-private-registry.example.com/
When present, this .npmrc file will be automatically mounted into the install-dynamic-plugins container, and the NPM_CONFIG_USERCONFIG environment variable will be set to point to it.
If you don't create a .npmrc, plugin installation will still work using the default public registry settings.
For more information on configuring
.npmrc, see the npm configuration docs.
You can use RHDH-local with a debugger to debug your backend plugins in VSCode. The Node.js debugger is exposed on port 9229. Here is how:
-
Start RHDH-local
# in rhdh-local directory podman compose up -d -
Open your plugin source code in VSCode
-
Export plugin an RHDH "dynamic" plugin
# in plugin source code directory npx @janus-idp/cli@latest package export-dynamic-plugin -
Copy exported derived plugin package to
dynamic-plugins-rootdirectory in therhdhcontainer.# in plugin source code directory podman cp dist-dynamic rhdh:/opt/app-root/src/dynamic-plugins-root/<your-plugin-name>
-
If your plugin requires configuration, add it to the
app-config.local.yamlfile in your clonedrhdh-localdirectory. -
Restart the
rhdhcontainer# in rhdh-local directory podman compose stop rhdh podman compose start rhdh -
Configure VSCode debugger to attach to the
rhdhcontainer..vscode/launch.jsonexample:{ "version": "0.2.0", "configurations": [ { "name": "Attach to Process", "type": "node", "request": "attach", "port": 9229, "localRoot": "${workspaceFolder}", "remoteRoot": "/opt/app-root/src/dynamic-plugins-root/<your-plugin-name>", } ] } -
Now, you can start debugging your plugin using VSCode debugger. Source mapping should work, and you should be able to put breakpoints to your TypeScript files. If it doesn't work, most likely you need to adjust
localRootandremoteRootpaths inlaunch.json.Every time you make changes to your plugin source code, you need to repeat steps 3-6.
Follow these steps to preview and test development changes for your frontend plugin in RHDH local:
-
Ensure a clean start by running the following command:
podman compose down -v
-
Create the dynamic plugins root directory where you will place your exported plugins:
mkdir dynamic-plugins-root
-
Inside your plugin directory, run the following command to export your plugin:
npx @janus-idp/cli@latest package export-dynamic-plugin --dev --dynamic-plugins-root <path_to_dynamic-plugins-root_in_rhdh-local_folder>
-
Add the plugin configuration for the plugin you want to develop into the
app-config.local.yamlfile under thedynamicPluginskey. Avoid adding this configuration to thedynamic-plugins.override.yamlfile. You can add additional plugins into thedynamic-plugins.override.yamlfile, but the one you are developing should be in theapp-config.local.yamlfile. -
Use the
compose-dynamic-plugins-root.yamloverride file to start RHDH local:podman compose -f compose.yaml -f compose-dynamic-plugins-root.yaml up
-
Verify that your plugin appears in RHDH.
-
To apply code changes to your plugin, rerun the command in step 3 and refresh your browser. No need to restart any containers.