未验证 提交 f61dff9a 编写于 作者: K kezhenxu94 提交者: GitHub

Merge `Dockerfile`s in apache/skywalking-docker into this codebase (#7681)

上级 02458cb4
......@@ -33,7 +33,7 @@ jobs:
timeout-minutes: 90
strategy:
matrix:
jdk: [ 8, 9, 10, 11, 12, 13, 14, 15 ]
jdk: [ 8, 11, 12, 13, 14, 15 ]
env:
SW_SIMPLE_CASE: jdk
SW_AGENT_JDK_VERSION: ${{ matrix.jdk }}
......
......@@ -8,6 +8,7 @@ Release Notes.
#### Project
* Split javaagent into skywalking-java repository. https://github.com/apache/skywalking-java
* Merge `Dockerfile`s from apache/skywalking-docker into this codebase.
#### OAP Server
......
......@@ -16,12 +16,11 @@
SHELL := /bin/bash -o pipefail
export SW_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
export SW_OUT:=${SW_ROOT}/dist
SKIP_TEST?=false
DIST_NAME := apache-skywalking-apm-bin
SW_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CONTEXT ?= ${SW_ROOT}/dist
SKIP_TEST ?= false
DIST ?= apache-skywalking-apm-bin.tar.gz
CLI_VERSION ?= 0.7.0 # CLI version inside OAP image should always use an Apache released artifact.
init:
cd $(SW_ROOT) && git submodule update --init --recursive
......@@ -37,11 +36,10 @@ build.backend:
build.ui:
cd $(SW_ROOT) && ./mvnw --batch-mode clean package -Dmaven.test.skip=$(SKIP_TEST) -Pui,dist
DOCKER_BUILD_TOP:=${SW_OUT}/docker_build
HUB?=skywalking
DOCKER_BUILD_TOP:=${CONTEXT}/docker_build
TAG?=latest
HUB ?= skywalking
TAG ?= latest
.SECONDEXPANSION: #allow $@ to be used in dependency list
......@@ -57,15 +55,15 @@ ifneq ($(SW_OAP_BASE_IMAGE),)
BUILD_ARGS := $(BUILD_ARGS) --build-arg BASE_IMAGE=$(SW_OAP_BASE_IMAGE)
endif
BUILD_ARGS := $(BUILD_ARGS) --build-arg DIST_NAME=$(DIST_NAME)
BUILD_ARGS := $(BUILD_ARGS) --build-arg DIST=$(DIST) --build-arg SKYWALKING_CLI_VERSION=$(CLI_VERSION)
docker.oap: $(SW_OUT)/$(DIST_NAME).tar.gz
docker.oap: $(CONTEXT)/$(DIST)
docker.oap: $(SW_ROOT)/docker/oap/Dockerfile.oap
docker.oap: $(SW_ROOT)/docker/oap/docker-entrypoint.sh
docker.oap: $(SW_ROOT)/docker/oap/log4j2.xml
$(DOCKER_RULE)
docker.ui: $(SW_OUT)/apache-skywalking-apm-bin.tar.gz
docker.ui: $(CONTEXT)/$(DIST)
docker.ui: $(SW_ROOT)/docker/ui/Dockerfile.ui
docker.ui: $(SW_ROOT)/docker/ui/docker-entrypoint.sh
docker.ui: $(SW_ROOT)/docker/ui/logback.xml
......
......@@ -63,7 +63,7 @@ public enum PropertyPlaceholderHelper {
throw new UnsupportedOperationException("'placeholderPrefix or placeholderSuffix' must not be null");
}
final Map<String, String> wellKnownSimplePrefixes = new HashMap<String, String>(4);
final Map<String, String> wellKnownSimplePrefixes = new HashMap<>(4);
wellKnownSimplePrefixes.put("}", "{");
wellKnownSimplePrefixes.put("]", "[");
......@@ -90,12 +90,9 @@ public enum PropertyPlaceholderHelper {
* @return the supplied value with placeholders replaced inline
*/
public String replacePlaceholders(String value, final Properties properties) {
return replacePlaceholders(value, new PlaceholderResolver() {
@Override
public String resolvePlaceholder(String placeholderName) {
return getConfigValue(placeholderName, properties);
}
});
return replacePlaceholders(value,
placeholderName -> getConfigValue(placeholderName, properties)
);
}
private String getConfigValue(String key, final Properties properties) {
......
ES_TAG=7.4.2
ES_VERSION=7.4.2
OAP_IMAGE=skywalking/oap:latest
UI_IMAGE=skywalking/ui:latest
This folder contains Docker files for SkyWalking developers/committers to build images manually. If you want to start a SkyWalking backend server with docker-compose for your integration, please visit https://github.com/apache/skywalking-docker repository.
# Docker Images
This folder contains Dockerfiles that are used to **build**
our [OAP Docker images](https://hub.docker.com/r/apache/skywalking-oap-server)
and [UI Docker image](https://hub.docker.com/r/apache/skywalking-ui). If you want to use the Docker images, please
check [the user guide for OAP](../docs/en/setup/backend/docker.md)
and [the user guide for UI](../docs/en/setup/backend/ui-setup.md#start-with-docker-image).
## Quickstart
You can use `Makefile` located at the root folder to build a docker image with the current codebase.
```
```shell
make docker
```
It doesn't contain the process of building a docker image but also includes all the required steps, for instance, init workspace, build artifact from scratch. It builds two images, OAP, and UI.
It not only contains the process of building a docker image but also includes all the required steps, for instance, init
workspace, build artifact from scratch. It builds two images, OAP, and UI.
```
```shell
docker image ls | grep skywalking
skywalking/ui latest a14db4e1d70d 6 minutes ago 800MB
skywalking/oap latest 2a6084450b44 6 minutes ago 862MB
```
## Building variables
There're some environment variables to control image building.
There are some environment variables to control image building.
### `CONTEXT`
The Docker build context path, under this path, there should be the distribution tar ball.
```shell
ls $CONTEXT
apache-skywalking-apm-bin.tar.gz
```
### `DIST`
The distribution tar ball name, for example, `apache-skywalking-apm-bin.tar.gz`.
### `CLI_VERSION`
### HUB
The [SkyWalking CLI](http://github.com/apache/skywalking-cli) version to be included in the OAP image, it must be an
official Apache release version.
### `HUB`
The hub of docker image. The default value is `skywalking`.
### TAG
### `TAG`
The tag of docker image. The default value is `latest`.
## Running containers with docker-compose
We can start up backend cluster by docker-compose
```
cd docker
```shell
docker compose up
```
......
......@@ -14,51 +14,61 @@
# See the License for the specific language governing permissions and
# limitations under the License.
version: '3.5'
version: '3.8'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${ES_TAG}
image: docker.elastic.co/elasticsearch/elasticsearch-oss:${ES_VERSION}
container_name: elasticsearch
restart: always
ports:
- 9200:9200
- "9200:9200"
healthcheck:
test: [ "CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
environment:
discovery.type: single-node
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
oap:
image: skywalking/oap
image: ${OAP_IMAGE}
container_name: oap
depends_on:
- elasticsearch
elasticsearch:
condition: service_healthy
links:
- elasticsearch
restart: always
ports:
- 11800:11800
- 12800:12800
- "11800:11800"
- "12800:12800"
healthcheck:
test: [ "CMD-SHELL", "/skywalking/bin/swctl ch" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
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: 30s
timeout: 10s
retries: 3
start_period: 40s
JAVA_OPTS: "-Xms2048m -Xmx2048m"
ui:
image: skywalking/ui
image: ${UI_IMAGE}
container_name: ui
depends_on:
- oap
oap:
condition: service_healthy
links:
- oap
restart: always
ports:
- 8080:8080
- "8080:8080"
environment:
SW_OAP_ADDRESS: http://oap:12800
......@@ -14,36 +14,113 @@
# See the License for the specific language governing permissions and
# limitations under the License.
ARG BASE_IMAGE='adoptopenjdk/openjdk11:alpine-jre'
ARG BASE_IMAGE='adoptopenjdk/openjdk11:alpine'
FROM apache/skywalking-base:8.7.0-es7 AS cli
FROM $BASE_IMAGE as cli
WORKDIR /skywalking
ARG SKYWALKING_CLI_VERSION=0.7.0
ENV SKYWALKING_CLI_TGZ=skywalking-cli-$SKYWALKING_CLI_VERSION-bin.tgz
ENV SKYWALKING_CLI_ASC=${SKYWALKING_CLI_TGZ}.asc
ENV SKYWALKING_CLI_SHA512=${SKYWALKING_CLI_TGZ}.sha512
ENV SKYWALKING_CLI_TGZ_URLS \
https://www.apache.org/dyn/closer.cgi?action=download&filename=skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_TGZ \
# if the version is outdated, we might have to pull from the dist/archive :/
https://www-us.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_TGZ \
https://www.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_TGZ \
https://archive.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_TGZ
ENV SKYWALKING_CLI_ASC_URLS \
https://www.apache.org/dyn/closer.cgi?action=download&filename=skywalking/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_ASC \
# if the version is outdated, we might have to pull from the dist/archive :/
https://www-us.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_ASC \
https://www.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_ASC \
https://archive.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_ASC
ENV SKYWALKING_CLI_SHA512_URLS \
https://www.apache.org/dyn/closer.cgi?action=download&filename=skywalking/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_SHA512 \
# if the version is outdated, we might have to pull from the dist/archive :/
https://www-us.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_SHA512 \
https://www.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_SHA512 \
https://archive.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_SHA512
RUN set -eux; \
\
apk add --no-cache --virtual .fetch-deps \
gnupg \
ca-certificates \
openssl \
; \
\
wget --timeout=20 -O KEYS https://downloads.apache.org/skywalking/KEYS; \
gpg --import KEYS; \
\
success=; \
for url in $SKYWALKING_CLI_TGZ_URLS; do \
if wget --timeout=20 -O ${SKYWALKING_CLI_TGZ} "$url"; then \
success=1; \
break; \
fi; \
done; \
[ -n "$success" ]; \
\
success=; \
for url in $SKYWALKING_CLI_SHA512_URLS; do \
if wget --timeout=20 -O ${SKYWALKING_CLI_SHA512} "$url"; then \
success=1; \
break; \
fi; \
done; \
[ -n "$success" ]; \
\
sha512sum -c ${SKYWALKING_CLI_SHA512}; \
\
success=; \
for url in $SKYWALKING_CLI_ASC_URLS; do \
if wget --timeout=20 -O ${SKYWALKING_CLI_ASC} "$url"; then \
success=1; \
break; \
fi; \
done; \
[ -n "$success" ]; \
\
gpg --batch --verify ${SKYWALKING_CLI_ASC} ${SKYWALKING_CLI_TGZ}; \
tar -xvf ${SKYWALKING_CLI_TGZ}; \
mkdir "bin/"; \
mv skywalking-cli-${SKYWALKING_CLI_VERSION}-bin/bin/swctl-${SKYWALKING_CLI_VERSION}-linux-amd64 bin/swctl; \
chmod 755 bin/*; \
command -v gpgconf && gpgconf --kill all || :; \
ls -la .;
FROM $BASE_IMAGE
RUN apk add --no-cache openssl || true
RUN apk add --no-cache openssl
ENV JAVA_OPTS=" -Xms256M " \
SW_CLUSTER="standalone" \
SW_STORAGE="h2"
WORKDIR /skywalking
ARG DIST_NAME
ENV JAVA_OPTS=" -Xms2G "
COPY "$DIST_NAME.tar.gz" /
ARG DIST
RUN set -ex; \
tar -xzf "$DIST_NAME.tar.gz"; \
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;
COPY "$DIST" .
WORKDIR skywalking
RUN set -ex; \
tar -xzf "$DIST" --strip 1; \
rm -rf "$DIST"; \
rm -rf "config/log4j2.xml"; \
rm -rf "bin"; \
rm -rf "webapp"; \
rm -rf "agent"; \
mkdir "bin";
COPY --from=cli /skywalking/bin/swctl ./bin
COPY log4j2.xml config/
COPY docker-entrypoint.sh .
RUN mkdir ext-config; \
mkdir ext-libs;
......
......@@ -24,16 +24,6 @@
</Console>
</Appenders>
<Loggers>
<logger name="org.eclipse.jetty" level="INFO"/>
<logger name="org.apache.zookeeper" level="INFO"/>
<logger name="io.grpc.netty" level="INFO"/>
<logger name="org.apache.skywalking.oap.meter.analyzer" level="DEBUG"/>
<logger name="org.apache.skywalking.oap.server.receiver.istio.telemetry" level="DEBUG"/>
<logger name="org.apache.skywalking.oap.server.fetcher.prometheus" level="DEBUG"/>
<logger name="org.apache.skywalking.oap.server.receiver.envoy.als" level="DEBUG"/>
<logger name="org.apache.skywalking.oap.server.storage.plugin.elasticsearch" level="DEBUG"/>
<logger name="org.apache.skywalking.oap.server.core.storage.ttl" level="DEBUG"/>
<logger name="org.apache.skywalking.library.elasticsearch" level="DEBUG"/>
<Root level="INFO">
<AppenderRef ref="Console"/>
</Root>
......
......@@ -16,25 +16,28 @@
FROM adoptopenjdk/openjdk11:alpine-jre
ENV DIST_NAME=apache-skywalking-apm-bin \
JAVA_OPTS=" -Xms256M " \
ENV JAVA_OPTS=" -Xms256M " \
SW_OAP_ADDRESS="http://127.0.0.1:12800"
COPY "$DIST_NAME.tar.gz" /
WORKDIR skywalking
RUN set -ex; \
apk add bash; \
tar -xzf "$DIST_NAME.tar.gz"; \
rm -rf "$DIST_NAME.tar.gz"; \
rm -rf "$DIST_NAME/config"; \
rm -rf "$DIST_NAME/bin"; rm -rf "$DIST_NAME/oap-libs"; rm -rf "$DIST_NAME/agent"; \
mv "$DIST_NAME" skywalking;
apk add --no-cache \
bash
WORKDIR skywalking
ARG DIST
COPY "$DIST" .
RUN tar -xzf "$DIST" --strip 1; \
rm -rf "$DIST"; \
rm -rf "config"; \
rm -rf "bin"; \
rm -rf "oap-libs"; \
rm -rf "agent";
COPY docker-entrypoint.sh .
COPY logback.xml webapp/
EXPOSE 8080
ENTRYPOINT ["bash", "docker-entrypoint.sh"]
\ No newline at end of file
ENTRYPOINT ["bash", "docker-entrypoint.sh"]
......@@ -92,7 +92,7 @@ if you haven't done it before.
* Package name: `apache-skywalking-x.y.z-src.tar.gz`
* See Section "Build and sign the source code package" for more details
1. Upload the distribution package to the folder with files ending with `.asc` and `.sha512`.
* Package name: `apache-skywalking-bin-x.y.z.tar.gz` and `apache-skywalking-bin-x.y.z.zip`
* Package name: `apache-skywalking-bin-x.y.z.tar.gz`.
* See Section "Locate and download the distribution package in Apache Nexus Staging repositories" for more details.
* Create a `.sha512` package: `shasum -a 512 file > file.sha512`
......@@ -282,6 +282,22 @@ SkyWalking Resources:
- Apache SkyWalking Team
```
## Publish the Docker images
```shell
export SW_VERSION=x.y.z
git clone --depth 1 --branch v$SW_VERSION https://github.com/apache/skywalking.git
cd skywalking
svn co https://dist.apache.org/repos/dist/release/skywalking/$SW_VERSION release # (1)
export CONTEXT=release
export HUB=apache
export TAG=$SW_VERSION
export DIST=<the binary package name inside (1), e.g. apache-skywalking-apm-8.8.0.tar.gz>
make docker.all && make docker.push
```
## Clean up the old releases
Once the latest release has been published, you should clean up the old releases from the mirror system.
1. Update the download links (source, dist, asc, and sha512) on the website to the archive repo (https://archive.apache.org/dist/skywalking).
......
# How to use the Docker images
## Start a `standlone` container with `H2` storage
```shell
docker run --name oap --restart always -d apache/skywalking-oap-server:8.8.0
```
## Start a `standlone` container with ElasticSearch 7 as storage whose address is `elasticsearch:9200`
```shell
docker run --name oap --restart always -d -e SW_STORAGE=elasticsearch -e SW_STORAGE_ES_CLUSTER_NODES=elasticsearch:9200 apache/skywalking-oap-server:8.8.0
```
# Configuration
We could set up environment variables to configure this image. They are defined in [backend-setup](https://skywalking.apache.org/docs/main/latest/en/setup/backend/backend-setup/).
# Extend image
If you intend to override or add config files in `/skywalking/config`, `/skywalking/ext-config` is the location for you to put extra files.
The files with the same name will be overridden, otherwise, they will be added in `/skywalking/config`.
If you want to add more libs/jars into the classpath of OAP, for example, new metrics for OAL. These jars can be mounted into `/skywalking/ext-libs`, then
`entrypoint` bash will append them into the classpath. Notice, you can't override an existing jar in classpath.
......@@ -32,3 +32,18 @@ spring:
```
## Start with Docker Image
Start a container to connect oap server whose address is `http://oap:12800`.
```shell
docker run --name oap --restart always -d -e SW_OAP_ADDRESS=http://oap:12800 apache/skywalking-ui:8.8.0
```
### Configuration
We could set up environment variables to configure this image.
### SW_OAP_ADDRESS
The address of OAP server. Default value is `http://127.0.0.1:12800`.
......@@ -65,6 +65,8 @@ catalog:
catalog:
- name: "Quick Start"
path: "/en/setup/backend/backend-setup"
- name: "Quick Start with Docker"
path: "/en/setup/backend/docker"
- name: "Configuration Vocabulary"
path: "/en/setup/backend/configuration-vocabulary"
- name: "Advanced Setup"
......
......@@ -145,6 +145,7 @@ public final class ElasticSearch implements Closeable {
log.info("ElasticSearch version is: {}", v);
version.complete(v);
});
endpointGroup.whenReady().thenAccept(healthyEndpointListener);
endpointGroup.addListener(healthyEndpointListener);
return future;
}
......
......@@ -27,6 +27,7 @@ services:
- e2e
volumes:
- ./download-mysql.sh:/download-mysql.sh
- ./log4j2.xml:/skywalking/config/log4j2.xml
environment:
SW_CLUSTER_ZK_HOST_PORT: zk:2181
SW_STORAGE_ES_CLUSTER_NODES: es:9200
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<Configuration status="INFO">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout charset="UTF-8" pattern="%d %c %L [%t] %-5p %x - %m%n"/>
</Console>
</Appenders>
<Loggers>
<logger name="org.eclipse.jetty" level="INFO"/>
<logger name="org.apache.zookeeper" level="INFO"/>
<logger name="io.grpc.netty" level="INFO"/>
<logger name="org.apache.skywalking.oap.meter.analyzer" level="DEBUG"/>
<logger name="org.apache.skywalking.oap.server.receiver.istio.telemetry" level="DEBUG"/>
<logger name="org.apache.skywalking.oap.server.fetcher.prometheus" level="DEBUG"/>
<logger name="org.apache.skywalking.oap.server.receiver.envoy.als" level="DEBUG"/>
<logger name="org.apache.skywalking.oap.server.storage.plugin.elasticsearch" level="DEBUG"/>
<logger name="org.apache.skywalking.oap.server.core.storage.ttl" level="DEBUG"/>
<logger name="org.apache.skywalking.library.elasticsearch" level="DEBUG"/>
<Root level="INFO">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册