You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wa...@apache.org on 2023/03/07 01:31:31 UTC

[skywalking-showcase] branch promql updated: add promql showcase docker deployment.

This is an automated email from the ASF dual-hosted git repository.

wankai pushed a commit to branch promql
in repository https://gitbox.apache.org/repos/asf/skywalking-showcase.git


The following commit(s) were added to refs/heads/promql by this push:
     new 54a5093  add promql showcase docker deployment.
54a5093 is described below

commit 54a5093d30ec95aea00eb4dc5c419205540fa431
Author: wankai123 <wa...@foxmail.com>
AuthorDate: Tue Mar 7 09:31:16 2023 +0800

    add promql showcase docker deployment.
---
 .../promql}/dashboards/general-service.json        |  0
 .../promql}/dashboards/service-mesh.json           |  0
 .../promql}/dashboards/virtual-database.json       |  0
 deploy/platform/docker/Makefile.in                 |  2 +-
 .../promql/datasources.yaml}                       | 11 +++++++--
 .../{Makefile.in => config/promql/grafana.ini}     | 10 +++++++--
 .../{Makefile.in => config/promql/providers.yaml}  | 10 +++++++--
 .../{Makefile.in => docker-compose.promql.yaml}    | 16 +++++++++++--
 .../kubernetes/feature-promql/resources.yaml       | 26 +++++++++++++---------
 deploy/platform/kubernetes/features.mk             |  2 +-
 docs/readme.md                                     |  1 +
 11 files changed, 57 insertions(+), 21 deletions(-)

diff --git a/deploy/platform/kubernetes/feature-promql/dashboards/general-service.json b/deploy/platform/config/promql/dashboards/general-service.json
similarity index 100%
rename from deploy/platform/kubernetes/feature-promql/dashboards/general-service.json
rename to deploy/platform/config/promql/dashboards/general-service.json
diff --git a/deploy/platform/kubernetes/feature-promql/dashboards/service-mesh.json b/deploy/platform/config/promql/dashboards/service-mesh.json
similarity index 100%
rename from deploy/platform/kubernetes/feature-promql/dashboards/service-mesh.json
rename to deploy/platform/config/promql/dashboards/service-mesh.json
diff --git a/deploy/platform/kubernetes/feature-promql/dashboards/virtual-database.json b/deploy/platform/config/promql/dashboards/virtual-database.json
similarity index 100%
rename from deploy/platform/kubernetes/feature-promql/dashboards/virtual-database.json
rename to deploy/platform/config/promql/dashboards/virtual-database.json
diff --git a/deploy/platform/docker/Makefile.in b/deploy/platform/docker/Makefile.in
index 2d9c98c..a0bea00 100644
--- a/deploy/platform/docker/Makefile.in
+++ b/deploy/platform/docker/Makefile.in
@@ -17,4 +17,4 @@
 #
 
 .EXPORT_ALL_VARIABLES:
-FEATURE_FLAGS ?= agent,cluster,so11y,vm,event,mysql,apisix-monitor
+FEATURE_FLAGS ?= agent,cluster,so11y,vm,event,mysql,apisix-monitor,promql
diff --git a/deploy/platform/docker/Makefile.in b/deploy/platform/docker/config/promql/datasources.yaml
similarity index 82%
copy from deploy/platform/docker/Makefile.in
copy to deploy/platform/docker/config/promql/datasources.yaml
index 2d9c98c..d30ff86 100644
--- a/deploy/platform/docker/Makefile.in
+++ b/deploy/platform/docker/config/promql/datasources.yaml
@@ -16,5 +16,12 @@
 # under the License.
 #
 
-.EXPORT_ALL_VARIABLES:
-FEATURE_FLAGS ?= agent,cluster,so11y,vm,event,mysql,apisix-monitor
+apiVersion: 1
+datasources:
+  - access: proxy
+    editable: true
+    isDefault: true
+    name: SkyWalking
+    orgId: 1
+    type: prometheus
+    url: http://oap:9090
diff --git a/deploy/platform/docker/Makefile.in b/deploy/platform/docker/config/promql/grafana.ini
similarity index 70%
copy from deploy/platform/docker/Makefile.in
copy to deploy/platform/docker/config/promql/grafana.ini
index 2d9c98c..a6d181c 100644
--- a/deploy/platform/docker/Makefile.in
+++ b/deploy/platform/docker/config/promql/grafana.ini
@@ -16,5 +16,11 @@
 # under the License.
 #
 
-.EXPORT_ALL_VARIABLES:
-FEATURE_FLAGS ?= agent,cluster,so11y,vm,event,mysql,apisix-monitor
+# This file contains the targets to deploy features that are not
+# applicable to deploy via manifest, we can deploy them via command
+# line interface here, for better maintainability.
+
+[paths]
+provisioning = /etc/grafana/provisioning
+[dashboards]
+default_home_dashboard_path = /var/lib/grafana/dashboards/skywalking/general-service.json
diff --git a/deploy/platform/docker/Makefile.in b/deploy/platform/docker/config/promql/providers.yaml
similarity index 83%
copy from deploy/platform/docker/Makefile.in
copy to deploy/platform/docker/config/promql/providers.yaml
index 2d9c98c..af7148f 100644
--- a/deploy/platform/docker/Makefile.in
+++ b/deploy/platform/docker/config/promql/providers.yaml
@@ -16,5 +16,11 @@
 # under the License.
 #
 
-.EXPORT_ALL_VARIABLES:
-FEATURE_FLAGS ?= agent,cluster,so11y,vm,event,mysql,apisix-monitor
+apiVersion: 1
+providers:
+  - name: skywalking
+    orgId: 1
+    type: file
+    folder: 'skywalking'
+    options:
+      path: /var/lib/grafana/dashboards
diff --git a/deploy/platform/docker/Makefile.in b/deploy/platform/docker/docker-compose.promql.yaml
similarity index 62%
copy from deploy/platform/docker/Makefile.in
copy to deploy/platform/docker/docker-compose.promql.yaml
index 2d9c98c..aa5c256 100644
--- a/deploy/platform/docker/Makefile.in
+++ b/deploy/platform/docker/docker-compose.promql.yaml
@@ -15,6 +15,18 @@
 # specific language governing permissions and limitations
 # under the License.
 #
+version: '2.1'
 
-.EXPORT_ALL_VARIABLES:
-FEATURE_FLAGS ?= agent,cluster,so11y,vm,event,mysql,apisix-monitor
+services:
+  grafana:
+    image: grafana/grafana:9.1.0
+    networks: [ sw ]
+    volumes:
+      - ./config/promql/grafana.ini:/etc/grafana/grafana.ini
+      - ./config/promql/providers.yaml:/etc/grafana/provisioning/dashboards/providers.yaml
+      - ./config/promql/datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml
+      - ../config/promql/dashboards:/var/lib/grafana/dashboards/skywalking
+    ports:
+      - "3000:3000"
+networks:
+  sw:
diff --git a/deploy/platform/kubernetes/feature-promql/resources.yaml b/deploy/platform/kubernetes/feature-promql/resources.yaml
index a07d2bd..1bfca58 100644
--- a/deploy/platform/kubernetes/feature-promql/resources.yaml
+++ b/deploy/platform/kubernetes/feature-promql/resources.yaml
@@ -16,6 +16,7 @@
 # under the License.
 #
 
+#This config is for the showcase, when deploy own free to modify it.
 ---
 apiVersion: v1
 kind: ConfigMap
@@ -23,22 +24,24 @@ metadata:
   name: grafana-config
 data:
   grafana.ini: |
+    [security]
+    disable_initial_admin_creation = true
     [auth.anonymous]
     enabled = true
     org_name = Main Org.
     # `Viewer`, `Editor` and `Admin`
-    org_role = Editor
+    org_role = Viewer
     [auth.basic]
     enabled = false
     [auth]
     disable_login_form = true
+    disable_signout_menu = true
     [paths]
-    data = /var/lib/grafana/
-    logs = /var/log/grafana
-    plugins = /var/lib/grafana/plugins
     provisioning = /etc/grafana/provisioning
     [dashboards]
-    default_home_dashboard_path = /var/lib/grafana/dashboards/general-service.json
+    default_home_dashboard_path = /var/lib/grafana/dashboards/skywalking/general-service.json
+    [users]
+    viewers_can_edit = true
   providers.yaml: |
     apiVersion: 1
     providers:
@@ -47,15 +50,16 @@ data:
       allowUiUpdates: false
       orgId: 1
       type: file
-      folder: ''
+      folder: 'skywalking'
       options:
         path: /var/lib/grafana/dashboards
+        foldersFromFilesStructure: true
 
   datasources.yaml: |
     apiVersion: 1
     datasources:
     - access: proxy
-      editable: true
+      editable: false
       isDefault: true
       name: SkyWalking
       orgId: 1
@@ -96,15 +100,15 @@ spec:
               mountPath: /etc/grafana/provisioning/dashboards/providers.yaml
               subPath: providers.yaml
             - name: dashboards-general-service
-              mountPath: /var/lib/grafana/dashboards/general-service.json
+              mountPath: /var/lib/grafana/dashboards/skywalking/general-service.json
               subPath: general-service.json
             - name: dashboards-service-mesh
-              mountPath: /var/lib/grafana/dashboards/service-mesh.json
+              mountPath: /var/lib/grafana/dashboards/skywalking/service-mesh.json
               subPath: service-mesh.json
             - name: dashboards-virtual-database
-              mountPath: /var/lib/grafana/dashboards/virtual-database.json
+              mountPath: /var/lib/grafana/dashboards/skywalking/virtual-database.json
               subPath: virtual-database.json
-      volumes:
+      volumes: # require create configmap from deploy/platform/config/promql/dashboards
         - name: grafana-config
           configMap:
             name: grafana-config
diff --git a/deploy/platform/kubernetes/features.mk b/deploy/platform/kubernetes/features.mk
index 29af396..159fccb 100644
--- a/deploy/platform/kubernetes/features.mk
+++ b/deploy/platform/kubernetes/features.mk
@@ -162,7 +162,7 @@ undeploy.feature-function: helm
 # @feature: promql; extra configmaps to create for grafana dashboards
 .PHONY: feature-promql
 feature-promql:
-dashboards := $(wildcard ./feature-promql/dashboards/*.json)
+dashboards := $(wildcard ../config/promql/dashboards/*.json)
 
 .PHONY: deploy.feature-promql
 deploy.feature-promql:
diff --git a/docs/readme.md b/docs/readme.md
index e60d2f9..362dc38 100644
--- a/docs/readme.md
+++ b/docs/readme.md
@@ -105,6 +105,7 @@ Currently, the features supported are:
 | `postgresql`          | Start a PostgreSQL server, and load generator to execute the sample SQLs periodically, set up fluent bit to fetch slow logs and export to OAP, and export their metrics to SkyWalking. |                                                                                                                                       |
 | `apisix-monitor`      | Deploy OpenTelemetry and export APISIX metrics to SkyWalking for analysis and display on UI                                                                                            |                                                                                                                                       |
 | `mesh-with-agent`     | Deploy services with java agent in the service mesh environment.                                                                                                                       | Only support deployment in the Kubernetes environment, docker is not supported.                                                       |
+| `promql`              | Deploy a Grafana to use promql service and show SkyWalking UI on the Grafana.                                                                                                          | Free to modify the Grafana config when deploy own.                                                                                    |
 
 ### Kubernetes