Jelajahi Sumber

docs(dev): Update docs about devenv dir (#16208)

* Update readmes

* Fix devenv dasboard query

* Update devenv readme

* Add link to devenv from docs
Andrej Ocenas 6 tahun lalu
induk
melakukan
516b7ce845

+ 7 - 0
README.md

@@ -113,6 +113,8 @@ The resulting image will be tagged as `grafana/grafana:dev`
 
 Notice: If you are using Docker for MacOS, be sure to set the memory limit to be larger than 2 GiB (at docker -> Preferences -> Advanced), otherwise `grunt build` may fail.
 
+## Development
+
 ### Dev config
 
 Create a custom.ini in the conf directory to override default configuration options.
@@ -148,6 +150,11 @@ GRAFANA_TEST_DB=mysql go test ./pkg/...
 GRAFANA_TEST_DB=postgres go test ./pkg/...
 ```
 
+### Datasource and dashboard provisioning
+
+[Here](https://github.com/grafana/grafana/tree/master/devenv) you can find helpful scripts and docker-compose setup
+that will populate your dev environment for quicker testing end experimenting.
+
 ## Contribute
 
 If you have any ideas for improvement or have found a bug, do not hesitate to open an issue.

+ 20 - 3
devenv/README.md

@@ -2,15 +2,32 @@ This folder contains useful scripts and configuration for...
 
 * Configuring dev datasources in Grafana
 * Configuring dev & test scenarios dashboards.
+* Creating docker-compose file with DBs and fake data.
+
+
+# Dev dashboards and data sources
 
 ```bash
 ./setup.sh
 ```
 
-After restarting grafana server there should now be a number of datasources named `gdev-<type>` provisioned as well as a dashboard folder named `gdev dashboards`. This folder contains dashboard & panel features tests dashboards. 
+After restarting grafana server there should now be a number of datasources named `gdev-<type>` provisioned as well as
+a dashboard folder named `gdev dashboards`. This folder contains dashboard & panel features tests dashboards. 
+
+#### Dev dashboards
 
-# Dev dashboards
+Please update these dashboards or make new ones as new panels & dashboards features are developed or new bugs are
+found. The dashboards are located in the `devenv/dev-dashboards` folder. 
 
-Please update these dashboards or make new ones as new panels & dashboards features are developed or new bugs are found. The dashboards are located in the `devenv/dev-dashboards` folder. 
+# docker-compose with databases
+
+```bash
+./create_docker_compose.sh influxdb prometheus2 elastic5
+docker-compose up
+```
 
+This command will create a docker compose file with specified databases configured and ready to run. Each database has
+a prepared image with some fake data ready to use. For available databases see `docker/blocks` directory. Mind that
+for some databases there are multiple images, for example there is prometheus_mac specifically for Macs or different
+version.
 

+ 6 - 35
devenv/dev-dashboards/datasource_tests_postgres_fakedata.json

@@ -75,7 +75,7 @@
         {
           "alias": "",
           "format": "time_series",
-          "rawSql": "SELECT\n  $__timeGroup(\"createdAt\",'$summarize'),\n  min(value) as \"value\",\n  'total avg' as \"metric\"\nFROM \n  grafana_metric\nWHERE\n  $__timeFilter(\"createdAt\") AND\n  measurement = 'logins.count'\nGROUP BY time",
+          "rawSql": "SELECT\n  $__timeGroup(\"createdAt\",'$summarize'),\n  min(value) as \"value\",\n  'total avg' as \"metric\"\nFROM \n  grafana_metric\nWHERE\n  $__timeFilter(\"createdAt\") AND\n  measurement = 'logins.count'\nGROUP BY time\nORDER BY time",
           "refId": "B"
         }
       ],
@@ -323,11 +323,7 @@
         {
           "alias": "",
           "colorMode": null,
-          "colors": [
-            "rgba(245, 54, 54, 0.9)",
-            "rgba(237, 129, 40, 0.89)",
-            "rgba(50, 172, 45, 0.97)"
-          ],
+          "colors": ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"],
           "decimals": 2,
           "pattern": "/.*/",
           "thresholds": [],
@@ -351,11 +347,7 @@
   ],
   "schemaVersion": 16,
   "style": "dark",
-  "tags": [
-    "gdev",
-    "fake-data-gen",
-    "postgres"
-  ],
+  "tags": ["gdev", "fake-data-gen", "postgres"],
   "templating": {
     "list": [
       {
@@ -501,32 +493,11 @@
     "to": "now"
   },
   "timepicker": {
-    "refresh_intervals": [
-      "5s",
-      "10s",
-      "30s",
-      "1m",
-      "5m",
-      "15m",
-      "30m",
-      "1h",
-      "2h",
-      "1d"
-    ],
-    "time_options": [
-      "5m",
-      "15m",
-      "1h",
-      "6h",
-      "12h",
-      "24h",
-      "2d",
-      "7d",
-      "30d"
-    ]
+    "refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"],
+    "time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
   },
   "timezone": "",
   "title": "Datasource tests - Postgres",
   "uid": "JYola5qzz",
   "version": 4
-}
+}

+ 6 - 0
docs/sources/project/building_from_source.md

@@ -96,6 +96,12 @@ Writing & watching frontend tests
 - Jest will run all test files that end with the name ".test.ts"
 
 
+### Datasource and dashboard provisioning
+
+[Here](https://github.com/grafana/grafana/tree/master/devenv) you can find helpful scripts and docker-compose setup
+that will populate your dev environment for quicker testing end experimenting.
+
+
 ## Creating optimized release packages
 
 This step builds linux packages and requires that fpm is installed. Install fpm via `gem install fpm`.