You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2020/07/20 16:17:27 UTC

[skywalking] 01/01: Add swctl to docker image for health check

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

hanahmily pushed a commit to branch docker-health-check
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 8fa7b5f53ec29fb82a1e4adaebed224f97c81530
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Mon Jul 20 16:16:37 2020 +0000

    Add swctl to docker image for health check
    
    Signed-off-by: Gao Hongtao <ha...@gmail.com>
---
 docker/docker-compose.yml | 10 +++++++++-
 docker/oap/Dockerfile.oap | 21 +++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index ab30c30..36f8c4d 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-version: '3.3'
+version: '3.5'
 services:
   elasticsearch:
     image: docker.elastic.co/elasticsearch/elasticsearch:${ES_TAG}
@@ -42,6 +42,14 @@ services:
     environment:
       SW_STORAGE: elasticsearch
       SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200
+      SW_HEALTH_CHECKER: default
+      SW_TELEMETRY: prometheus
+    healthcheck:
+      test: ["CMD", "./bin/swctl", "ch"]
+      interval: 1m30s
+      timeout: 10s
+      retries: 3
+      start_period: 10s
   ui:
     image: skywalking/ui:${TAG}
     container_name: ui
diff --git a/docker/oap/Dockerfile.oap b/docker/oap/Dockerfile.oap
index ff94d3b..62bd982 100644
--- a/docker/oap/Dockerfile.oap
+++ b/docker/oap/Dockerfile.oap
@@ -16,6 +16,24 @@
 
 ARG JAVA_VERSION=8
 
+FROM golang:1.13 AS builder
+
+RUN mkdir -p /go/src/github.com/apache \
+	&& cd /go/src/github.com/apache \
+	&& git clone https://github.com/apache/skywalking-cli \
+	&& cd skywalking-cli \
+	&& git checkout 37deff6185eced966dedec3aaebd0c9ed08fce95 \
+	&& git submodule init \
+	&& git submodule update \
+	&& make deps \
+	&& make codegen \
+	&& make linux
+
+WORKDIR /go/src/github.com/apache/skywalking-cli
+
+RUN mv ./bin/swctl* ./bin/swctl
+
+
 FROM adoptopenjdk/openjdk$JAVA_VERSION:alpine
 
 ENV JAVA_OPTS=" -Xms256M " \
@@ -31,10 +49,13 @@ RUN set -ex; \
     rm -rf "$DIST_NAME.tar.gz"; \
     rm -rf "$DIST_NAME/config/log4j2.xml"; \
     rm -rf "$DIST_NAME/bin"; rm -rf "$DIST_NAME/webapp"; rm -rf "$DIST_NAME/agent"; \
+    mkdir "$DIST_NAME/bin"; \
     mv "$DIST_NAME" skywalking;
 
 WORKDIR skywalking
 
+COPY --from=builder /go/src/github.com/apache/skywalking-cli/bin/swctl ./bin
+
 COPY log4j2.xml config/
 COPY docker-entrypoint.sh .
 RUN mkdir ext-config; \