├── .github └── workflows │ └── maven.yml ├── .gitignore ├── Dockerfile ├── Jenkinsfile ├── MavenWebApplication.yaml ├── appdeploy.yaml ├── docker-compose.yml ├── pom.xml └── src └── main ├── java └── com │ └── mt │ └── services │ └── EmployeeService.java └── webapp ├── WEB-INF ├── mt-servlet.xml └── web.xml ├── images └── mithunlogo.jpg └── jsps └── home.jsp /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Java CI with Maven 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | pull_request: 10 | branches: [ master,develop ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Set up JDK 11 20 | uses: actions/setup-java@v2 21 | with: 22 | java-version: '11' 23 | distribution: 'adopt' 24 | cache: maven 25 | - name: Build with Maven 26 | run: mvn -B package --file pom.xml 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .project 3 | /.settings 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM tomcat:9.0-jdk11 2 | COPY target/maven-web-application.war /usr/local/tomcat/webapps/maven-web-application.war -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline{ 2 | 3 | agent any 4 | 5 | tools{ 6 | maven 'maven3.8.2' 7 | 8 | } 9 | 10 | triggers{ 11 | pollSCM('* * * * *') 12 | } 13 | 14 | options{ 15 | timestamps() 16 | buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '', numToKeepStr: '5')) 17 | } 18 | 19 | stages{ 20 | 21 | stage('CheckOutCode'){ 22 | steps{ 23 | git branch: 'development', credentialsId: '957b543e-6f77-4cef-9aec-82e9b0230975', url: 'https://github.com/devopstrainingblr/maven-web-application-1.git' 24 | 25 | } 26 | } 27 | 28 | stage('Build'){ 29 | steps{ 30 | sh "mvn clean package" 31 | } 32 | } 33 | /* 34 | stage('ExecuteSonarQubeReport'){ 35 | steps{ 36 | sh "mvn clean sonar:sonar" 37 | } 38 | } 39 | 40 | stage('UploadArtifactsIntoNexus'){ 41 | steps{ 42 | sh "mvn clean deploy" 43 | } 44 | } 45 | 46 | stage('DeployAppIntoTomcat'){ 47 | steps{ 48 | sshagent(['bfe1b3c1-c29b-4a4d-b97a-c068b7748cd0']) { 49 | sh "scp -o StrictHostKeyChecking=no target/maven-web-application.war ec2-user@35.154.190.162:/opt/apache-tomcat-9.0.50/webapps/" 50 | } 51 | } 52 | } 53 | */ 54 | }//Stages Closing 55 | 56 | post{ 57 | 58 | success{ 59 | emailext to: 'devopstrainingblr@gmail.com,mithuntechnologies@yahoo.com', 60 | subject: "Pipeline Build is over .. Build # is ..${env.BUILD_NUMBER} and Build status is.. ${currentBuild.result}.", 61 | body: "Pipeline Build is over .. Build # is ..${env.BUILD_NUMBER} and Build status is.. ${currentBuild.result}.", 62 | replyTo: 'devopstrainingblr@gmail.com' 63 | } 64 | 65 | failure{ 66 | emailext to: 'devopstrainingblr@gmail.com,mithuntechnologies@yahoo.com', 67 | subject: "Pipeline Build is over .. Build # is ..${env.BUILD_NUMBER} and Build status is.. ${currentBuild.result}.", 68 | body: "Pipeline Build is over .. Build # is ..${env.BUILD_NUMBER} and Build status is.. ${currentBuild.result}.", 69 | replyTo: 'devopstrainingblr@gmail.com' 70 | } 71 | 72 | } 73 | 74 | 75 | }//Pipeline closing 76 | -------------------------------------------------------------------------------- /MavenWebApplication.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: webpage-deployment 5 | namespace: production 6 | spec: 7 | replicas: 2 8 | revisionHistoryLimit: 5 9 | selector: 10 | matchLabels: 11 | application: webpage 12 | strategy: 13 | type: RollingUpdate 14 | rollingUpdate: 15 | maxSurge: 1 16 | maxUnavailable: 1 17 | minReadySeconds: 30 18 | template: 19 | metadata: 20 | name: webpage-pod 21 | labels: 22 | application: webpage 23 | spec: 24 | containers: 25 | - name: webpage-container 26 | image: mithuntechnologies/maven-web-application:1 27 | imagePullPolicy: Always 28 | ports: 29 | - containerPort: 8080 30 | --- 31 | apiVersion: v1 32 | kind: Service 33 | metadata: 34 | name: webpage-service 35 | namespace: production 36 | spec: 37 | type: NodePort 38 | selector: 39 | application: webpage 40 | ports: 41 | - port: 80 42 | targetPort: 8080 -------------------------------------------------------------------------------- /appdeploy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | become: true 4 | tasks: 5 | - name: stop tomcat 6 | systemd: 7 | name: tomcat.service 8 | state: stopped 9 | - name: delete old application package 10 | file: 11 | path: /usr/local/apache-tomcat-7.0.76/webapps/maven-web-application.war 12 | state: absent 13 | - name: copy application package 14 | copy: 15 | src: target/maven-web-application.war 16 | dest: /usr/local/apache-tomcat-7.0.76/webapps/maven-web-application.war 17 | owner: tomcat 18 | group: tomcat 19 | - name: start tomcat 20 | systemd: 21 | name: tomcat.service 22 | state: started 23 | daemon_reload: yes 24 | enabled: yes 25 | - name: Pause for 1 Minute and continue with play 26 | pause: 27 | minutes: 1 28 | - name: Confirm that 200 OK response is returned 29 | uri: 30 | url: "http://{{ ansible_host }}:8080/maven-web-application/" 31 | status_code: 200 32 | ... -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.1' 2 | services: 3 | springboot: 4 | image: dockerhandson/maven-web-application:VERSION 5 | restart: always 6 | ports: 7 | - 9090:8080 8 | networks: 9 | - mavenappbridge 10 | networks: 11 | mavenappbridge: -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.mt 6 | maven-web-application 7 | war 8 | 0.0.1-SNAPSHOT 9 | 10 | maven-web-application 11 | 12 | Maven Web Project for Java Project 13 | 14 | 15 | Mithun Technologies 16 | http://mithuntechnologies.com/ 17 | 18 | 19 | 20 | 1.8 21 | 5.1.2.RELEASE 22 | 4.11 23 | 1.2.17 24 | http://172.31.33.143:9000/ 25 | admin 26 | passw0rd 27 | UTF-8 28 | UTF-8 29 | 30 | 31 | 32 | 33 | 34 | 35 | org.json 36 | json 37 | 20160212 38 | 39 | 40 | 41 | 42 | junit 43 | junit 44 | 3.8.1 45 | test 46 | 47 | 48 | 49 | javax.servlet 50 | javax.servlet-api 51 | 3.1.0 52 | provided 53 | 54 | 55 | 56 | org.mockito 57 | mockito-core 58 | 1.9.5 59 | test 60 | 61 | 62 | 63 | 64 | 65 | org.springframework 66 | spring-core 67 | ${spring.version} 68 | 69 | 70 | org.springframework 71 | spring-web 72 | ${spring.version} 73 | 74 | 75 | org.springframework 76 | spring-webmvc 77 | ${spring.version} 78 | 79 | 80 | org.springframework 81 | spring-context 82 | ${spring.version} 83 | 84 | 85 | 86 | 87 | 88 | javax.servlet 89 | javax.servlet-api 90 | 3.1.0 91 | provided 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | nexus 100 | Mithun Technologies Releases Nexus Repository 101 | http://172.31.42.154:9980/mithuntechnologies/repository/canarabank-snapshot/ 102 | 103 | 104 | 105 | nexus 106 | Mithun Technologies Snapshot Nexus Repository 107 | http://172.31.42.154:9980/mithuntechnologies/repository/canarabank-release/ 108 | 109 | 110 | 111 | 112 | 113 | maven-web-application 114 | 115 | 116 | 117 | org.apache.maven.plugins 118 | maven-war-plugin 119 | 3.3.2 120 | 121 | 122 | org.apache.maven.plugins 123 | maven-compiler-plugin 124 | 3.3 125 | 126 | ${jdk.version} 127 | ${jdk.version} 128 | 129 | 130 | 131 | 132 | org.eclipse.jetty 133 | jetty-maven-plugin 134 | 9.2.11.v20150529 135 | 136 | 10 137 | 138 | /maven-web-application 139 | 140 | 141 | 142 | 143 | 144 | org.apache.maven.plugins 145 | maven-eclipse-plugin 146 | 2.9 147 | 148 | true 149 | true 150 | 2.0 151 | maven-web-application 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /src/main/java/com/mt/services/EmployeeService.java: -------------------------------------------------------------------------------- 1 | package com.mt.services; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | import javax.servlet.http.HttpServletResponse; 5 | import javax.servlet.http.HttpSession; 6 | 7 | import org.json.JSONException; 8 | import org.json.JSONObject; 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestMethod; 12 | import org.springframework.web.bind.annotation.ResponseBody; 13 | 14 | @Controller 15 | @RequestMapping("/employee") 16 | public class EmployeeService { 17 | 18 | 19 | @RequestMapping(value = "/getEmployeeDetails", method = RequestMethod.GET) 20 | @ResponseBody 21 | String uploadImage(HttpServletRequest request, HttpServletResponse response, HttpSession httpSession) 22 | throws JSONException { 23 | 24 | JSONObject js = new JSONObject(); 25 | js.put("Name", "Mithun Technologies"); 26 | js.put("Calling Name", "Mithun"); 27 | js.put("DOB", "08-Nov-2011"); 28 | js.put("Hobbies", "Reading Technical Blogs,Teaching, Helping to Poor People.."); 29 | js.put("Places he like", "His native place"); 30 | 31 | return js.toString(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/mt-servlet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | maven-web-application 4 | 5 | contextConfigLocation 6 | /WEB-INF/mt-servlet.xml 7 | 8 | 9 | mt 10 | org.springframework.web.servlet.DispatcherServlet 11 | 1 12 | 13 | 14 | mt 15 | /services/* 16 | 17 | 18 | org.springframework.web.context.ContextLoaderListener 19 | 20 | 21 | /jsps/home.jsp 22 | 23 | -------------------------------------------------------------------------------- /src/main/webapp/images/mithunlogo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MithunTechnologiesDevOps/maven-web-application/b42b8baa717b48928677a8a2c32e065f0d07cd61/src/main/webapp/images/mithunlogo.jpg -------------------------------------------------------------------------------- /src/main/webapp/jsps/home.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | <%@ page import="java.net.*" %> 3 | 4 | 5 | 6 | 7 | MithunTechnologies- Home Page 8 | 9 | 10 | 11 | 12 |

Welcome to Mithun Technologies

13 |

Phone Number: +91 9980923216

14 |

Mithun Technologies is a Very Good Training Center for DevOps, Cloud, Kubernetes and Terraform

15 | 16 |

Trainer Name: Bhaskar Reddy Lacchannagari

17 | 18 |
19 |
20 |

Server Side IP Address


21 | 22 | <% 23 | String ip = ""; 24 | InetAddress inetAddress = InetAddress.getLocalHost(); 25 | ip = inetAddress.getHostAddress(); 26 | out.println("Server Host Name :: "+inetAddress.getHostName()); 27 | %> 28 |
29 | <%out.println("Server IP Address :: "+ip);%> 30 | 31 |
32 |

Client Side IP Address


33 | <%out.print( "Client IP Address :: "+request.getRemoteAddr()); %>
34 | <%out.print( "Client Name Host :: "+request.getRemoteHost() );%>
35 |
36 |
37 | 38 | 39 | 40 | 41 | Mithun Technologies, 42 | Marathahalli, 43 | Bengaluru, 44 | +91 9980923216 and 45 | Devopstrainingblr@Gmail.com 46 |
47 | Mail to Mithun Technologies 48 |
49 |
50 |
51 |

Service : Get Employee Details

52 |
53 |
54 |

Mithun Technologies - Consultant, Training and Development Center.

55 |

Copyrights 2025 by Mithun Technologies,Bengaluru

56 | 57 | 58 | --------------------------------------------------------------------------------