Building the Postgres Plugin Outside of Public

Our team is trying to use a modified version of the Postgres Datasource Plugin to connect to a different SQL engine. We are having issues building this plugin outside of Grafana’s internal plugin structure, and we are wondering if the community has any guidance for how we might accomplish this? It seems that the plugin was written specifically to be built from the plublic/app/plugins/datasource directory, and be built as part of dev-Grafana’s yarn start procedure.

What we have tried to do so far is create a new datasource with the Grafana Toolkit in the data/plugins/datasource directory. We then removed the default files in src and replaced them with the postgres files. We then modified the plugin.json and created a package.json to identify it as a different plugin name and id. We then modified the directory paths on some of the imports since they were relative to the public directory.

However, the normal yarn install/dev/build commands are not building the plugin. No dist directory gets created, and Grafana does not recognize/load the plugin directory.

Has anyone tried converting one of the internal plugins to a third-party-like plugin before? Is there any information available out there that could help us out with this? I can provide file or command output for what we have done so far if that would help.

I’m trying to do the same issue. Do you have any success on it?

Hello folks,

I used Graph2 panel as a starting point (https://github.com/grafana/grafana/tree/master/public/app/plugins/panel/graph2)
Have copied it to my plugin (https://github.com/vsergeyev/loudml-grafana-app/tree/master/src/panel)
and updated module.ts, plugin.json as well as top level package.json

Don’t forget to update id of your plugin, in my case I changed “id”: “graph2” to “id”: "loudml-graph-panel"

In imports it may be needed to change import from ‘app/…’ to ‘grafana/app/…’
In devDependencies it may require to add some packages, based on errors in output from yarn/webpack.

Hope this will help a bit,
V.