sky-oap:
image: apache/skywalking-oap-server:9.3.0
container_name: ruoyi-sky-oap
ports:
- "11800:11800"
- "12800:12800"
environment:
JAVA_OPTS: -Xms1G -Xmx2G
#记录数据的有效期,单位天
SW_CORE_RECORD_DATA_TTL: 7
#分析指标数据的有效期,单位天
SW_CORE_METRICS_DATA_TTL: 7
SW_STORAGE: elasticsearch
SW_STORAGE_ES_CLUSTER_NODES: 192.168.1.8:9200
TZ: Asia/Shanghai
#network_mode: "host"
sky-ui:
image: apache/skywalking-ui:9.3.0
container_name: ruoyi-sky-ui
ports:
- "18080:18080"
environment:
SW_SERVER_PORT: 18080
SW_OAP_ADDRESS: http://192.168.1.8:12800
#SW_ZIPKIN_ADDRESS: http://oap:9412
TZ: Asia/Shanghai
depends_on:
- sky-oap
links:
- sky-oap
#network_mode: "host"
version: '3.8'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.6
container_name: elasticsearch
restart: always
ports:
- 9200:9200
- 9300:9300
environment:
- discovery.type=single-node
- TZ=Asia/Shanghai
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
volumes:
- /home/elasticsearch/data:/usr/share/elasticsearch/data
ulimits:
memlock:
soft: -1
hard: -1
oap | 2023-06-14 01:18:55,913 org.apache.skywalking.oap.server.core.storage.model.ModelInstaller 54 [main] INFO [] - table: ui_template does not exist
oap | 2023-06-14 01:18:55,960 org.apache.skywalking.oap.server.core.storage.model.ModelInstaller 54 [main] INFO [] - table: zipkin_span does not exist
oap | 2023-06-14 01:18:56,017 org.apache.skywalking.library.elasticsearch.client.TemplateClient 139 [armeria-eventloop-epoll-6-3] ERROR [] - [9.4.0-520d531] Failed to create / update index template sw_zipkin_span
oap | java.util.concurrent.CompletionException: java.lang.RuntimeException: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"composable template [sw_zipkin_span] template after composition is invalid"}],"type":"illegal_argument_exception","reason":"composable template [sw_zipkin_span] template after composition is invalid","caused_by":{"type":"illegal_argument_exception","reason":"invalid composite mappings for [sw_zipkin_span]","caused_by":{"type":"mapper_parsing_exception","reason":"Failed to parse mapping [_doc]: analyzer [oap_analyzer] has not been configured in mappings","caused_by":{"type":"illegal_argument_exception","reason":"analyzer [oap_analyzer] has not been configured in mappings"}}}},"status":400}
在官方issue中找到解答,由于挂载的es目录为原来8.7.0版本生成及采集的数据,导致es初始化数据失败
,需要删除原目录数据/home/elasticsearch/data或者重新指定文件目录即可。
这里使用最新8.16.0版本的java-gent客户端
,配置文件在config/agent.config,参考配置文档https://skywalking.apache.org/docs/skywalking-java/v8.16.0/en/setup/service-agent/java-agent/configurations/
-javaagent:/home/skywalking/skywalking-agent/skywalking-agent.jar -Dskywalking.agent.service_name=test::服务名 -Dskywalking.collector.backend_service=192.168.24.22:11800
FROM anapsix/alpine-java:8_server-jre_unlimited
RUN mkdir -p /ruoyi/system/logs \
/ruoyi/system/temp \
/ruoyi/skywalking/agent
WORKDIR /ruoyi/system
ENV SERVER_PORT=9201
EXPOSE ${SERVER_PORT}
# 拷贝打包后的jar到容器内
ADD ./target/ruoyi-system.jar ./app.jar
ENTRYPOINT ["java", \
"-Djava.security.egd=file:/dev/./urandom", \
"-Dserver.port=${SERVER_PORT}", \
"-Dskywalking.agent.service_name=ruoyi-system", \
#指定探针数据上报的网络地址
"-Dskywalking.collector.backend_service=192.168.1.8:11800", \
#该句只是指定配置,真正的探针文件在部署服务时,在docker-compose中指定
"-javaagent:/ruoyi/skywalking/agent/skywalking-agent.jar", \
"-jar", "app.jar"]
ruoyi-gateway:
image: ruoyi/ruoyi-gateway:1.6.0
container_name: ruoyi-gateway
environment:
# 时区上海
TZ: Asia/Shanghai
ports:
- "8080:8080"
volumes:
# 配置文件
- /docker/ruoyi-gateway/logs/:/ruoyi/gateway/logs
# 指定skywalking 探针位置
- /docker/skywalking/agent/:/ruoyi/skywalking/agent
privileged: true
#network_mode: "host"