You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2019/11/22 16:42:27 UTC
[skywalking] branch master updated: Extending OAP docker container
(#3919)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new fa2af52 Extending OAP docker container (#3919)
fa2af52 is described below
commit fa2af52cced5b69384291e38e938129c50e01c67
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Sat Nov 23 00:42:11 2019 +0800
Extending OAP docker container (#3919)
* Add ext lib and ext config
* Add container checker
---
.github/workflows/docker-ci.yaml | 62 ++++++++++++++++++++++++++++++++++++++++
Makefile | 6 +++-
docker/oap/Dockerfile.oap | 2 ++
docker/oap/docker-entrypoint.sh | 11 +++++++
test/scripts/env.sh | 24 ++++++++++++++++
5 files changed, 104 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/docker-ci.yaml b/.github/workflows/docker-ci.yaml
new file mode 100644
index 0000000..7ccc7ca
--- /dev/null
+++ b/.github/workflows/docker-ci.yaml
@@ -0,0 +1,62 @@
+# 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.
+
+name: docker-ci
+
+on: [push]
+env:
+ SKIP_TEST: true
+ DOCKER_DIR: ./docker
+ LOG_DIR: /tmp/skywalking
+jobs:
+ build:
+ runs-on: ubuntu-16.04
+ steps:
+ - uses: actions/checkout@v1
+ - uses: actions/cache@v1
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+ - name: Build docker image
+ run: make docker
+ - name: Bootstrap cluster
+ run: cd ${DOCKER_DIR} && docker-compose up -d
+ - name: Check port avaliable
+ run: |
+ source ./test/scripts/env.sh
+ echo "Waiting for OAP ready"
+ export PORT=11800
+ check_sw_port
+ echo "OAP is ready"
+ echo "Waiting for UI ready"
+ PORT=8080
+ check_sw_port
+ echo "UI is ready"
+ - name: Collect logs
+ run: |
+ mkdir -p ${LOG_DIR}
+ cd ${DOCKER_DIR}
+ docker-compose logs oap > ${LOG_DIR}/oap.txt
+ docker-compose logs ui > ${LOG_DIR}/ui.txt
+ docker-compose logs elasticsearch > ${LOG_DIR}/es.txt
+ continue-on-error: true
+ - uses: actions/upload-artifact@v1.0.0
+ continue-on-error: true
+ with:
+ name: logs
+ path: /tmp/skywalking
diff --git a/Makefile b/Makefile
index acb6a85..2c3cc12 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+SHELL := /bin/bash -o pipefail
export SW_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
@@ -21,6 +22,9 @@ export SW_OUT:=${SW_ROOT}/dist
SKIP_TEST?=false
+init:
+ cd $(SW_ROOT) && git submodule update --init --recursive
+
.PHONY: build.all build.agent build.backend build.ui build.docker
build.all:
@@ -48,7 +52,7 @@ TAG?=latest
.PHONY: docker docker.all docker.oap
-docker: build.docker docker.all
+docker: init build.docker docker.all
DOCKER_TARGETS:=docker.oap docker.ui
diff --git a/docker/oap/Dockerfile.oap b/docker/oap/Dockerfile.oap
index 43ec2dd..a94490e 100644
--- a/docker/oap/Dockerfile.oap
+++ b/docker/oap/Dockerfile.oap
@@ -34,6 +34,8 @@ WORKDIR skywalking
COPY log4j2.xml config/
COPY docker-entrypoint.sh .
+RUN mkdir ext-config; \
+ mkdir ext-libs;
EXPOSE 12800 11800 1234
diff --git a/docker/oap/docker-entrypoint.sh b/docker/oap/docker-entrypoint.sh
index 2ae3607..c18cd1a 100755
--- a/docker/oap/docker-entrypoint.sh
+++ b/docker/oap/docker-entrypoint.sh
@@ -425,7 +425,14 @@ SW_CLUSTER=${SW_CLUSTER:-standalone}
SW_STORAGE=${SW_STORAGE:-h2}
SW_CONFIGURATION=${SW_CONFIGURATION:-none}
SW_TELEMETRY=${SW_TELEMETRY:-none}
+EXT_LIB_DIR=/skywalking/ext-libs
+EXT_CONFIG_DIR=/skywalking/ext-config
+# If user wants to override application.yml, the one generated by docker-entrypoint.sh should be ignored.
+[[ -f ${EXT_CONFIG_DIR}/application.yml ]] && SW_L0AD_CONFIG_FILE_FROM_VOLUME=true
+
+# Override configuration files
+cp -vfR ${EXT_CONFIG_DIR}/ config/
if [[ -z "$SW_L0AD_CONFIG_FILE_FROM_VOLUME" ]] || [[ "$SW_L0AD_CONFIG_FILE_FROM_VOLUME" != "true" ]]; then
generateApplicationYaml
echo "Generated application.yml"
@@ -439,6 +446,10 @@ for i in oap-libs/*.jar
do
CLASSPATH="$i:$CLASSPATH"
done
+for i in ${EXT_LIB_DIR}/*.jar
+do
+ CLASSPATH="$i:$CLASSPATH"
+done
set -ex
exec java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap \
diff --git a/test/scripts/env.sh b/test/scripts/env.sh
new file mode 100755
index 0000000..a315a84
--- /dev/null
+++ b/test/scripts/env.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env 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.
+# ----------------------------------------------------------------------------
+
+function check_sw_port() {
+ for i in $(seq 1 15); do nc -zv -w 3 localhost ${PORT} && return || sleep 3; done; exit 1
+}
\ No newline at end of file