This is a very basic guide on how to set up your local environment, make the desired changes and see the result with a fresh Grafana Installation.
Clone this repository to your local environment. The frontend code lives in the src
folder, alongside the plugin.json file. See this Grafana tutorial to understand better how a plugin is structured and installed.
Backend code, written in Go, is located in the pkg
folder.
For this standard execution, you will need the following tools:
If you have made any changes to any go
files, you can use mage to recompile the plugin.
mage build:linux && mage reloadPlugin
After you made the desired changes, you can build and test the new version of the plugin using yarn
:
yarn test # run all test cases
yarn dev # builds and puts the output at ./dist
Alternatively, you can have yarn watch for changes and automatically recompile them.
yarn watch
Now that you have a ./dist
folder, you are ready to run a fresh Grafana instance and put the new version of the datasource into Grafana plugin folder.
We provide development resources to make it easier to contribute to and develop the GitHub data source.
Docker Compose file is available to help you to get started. When you call up docker compose up
inside the project folder, it will:
- Run a new instance of Grafana from the master branch and map it into port
3000
. - Configure the instance to allow an unsigned version of
github-datasource
to be installed. - Map the current folder contents into
/var/lib/grafana/plugins
.
This is enough for you to see the GitHub Datasource in the datasource list at http://localhost:3000/datasources/new
.
If you make further changes into the code, be sure to run yarn dev
again and restart the Grafana instance.
You can find example dashboard that uses GitHub data source in dashboards folder.
After you are good to go, it is time to create a pull request to share your work with the community. Please read more about that here.