-
clone the repo
-
download grafana from here and install it locally
-
grafana settings, conf/defaults.ini, enable unsigned plugins (yes, the plugin is unsigned)
- copy the
frontend
folder to the installed grafana
build the frontend
cd [grafana installed path]/data/plugins/frontend
npm install
npm run dev
- launch grafana
cd [grafana installed path]
./bin/grafana server
- add and configure the datasource
choose Mongodb-Grafana-Plugin
configure the mongodb connection parameters and the plugin's backend url. DON'T click the Save & test
button yet. let's do it at step 7.
- debug the frontend
since it is a debug build in step 3 npm run dev
, you code change in the frontend will take effect immediately. open a chrome's inspector, just do an Empty Cache and Hard Reload
to load the new change(s).
you will then be able to view the source, set breakpoints, step through the code; just like debugging any react.js apps
- debug the
backend
cd [repo path]/backend
npm install
open the repo from visual studio code. the backend is in the backend
folder. it is default hardcoded to use port number 4000 and a launch.json
has been provided. just Run | Start Debugging
from menu bar. you can set a breakpoiint at code
- save the database connection
click on the Save & test
button. your breakpoint in step 6 shall be triggered
hurray! you have everything set up.
frontend - run the npm run build
for just once. the built product in the dist
folder is good for grafana's future use
backend - it's just an express.js
app. run it localhost or in a cloud, aws apigateway + lambda can be an easy setup.