Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Add info about dependencies for local development #1375

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
34 changes: 34 additions & 0 deletions docusaurus/docs/get-started/set-up-development-environment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: Set up your development environment with Docker for Grafana plugin
- continuous integration
- automation
- configuration
- dependency
sidebar_position: 20
---

Expand Down Expand Up @@ -439,3 +440,36 @@ Update the `scripts` in the `package.json` to use the extended Webpack configura
-"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",
+"dev": "webpack -w -c ./webpack.config.ts --env development",
```
## Add a dependency for local development
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Add a dependency for local development
## Add a plugin as a dependency for local development


Grafana’s plugin development environment is designed to allow for plugins to be dependent upon other plugins if necessary. Here’s how it operates:

Plugin distribution path:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Plugin distribution path:
Plugins location directory:


Refer to [Grafana documentation](https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#plugins) for the plugin's location, which can vary depending on your system and development environment.

Plugin initialization:

When the Grafana server starts, its plugin loader runs a [Load](https://github.com/grafana/grafana/blob/b53f14ca83eeec6b0f624c2dbbaa417d08bbadbf/pkg/plugins/manager/loader/loader.go#L55-L56) function. This scans the defined [plugins directory](https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#plugins) for plugins, validates `plugin.json` files, checks signatures and manifests, and initializes valid plugins.

Plugin dependency management:

Although some validations occur on the server side, the plugin path itself doesn't include validation of other plugins your plugin may be dependent upon. You are responsible for ensuring that your plugin's dependencies are correctly managed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is not clear, I don't really understand what is trying to tell me.

Is it telling me I am responsible of installing the plugin dependencies myself? or is it telling me that I am responsible of putting the dependencies in the correct path? or something else?


To manage dependencies during local plugin development, you can use one of the following methods:

### Use the `GF_INSTALL_PLUGINS` environment variable

* Add dependencies explicitly to your Grafana instance with `GF_INSTALL_PLUGINS=dependency`.

For example:

`GF_INSTALL_PLUGINS=grafana-clock-panel`

tells Grafana to install that the clock panel plugin.

### Build and install the plugin

* Use `GF_INSTALL_PLUGINS=your-plugin-zip-via-url` for installation.

While effective, this approach can be cumbersome during rapid plugin development.
Loading