1. OverviewThe previous article introduced how to deploy spring boot using docker and connect to skywalking, which described how to build skywalking using docker-compose. This article will not introduce how to build skywalking. Here we will mainly record how to deploy a tomcat using docker and connect to skywalking for service link tracking. 2. Use docker to deploy tomcat and connect to skywalkingThe following is a description of how to connect the tomcat application to the skywalking official website:
Linux Tomcat 7 / Tomcat 8 CATALINA_OPTS="$CATALINA_OPTS -javaagent:<skywalking-agent-path>"; export CATALINA_OPTS Windows Tomcat 7 / Tomcat 8 set "CATALINA_OPTS=-javaagent:<skywalking-agent-path>" JAR File or Spring Boot java -javaagent:<skywalking-agent-path> -jar yourApp.jar
Since I am using docker to deploy tomcat, I don't plan to modify the In the figure below, a script that reads This means: do not set variables in the 1. Write custom variables in the setenv.sh file First, we need to download the skywalking agent. For information about downloading the agent, you can refer to the article at the beginning of this article. Then put the agent in an accessible directory. I am testing here, so I copied the agent directory to the same directory as my Dockerfile. The content of FROM tomcat LABEL maintaner="xiniao" COPY agent /usr/skywalking/agent WORKDIR /usr/local/tomcat/bin RUN echo 'CATALINA_OPTS="$CATALINA_OPTS -javaagent:/usr/skywalking/agent/skywalking-agent.jar";' > setenv.sh ENV SW_AGENT_NAME="my-spring-demo" \ SW_AGENT_COLLECTOR_BACKEND_SERVICES="127.0.0.1:11800" WORKDIR /usr/local/tomcat/webapps/ROOT COPY target/my-spring-demo.war my-spring-demo.war RUN jar -xf my-spring-demo.war As for other configurations of skywalking agent, they can be defined by environment variables. For example, here we specify the service name displayed in skywalking as 2. Use environment variables to specify the path of skywalking agent The detailed FROM tomcat LABEL maintaner="xiniao" COPY agent /usr/skywalking/agent ENV CATALINA_OPTS="$CATALINA_OPTS -javaagent:/usr/skywalking/agent/skywalking-agent.jar" \ SW_AGENT_NAME="my-spring-demo-env" \ SW_AGENT_COLLECTOR_BACKEND_SERVICES="127.0.0.1:11800" WORKDIR /usr/local/tomcat/webapps/ROOT COPY target/my-spring-demo.war my-spring-demo.war RUN jar -xf my-spring-demo.war Use the following command to build the image: docker build -t my-spring-demo . Run the container using the following command: docker run --rm -p 8080:8080 my-spring-demo Visit the skywalking ui and you can see the monitoring information as follows: SummarizeThis article mainly introduces how to use docker to deploy tomact and connect it to skywalking. Since there is not much relevant information on the Internet, I record it here to provide some help to those who need it. There are still some problems here. For example, it is not friendly to directly type the skywalking agent into the image file. I think you can customize a tomcat base image and type the skywalking agent into the base image. In this way, all tomcats can reference this base image to build images and connect to skywalking. If you use k8s for deployment, you can define an initial container in the pod. When the pod starts, copy the skywalking agent in the initial container to our application. I will introduce how to use skywalking in k8s and connect the pod application to skywalking without intrusion in the next article. This is the end of this article about using docker to deploy tomcat and connect to skywalking. For more relevant content about docker to deploy tomcat and connect to skywalking, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
"Grand" are probably the two words that ...
Table of contents 1. Front-end leading process: 2...
Negative distance refers to empathy. Preface (rai...
1. Some tips on classes declared with class in re...
This article shares the specific code of the WeCh...
1. Check whether the check status module is insta...
Table of contents Boolean Type Number Types Strin...
Technology Fan html web page, you must know vue f...
Table of contents 1. Using Set()+Array.from() 2. ...
I have introduced it to you before: docker (deplo...
Preface Recently, I was working on a report funct...
In a word: if you buy a cloud server from any maj...
According to major websites and personal habits, ...
html,address, blockquote, body,dd,div, dl,dt,fiel...
Asynchronous replication MySQL replication is asy...