Skip to content

Commit c6f5d7c

Browse files
feat(java): Java simple tomcat app (#1048)
* chore: Test with the python and both the tomcats - jmx, susdcatalina * chore: modified jmx-tomcat -java v, tomcat v, added crowdstrike * feat(java): Added a simple java app * chore: Java App set up * fix: Updated Java deploy config * fix: Updated Java deploy config * chore: Resolved conflicts * chore: Modified the Java app path * chore: Minor change to deploy script --------- Co-authored-by: pchinthapenta <[email protected]>
1 parent ef8fffb commit c6f5d7c

File tree

17 files changed

+264
-16
lines changed

17 files changed

+264
-16
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.newrelic</groupId>
5+
<artifactId>javaApp</artifactId>
6+
<packaging>war</packaging>
7+
<version>1.0-SNAPSHOT</version>
8+
<name>javaApp Maven Webapp</name>
9+
<url>http://maven.apache.org</url>
10+
<dependencies>
11+
<dependency>
12+
<groupId>junit</groupId>
13+
<artifactId>junit</artifactId>
14+
<version>3.8.1</version>
15+
<scope>test</scope>
16+
</dependency>
17+
</dependencies>
18+
<build>
19+
<finalName>javaApp</finalName>
20+
<plugins>
21+
<!-- Add the exec-maven-plugin below -->
22+
<plugin>
23+
<groupId>org.codehaus.mojo</groupId>
24+
<artifactId>exec-maven-plugin</artifactId>
25+
<version>3.0.0</version>
26+
<executions>
27+
<execution>
28+
<id>curl-self</id>
29+
<phase>install</phase>
30+
<goals>
31+
<goal>exec</goal>
32+
</goals>
33+
<configuration>
34+
<executable>bash</executable>
35+
<arguments>
36+
<argument>-c</argument>
37+
<argument>
38+
while true; do
39+
curl http://localhost:8080/javaApp/dummy.jsp;
40+
sleep 5;
41+
done;
42+
</argument>
43+
</arguments>
44+
</configuration>
45+
</execution>
46+
</executions>
47+
</plugin>
48+
<!-- Add other plugins if necessary -->
49+
</plugins>
50+
</build>
51+
</project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html>
2+
<head>
3+
<title>Dummy Page</title>
4+
</head>
5+
<body>
6+
<h1>List of Harry Potter Subjects</h1>
7+
<ul>
8+
<li>Alchemy</li>
9+
<li>Astronomy</li>
10+
<li>Charms</li>
11+
<!-- Add other subjects here -->
12+
</ul>
13+
</body>
14+
</html>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!DOCTYPE web-app PUBLIC
2+
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
3+
"http://java.sun.com/dtd/web-app_2_3.dtd" >
4+
5+
<web-app>
6+
<display-name>Archetype Created Web Application</display-name>
7+
</web-app>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<html>
2+
<body>
3+
<h2>Hello World!</h2>
4+
</body>
5+
</html>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html>
2+
<head>
3+
<title>Dummy Page</title>
4+
</head>
5+
<body>
6+
<h1>List of Harry Potter Subjects</h1>
7+
<ul>
8+
<li>Alchemy</li>
9+
<li>Astronomy</li>
10+
<li>Charms</li>
11+
<!-- Add other subjects here -->
12+
</ul>
13+
</body>
14+
</html>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!DOCTYPE web-app PUBLIC
2+
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
3+
"http://java.sun.com/dtd/web-app_2_3.dtd" >
4+
5+
<web-app>
6+
<display-name>Archetype Created Web Application</display-name>
7+
</web-app>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<html>
2+
<body>
3+
<h2>Hello World!</h2>
4+
</body>
5+
</html>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
artifactId=javaApp
2+
groupId=com.newrelic
3+
version=1.0-SNAPSHOT
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
- debug:
3+
msg: Set up sample tomcat-java app on the host
4+
5+
- name: Copy file to remote
6+
ansible.builtin.copy:
7+
src: ../../../../javaApp
8+
dest: /home/ec2-user
9+
mode: '0777'
10+
become: true
11+
12+
- name: Change the permissions of the tomcat directory
13+
shell: chmod 755 /opt/tomcat/latest/webapps
14+
become: true
15+
16+
- name: Change the permissions of the tomcat bin
17+
shell: chmod -R 777 /opt/tomcat/latest/bin
18+
become: true
19+
20+
- name: Build Java App with Maven
21+
ansible.builtin.command:
22+
cmd: mvn clean package -f /home/ec2-user/javaApp/pom.xml
23+
environment:
24+
JAVA_HOME: "/opt/jdk-14.0.1"
25+
PATH: "{{ ansible_env.PATH }}:/opt/jdk-14.0.1/bin:/opt/apache-maven/bin"
26+
JRE_HOME: "/opt/jdk-14.0.1"
27+
become: true
28+
29+
- name: Move the package
30+
shell: mv /home/ec2-user/javaApp/target/javaApp.war /opt/tomcat/latest/webapps
31+
become: true
32+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.newrelic</groupId>
5+
<artifactId>javaApp</artifactId>
6+
<packaging>war</packaging>
7+
<version>1.0-SNAPSHOT</version>
8+
<name>javaApp Maven Webapp</name>
9+
<url>http://maven.apache.org</url>
10+
<dependencies>
11+
<dependency>
12+
<groupId>junit</groupId>
13+
<artifactId>junit</artifactId>
14+
<version>3.8.1</version>
15+
<scope>test</scope>
16+
</dependency>
17+
</dependencies>
18+
<build>
19+
<finalName>javaApp</finalName>
20+
<plugins>
21+
<!-- Add the exec-maven-plugin below -->
22+
<plugin>
23+
<groupId>org.codehaus.mojo</groupId>
24+
<artifactId>exec-maven-plugin</artifactId>
25+
<version>3.0.0</version>
26+
<executions>
27+
<execution>
28+
<id>curl-self</id>
29+
<phase>install</phase>
30+
<goals>
31+
<goal>exec</goal>
32+
</goals>
33+
<configuration>
34+
<executable>bash</executable>
35+
<arguments>
36+
<argument>-c</argument>
37+
<argument>
38+
while true; do
39+
curl http://localhost:8080/javaApp/dummy.jsp;
40+
sleep 5;
41+
done;
42+
</argument>
43+
</arguments>
44+
</configuration>
45+
</execution>
46+
</executions>
47+
</plugin>
48+
<!-- Add other plugins if necessary -->
49+
</plugins>
50+
</build>
51+
</project>

0 commit comments

Comments
 (0)