Skip to content

Commit

Permalink
add use on host and in docker doc (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
observeralone authored Apr 8, 2022
1 parent 4c439e9 commit 03a9f32
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ The `./build/target/easeagent-dep.jar` is the agent jar with all the dependencie
> For the Windows platform, please make sure git `core.autocrlf` is set to false before git clone.
> You can use `git config --global core.autocrlf false` to modify `core.autocrlf`.
[How to use easeagent.jar on host?](doc/how-to-use/use-on-host.md)

[How to use easeagent.jar in docker?](doc/how-to-use/use-in-docker.md)

#### Get Configuration file
Extracting the default configuration file.
```
Expand Down
23 changes: 23 additions & 0 deletions doc/how-to-use/use-in-docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Get the agent

Download the agent, [see our doc](https://github.com/megaease/easeagent#get-and-set-environment-variable)

# Modify startup scripts

The startup parameters of the Java application server must include the built-in argument -javaagent.

It is recommended that you set this argument with the JAVA_OPTS environment variable.

The value of that argument must contain the location where you ADD the easeagent.jar file to the image.

For example, with Tomcat, use commands like these in the Dockerfile:

```dockerfile
RUN mkdir -p /usr/local/tomcat/easeagent
ADD ./easeagent/easeagent.jar /usr/local/tomcat/easeagent/easeagent.jar
ENV JAVA_OPTS="$JAVA_OPTS -javaagent:/usr/local/tomcat/easeagent/easeagent.jar"
```

# Restart your application

Deploy your application to start using the EaseAgent to send data to MegaCloud.
86 changes: 86 additions & 0 deletions doc/how-to-use/use-on-host.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Install the agent

Download the agent, [see our doc](https://github.com/megaease/easeagent#get-and-set-environment-variable)

Once you’ve get the EaseAgent, these steps to start the Java agent installation.

1. Create a directory for your EaseAgent, such as /opt/easeagent. On Windows, the EaseAgent must be in a subdirectory of your application server’s directory, such as C:\Tomcat 1.0\easeagent.

2. Copy the easeagent.jar file into your new directory.


# Specific instructions for your Java setup

To use the EaseAgent with your JVM, you’ll need to pass the -javaagent argument. In the commands below, replace EASE_AGENT_PATH with the path of the EaseAgent directory you created, eg. /opt/easeagent.

## Spring Boot
Pass the -javaagent argument to the command line where you start your app. Make sure to add it before the -jar argument:
```
java -javaagent:EASE_AGENT_PATH/easeagent.jar -jar app.jar
```

## Tomcat

Pass the -javaagent argument on catalina.sh, catalina.bat or the GUI.

1. Linux with catalina.sh

In tomcat catalina.sh file, use the JAVA_OPTS environment variable:
```
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:EASE_AGENT_PATH/easeagent.jar"
```
2. Windows with catalina.bat
In tomcat catalina.bat file, set the JAVA_OPTS variable near the top of the file:
```
set "CATALINA_OPTS=%CATALINA_OPTS% -javaagent:EASE_AGENT_PATH\easeagent.jar"
```
3. Windows with GUI
On Windows with GUI, add the full EaseAgent path to your Java options: In Apache Tomcat, click Configure Tomcat, and then click Java.
In the Java Options text box, enter the following argument:
```
-javaagent:EASE_AGENT_PATH\easeagent.jar
```
## Jetty
Pass the -javaagent in jetty.sh or the start.ini file:
1. jetty.sh
```
export JAVA_OPTIONS="${JAVA_OPTIONS} -javaagent:EASE_AGENT_PATH/easeagent.jar"
```
2. start.ini
```
-javaagent:EASE_AGENT_PATH/easeagent.jar
```
## Wildfly
If you’re using Wildfly 11+, to pass the -javaagent argument on Linux or Windows.
Add the Java agent and make it visible to the JBoss modules by adding the following lines to your file.
1. Linux with standalone.conf:
```
JAVA_OPTS="$JAVA_OPTS -javaagent:EASE_AGENT_PATH/easeagent.jar"
JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS,com.easeagent"
```
2. Windows with standalone.bat.conf:
```
set "JAVA_OPTS=%JAVA_OPTS% -javaagent:EASE_AGENT_PATH\easeagent.jar"
set "JAVA_OPTS=%JAVA_OPTS% -Djboss.modules.system.pkgs=%JBOSS_MODULES_SYSTEM_PKGS%,com.easeagent"
```
# Restart your application
Deploy your application to start using the EaseAgent to send data to MegaCloud.

0 comments on commit 03a9f32

Please sign in to comment.