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 into 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 reloadPluginAfter 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 ./distAlternatively, you can have yarn watch for changes and automatically recompile them.
yarn watchNow 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 a Docker Compose file 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
3090. - Configure the instance to allow an unsigned version of
github-datasourceto 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:3090/datasources/new.
If you make further changes into the code, be sure to run yarn dev again and restart the Grafana instance.
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.
