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

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


The following commit(s) were added to refs/heads/main by this push:
     new e250d12  fix docker deploy with make undeploy.docker (#178)
e250d12 is described below

commit e250d1275b6bb24f1ab34598a592213992454b89
Author: shalk(xiao kun) <xsh...@163.com>
AuthorDate: Fri Jun 21 21:03:39 2024 +0800

    fix docker deploy with make undeploy.docker (#178)
---
 Makefile.in                                        |  3 +
 .../docker-compose.elasticsearch-monitor.yaml      | 33 ++++++++-
 .../docker/docker-compose.pulsar-monitor.yaml      |  9 ---
 .../docker/docker-compose.rocketmq-monitor.yaml    | 23 ++----
 deploy/platform/docker/scripts/es-e2e-data-mock.sh | 81 ++++++++++++++++++++++
 5 files changed, 123 insertions(+), 26 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 26e51d0..4f92070 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -29,6 +29,9 @@ BANYANDB_IMAGE ?= ghcr.io/apache/skywalking-banyandb
 BANYANDB_IMAGE_TAG ?= e85aeb5790a10b8a26db628fc15140a034865009
 STORAGE_CLASS ?= ""
 
+ES_IMAGE ?= docker.elastic.co/elasticsearch/elasticsearch-oss
+ES_IMAGE_TAG ?= 7.10.2
+
 SW_OAP_IMAGE ?= ghcr.io/apache/skywalking/oap
 SW_OAP_IMAGE_TAG ?= 0b175ffb0ab946bed9b843a12ae8dbeffebf11a4
 
diff --git a/deploy/platform/docker/docker-compose.elasticsearch-monitor.yaml 
b/deploy/platform/docker/docker-compose.elasticsearch-monitor.yaml
index 6f0b483..a64adc9 100644
--- a/deploy/platform/docker/docker-compose.elasticsearch-monitor.yaml
+++ b/deploy/platform/docker/docker-compose.elasticsearch-monitor.yaml
@@ -21,6 +21,24 @@
 version: '2.1'
 
 services:
+  elasticsearch:
+    image: ${ES_IMAGE}:${ES_IMAGE_TAG}
+    networks: [ sw ]
+    ports:
+      - "9200:9200"
+    healthcheck:
+      test: [ "CMD-SHELL", "curl --silent --fail 
localhost:9200/_cluster/health" ]
+      interval: 30s
+      timeout: 10s
+      retries: 3
+    environment:
+      - discovery.type=single-node
+      - bootstrap.memory_lock=true
+      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
+    ulimits:
+      memlock:
+        soft: -1
+        hard: -1
   es-exporter:
     image: quay.io/prometheuscommunity/elasticsearch-exporter:v1.5.0
     expose:
@@ -60,6 +78,19 @@ services:
     depends_on:
       oap:
         condition: service_healthy
-
+  es-mock:
+    image: curlimages/curl:latest
+    networks:
+      - sw
+    depends_on:
+      elasticsearch:
+        condition: service_healthy
+      es-exporter:
+        condition: service_healthy
+      oap:
+        condition: service_healthy
+    command: "sh /etc/es-e2e-data-mock.sh"
+    volumes:
+      - ./scripts/es-e2e-data-mock.sh:/etc/es-e2e-data-mock.sh
 networks:
   sw:
diff --git a/deploy/platform/docker/docker-compose.pulsar-monitor.yaml 
b/deploy/platform/docker/docker-compose.pulsar-monitor.yaml
index 7357b3b..a89f586 100644
--- a/deploy/platform/docker/docker-compose.pulsar-monitor.yaml
+++ b/deploy/platform/docker/docker-compose.pulsar-monitor.yaml
@@ -16,15 +16,6 @@
 version: '3'
 
 services:
-  oap:
-    extends:
-      file: ../../script/docker-compose/base-compose.yml
-      service: oap
-    ports:
-      - "12800:12800"
-    networks:
-      - sw
-
   zookeeper:
     image: zookeeper:3.9.1
     expose:
diff --git a/deploy/platform/docker/docker-compose.rocketmq-monitor.yaml 
b/deploy/platform/docker/docker-compose.rocketmq-monitor.yaml
index bf57f08..ef03a3e 100644
--- a/deploy/platform/docker/docker-compose.rocketmq-monitor.yaml
+++ b/deploy/platform/docker/docker-compose.rocketmq-monitor.yaml
@@ -16,15 +16,6 @@
 version: "3"
 
 services:
-  oap:
-    extends:
-      file: ../../script/docker-compose/base-compose.yml
-      service: oap
-    ports:
-      - "12800:12800"
-    networks:
-      - e2e
-
   rocketmq-namesrv-1:
     image: apache/rocketmq:4.9.4
     hostname: rocketmq-namesrv-1
@@ -39,7 +30,7 @@ services:
       timeout: 10s
       retries: 120
     networks:
-      - e2e
+      - sw
 
   rocketmq-broker-1:
     image: apache/rocketmq:4.9.4
@@ -60,7 +51,7 @@ services:
       rocketmq-namesrv-1:
         condition: service_healthy
     networks:
-      - e2e
+      - sw
 
   rocketmq-producer-perf-test:
     image: apache/rocketmq:4.9.4
@@ -73,7 +64,7 @@ services:
       rocketmq-broker-1:
         condition: service_healthy
     networks:
-      - e2e
+      - sw
 
   rocketmq-consumer-perf-test:
     image: apache/rocketmq:4.9.4
@@ -85,7 +76,7 @@ services:
     depends_on:
       - rocketmq-producer-perf-test
     networks:
-      - e2e
+      - sw
 
   rocketmq-exporter:
     image: apache/rocketmq-exporter:0.0.2
@@ -98,12 +89,12 @@ services:
     depends_on:
       - rocketmq-consumer-perf-test
     networks:
-      - e2e
+      - sw
 
   otel-collector:
     image: ${OTEL_COLLECTOR_IMAGE}:${OTEL_COLLECTOR_IMAGE_TAG}
     networks:
-      - e2e
+      - sw
     command: [ "--config=/etc/otel-collector-config.yaml" ]
     volumes:
       - 
./config/rocketmq/otel-collector-rocketmq-config.yaml:/etc/otel-collector-config.yaml
@@ -114,4 +105,4 @@ services:
         condition: service_healthy
 
 networks:
-  e2e:
\ No newline at end of file
+  sw:
diff --git a/deploy/platform/docker/scripts/es-e2e-data-mock.sh 
b/deploy/platform/docker/scripts/es-e2e-data-mock.sh
new file mode 100644
index 0000000..bdb99bf
--- /dev/null
+++ b/deploy/platform/docker/scripts/es-e2e-data-mock.sh
@@ -0,0 +1,81 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+E2E_ES_HOST="elasticsearch:9200"
+INDEX_NAME_PREFIX="e2e-index-"
+i=0
+while [ $i -lt 10 ]
+do
+    curl -X PUT "${E2E_ES_HOST}/${INDEX_NAME_PREFIX}${i}?pretty" -H 
'Content-Type: application/json' -d'
+    {
+      "settings": {
+        "index": {
+          "number_of_shards": 3,
+          "number_of_replicas": 2
+        }
+      }
+    }
+    '
+
+    curl -X POST "${E2E_ES_HOST}/${INDEX_NAME_PREFIX}0/_doc/?pretty" -H 
'Content-Type: application/json' -d'{"message": "GET /search HTTP/1.1 200 
'${i}'","userid":"test"}'
+
+
+
+    if [ $i -eq 10 ]
+    then
+      break
+    fi
+    i=`expr $i + 1`
+done
+
+while true
+do
+      curl -X GET 
"${E2E_ES_HOST}/${INDEX_NAME_PREFIX}0/_search?size=20&pretty" -H 'Content-Type: 
application/json' -d'
+      {
+        "query": {
+          "term": {
+            "userid": "test"
+          }
+        }
+      }
+      '
+
+      curl -X POST "${E2E_ES_HOST}/${INDEX_NAME_PREFIX}0/_search?pretty" -H 
'Content-Type: application/json' -d'
+      {
+        "suggest": {
+          "my-suggest-1" : {
+            "text" : "test",
+            "term" : {
+              "field" : "userid"
+            }
+          }
+        }
+      }
+      '
+
+      curl -X POST 
"${E2E_ES_HOST}/${INDEX_NAME_PREFIX}0/_search?scroll=1m&pretty" -H 
'Content-Type: application/json' -d'
+      {
+        "size": 100,
+        "query": {
+          "match": {
+            "userid": "test"
+          }
+        }
+      }
+      '
+
+      sleep 2
+done
\ No newline at end of file

Reply via email to