├── .github └── workflows │ ├── master_javamvnwebapp.yml │ ├── master_loksaijava1.yml │ └── master_loksaijavanmvn.yml ├── .gitignore ├── Dockerfile ├── Jenkinsfile ├── LICENSE ├── Notes.txt ├── README.md ├── bin ├── .github │ └── workflows │ │ ├── master_javamvnwebapp.yml │ │ ├── master_loksaijava1.yml │ │ └── master_loksaijavanmvn.yml ├── .gitignore ├── Dockerfile ├── Jenkinsfile ├── LICENSE ├── README.md ├── k8smvndeployment.yaml ├── nodePort.yaml ├── pom.xml ├── s1.txt ├── s2.txt └── src │ ├── main │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.jsp │ ├── test │ └── resources │ │ └── log4j2.xml │ ├── test1.txt │ ├── test2.txt │ └── testvsfile.txt ├── k8smvndeployment.yaml ├── nodePort.yaml ├── pom.xml ├── s1.txt ├── s2.txt └── src ├── main └── webapp │ ├── WEB-INF │ └── web.xml │ └── index.jsp ├── test ├── java │ └── com │ │ └── dev3l │ │ └── hello_world │ │ └── test │ │ └── ExampleTest.java └── resources │ └── log4j2.xml ├── test1.txt ├── test2.txt └── testvsfile.txt /.github/workflows/master_javamvnwebapp.yml: -------------------------------------------------------------------------------- 1 | # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy 2 | # More GitHub Actions for Azure: https://github.com/Azure/actions 3 | 4 | name: Build and deploy JAR app to Azure Web App - javamvnwebapp 5 | 6 | on: 7 | push: 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Set up Java version 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: '8' 23 | 24 | - name: Build with Maven 25 | run: mvn clean install 26 | 27 | - name: Upload artifact for deployment job 28 | uses: actions/upload-artifact@v2 29 | with: 30 | name: java-app 31 | path: '${{ github.workspace }}/target/*.jar' 32 | 33 | deploy: 34 | runs-on: ubuntu-latest 35 | needs: build 36 | environment: 37 | name: 'Production' 38 | url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} 39 | 40 | steps: 41 | - name: Download artifact from build job 42 | uses: actions/download-artifact@v2 43 | with: 44 | name: java-app 45 | 46 | - name: Deploy to Azure Web App 47 | id: deploy-to-webapp 48 | uses: azure/webapps-deploy@v2 49 | with: 50 | app-name: 'javamvnwebapp' 51 | slot-name: 'Production' 52 | publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_65997784D3B24D04B2A8A06D3CF0B17D }} 53 | package: '*.jar' 54 | -------------------------------------------------------------------------------- /.github/workflows/master_loksaijava1.yml: -------------------------------------------------------------------------------- 1 | # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy 2 | # More GitHub Actions for Azure: https://github.com/Azure/actions 3 | 4 | name: Build and deploy WAR app to Azure Web App - loksaijava1 5 | 6 | on: 7 | push: 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Set up Java version 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: '8' 23 | 24 | - name: Build with Maven 25 | run: mvn clean install 26 | 27 | - name: Upload artifact for deployment job 28 | uses: actions/upload-artifact@v2 29 | with: 30 | name: java-app 31 | path: '${{ github.workspace }}/target/*.war' 32 | 33 | deploy: 34 | runs-on: ubuntu-latest 35 | needs: build 36 | environment: 37 | name: 'Production' 38 | url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} 39 | 40 | steps: 41 | - name: Download artifact from build job 42 | uses: actions/download-artifact@v2 43 | with: 44 | name: java-app 45 | 46 | - name: Deploy to Azure Web App 47 | id: deploy-to-webapp 48 | uses: azure/webapps-deploy@v2 49 | with: 50 | app-name: 'loksaijava1' 51 | slot-name: 'Production' 52 | publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_7B483C4708FD4DAF99B505152BFD5427 }} 53 | package: '*.war' 54 | -------------------------------------------------------------------------------- /.github/workflows/master_loksaijavanmvn.yml: -------------------------------------------------------------------------------- 1 | # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy 2 | # More GitHub Actions for Azure: https://github.com/Azure/actions 3 | 4 | name: Build and deploy WAR app to Azure Web App - Loksaijavanmvn 5 | 6 | on: 7 | push: 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Set up Java version 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: '11' 23 | 24 | - name: Build with Maven 25 | run: mvn clean install 26 | 27 | - name: Upload artifact for deployment job 28 | uses: actions/upload-artifact@v2 29 | with: 30 | name: java-app 31 | path: '${{ github.workspace }}/target/*.war' 32 | 33 | deploy: 34 | runs-on: ubuntu-latest 35 | needs: build 36 | environment: 37 | name: 'Production' 38 | url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} 39 | 40 | steps: 41 | - name: Download artifact from build job 42 | uses: actions/download-artifact@v2 43 | with: 44 | name: java-app 45 | 46 | - name: Deploy to Azure Web App 47 | id: deploy-to-webapp 48 | uses: azure/webapps-deploy@v2 49 | with: 50 | app-name: 'Loksaijavanmvn' 51 | slot-name: 'Production' 52 | publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_9E449DEA60A54472B81E951B121B0CD6 }} 53 | package: '*.war' 54 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | target/* 11 | 12 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 13 | hs_err_pid* 14 | 15 | # eclipse 16 | .classpath 17 | .project 18 | .settings 19 | 20 | # intellij 21 | .idea 22 | /target/ 23 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM tomcat:8.0 2 | COPY ./target/mvn-hello-world.war /usr/local/tomcat/webapps 3 | EXPOSE 8080 4 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent { label 'slave1' } 3 | 4 | stages { 5 | stage('SCM Checkout') { 6 | steps { 7 | echo 'Perfomr SCM Check-Out' 8 | echo 'Cloning Java Maven App Code' 9 | git 'https://github.com/LoksaiETA/Java-mvn-app2.git' 10 | } 11 | } 12 | stage('Java Application Build') { 13 | steps { 14 | echo 'Perform Java Maven Application Build' 15 | sh 'mvn clean package' 16 | } 17 | } 18 | stage('Deploy to Tomcat_Server') { 19 | steps { 20 | script { 21 | sshPublisher(publishers: [sshPublisherDesc(configName: 'SA-Tomcat_Server', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '.', remoteDirectorySDF: false, removePrefix: 'target/', sourceFiles: 'target/mvn-hello-world.war')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)]) 22 | } 23 | 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Justin Beall 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Notes.txt: -------------------------------------------------------------------------------- 1 | ############### 2 | 3 | DevOps --> Tools & Services 4 | 5 | 1. Projects : 6 | 7 | Trained DevOps Resource. 8 | 9 | How much you are strong in ur fundamentals? 10 | How much you can able adapt yourself to their requirements? 11 | How much you can relate the the things with the real time scenarios? 12 | 13 | Intro. to DevOps: 14 | Tools ::: 15 | GIT/Jenkins/Ansible/Terraform/Docker/Kubernetes/Promethus/Grafana 16 | 17 | 18 | Resume/Profile ::::: 19 | 20 | Projects::: 21 | My learning : 22 | 23 | Resume no. of pages... 24 | 25 | Project ::: 26 | 27 | Project 1: 28 | 29 | Name : 30 | Tools : 31 | How many members : 2 32 | Project Description : 33 | Project Duration : 34 | 35 | Project 2: 36 | 37 | Name : 38 | Tools : 39 | How many members : 1 40 | 41 | Project Description 42 | 43 | 44 | Project :::: ???? 45 | 46 | Banking Application ::: 47 | 48 | Infra 49 | Development 50 | DevOps pipeline -> automate the CI/CD 51 | 52 | DevOps pipeline :::: 53 | 54 | 55 | Automated pipeline to perform infra-structure provision and configuration ? 56 | 57 | Writing the script??? 58 | IAC - Terraform --> HCL 59 | IAC - Ansible --> YAML 60 | 61 | Automated pipeline to perform build and deployment ? 62 | 63 | Automated pipeline to perform build and deployment of containerized application ? 64 | 65 | Pipeline 1: Test Server 66 | 67 | Pipeline 2 : Build & Deployment 68 | 69 | 70 | 71 | 72 | Medicure / Insurance Application :::: 73 | 74 | Projects ==> Have a copy of project Document in github repo. 75 | - Project Description 76 | - Snapshot of the cicd pipeline work flow 77 | - Pipeline line scripts --> 78 | --> Naming conventions! 79 | --> Comments should be maintained 80 | --> Input and Output for each stage. 81 | - Snapshot of the Project output. 82 | 83 | 84 | What is your contribution in the project ??? 85 | Infra Provisioning 86 | DevOps Pipeline 87 | Created end-to-end pipeline 88 | Create end-to-end pipeline for containerized workload. 89 | Jenkins --> 90 | Build ' 91 | Docker - to build Image 92 | Kubernetes - Orchestrate the containers 93 | 94 | pipeline { 95 | agent { label 'slave1' } 96 | 97 | tools { 98 | // Install the Maven version configured as "M3" and add it to the path. 99 | maven "maven-3.6.3" 100 | } 101 | 102 | environment { 103 | DOCKERHUB_CREDENTIALS=credentials('dockerloginid') 104 | } 105 | 106 | stages { 107 | stage('SCM Checkout') { 108 | steps { 109 | // Get some code from a GitHub repository 110 | git 'https://github.com/LoksaiETA/devops-java-webapp.git' 111 | //git 'https://github.com/LoksaiETA/Java-mvn-app2.git' 112 | } 113 | } 114 | stage('Maven Build') { 115 | steps { 116 | // Run Maven on a Unix agent. 117 | sh "mvn -Dmaven.test.failure.ignore=true clean package" 118 | } 119 | } 120 | stage("Docker build"){ 121 | steps { 122 | sh 'docker version' 123 | sh "docker build -t loksaieta/loksai-eta-app:${BUILD_NUMBER} ." 124 | sh 'docker image list' 125 | sh "docker tag loksaieta/loksai-eta-app:${BUILD_NUMBER} loksaieta/loksai-eta-app:latest" 126 | } 127 | } 128 | stage('Approve - push Image to dockerhub'){ 129 | steps{ 130 | 131 | //----------------send an approval prompt------------- 132 | script { 133 | env.APPROVED_DEPLOY = input message: 'User input required Choose "yes" | "Abort"' 134 | } 135 | //-----------------end approval prompt------------ 136 | } 137 | } 138 | stage('Login2DockerHub') { 139 | 140 | steps { 141 | sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin' 142 | } 143 | } 144 | stage('Push2DockerHub') { 145 | steps { 146 | sh "docker push loksaieta/loksai-eta-app:latest" 147 | } 148 | } 149 | stage('Deploy to Kubernetes Cluster') { 150 | steps { 151 | script { 152 | sshPublisher(publishers: [sshPublisherDesc(configName: 'FKubemaster1', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'kubectl apply -f k8smvndeployment.yaml', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '.', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '*.yaml')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)]) 153 | } 154 | } 155 | } 156 | } 157 | } 158 | 159 | 160 | 161 | + 162 | + 163 | + 164 | + 165 | 166 | 167 | entrypoint "/bin/bash" 168 | cmd "/bin/bash" 169 | 170 | git docker maven 171 | 172 | FROM centos 173 | RUN yum install git -y 174 | ENTRYPOINT "sleep" 175 | CMD "30" 176 | 177 | 178 | docker run -it myimge1 50 179 | 180 | 181 | docker run -it myimge1 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mvn-hello-world-web-app 2 | Java Hello World web application created using maven-archetype-webapp 3 | 4 | #Test 5 | 6 | ## Dependancies 7 | * git 8 | * maven 9 | * tomcat 10 | 11 | -------------------------------------------------------------------------------- /bin/.github/workflows/master_javamvnwebapp.yml: -------------------------------------------------------------------------------- 1 | # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy 2 | # More GitHub Actions for Azure: https://github.com/Azure/actions 3 | 4 | name: Build and deploy JAR app to Azure Web App - javamvnwebapp 5 | 6 | on: 7 | push: 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Set up Java version 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: '8' 23 | 24 | - name: Build with Maven 25 | run: mvn clean install 26 | 27 | - name: Upload artifact for deployment job 28 | uses: actions/upload-artifact@v2 29 | with: 30 | name: java-app 31 | path: '${{ github.workspace }}/target/*.jar' 32 | 33 | deploy: 34 | runs-on: ubuntu-latest 35 | needs: build 36 | environment: 37 | name: 'Production' 38 | url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} 39 | 40 | steps: 41 | - name: Download artifact from build job 42 | uses: actions/download-artifact@v2 43 | with: 44 | name: java-app 45 | 46 | - name: Deploy to Azure Web App 47 | id: deploy-to-webapp 48 | uses: azure/webapps-deploy@v2 49 | with: 50 | app-name: 'javamvnwebapp' 51 | slot-name: 'Production' 52 | publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_65997784D3B24D04B2A8A06D3CF0B17D }} 53 | package: '*.jar' 54 | -------------------------------------------------------------------------------- /bin/.github/workflows/master_loksaijava1.yml: -------------------------------------------------------------------------------- 1 | # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy 2 | # More GitHub Actions for Azure: https://github.com/Azure/actions 3 | 4 | name: Build and deploy WAR app to Azure Web App - loksaijava1 5 | 6 | on: 7 | push: 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Set up Java version 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: '8' 23 | 24 | - name: Build with Maven 25 | run: mvn clean install 26 | 27 | - name: Upload artifact for deployment job 28 | uses: actions/upload-artifact@v2 29 | with: 30 | name: java-app 31 | path: '${{ github.workspace }}/target/*.war' 32 | 33 | deploy: 34 | runs-on: ubuntu-latest 35 | needs: build 36 | environment: 37 | name: 'Production' 38 | url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} 39 | 40 | steps: 41 | - name: Download artifact from build job 42 | uses: actions/download-artifact@v2 43 | with: 44 | name: java-app 45 | 46 | - name: Deploy to Azure Web App 47 | id: deploy-to-webapp 48 | uses: azure/webapps-deploy@v2 49 | with: 50 | app-name: 'loksaijava1' 51 | slot-name: 'Production' 52 | publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_7B483C4708FD4DAF99B505152BFD5427 }} 53 | package: '*.war' 54 | -------------------------------------------------------------------------------- /bin/.github/workflows/master_loksaijavanmvn.yml: -------------------------------------------------------------------------------- 1 | # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy 2 | # More GitHub Actions for Azure: https://github.com/Azure/actions 3 | 4 | name: Build and deploy WAR app to Azure Web App - Loksaijavanmvn 5 | 6 | on: 7 | push: 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Set up Java version 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: '11' 23 | 24 | - name: Build with Maven 25 | run: mvn clean install 26 | 27 | - name: Upload artifact for deployment job 28 | uses: actions/upload-artifact@v2 29 | with: 30 | name: java-app 31 | path: '${{ github.workspace }}/target/*.war' 32 | 33 | deploy: 34 | runs-on: ubuntu-latest 35 | needs: build 36 | environment: 37 | name: 'Production' 38 | url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} 39 | 40 | steps: 41 | - name: Download artifact from build job 42 | uses: actions/download-artifact@v2 43 | with: 44 | name: java-app 45 | 46 | - name: Deploy to Azure Web App 47 | id: deploy-to-webapp 48 | uses: azure/webapps-deploy@v2 49 | with: 50 | app-name: 'Loksaijavanmvn' 51 | slot-name: 'Production' 52 | publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_9E449DEA60A54472B81E951B121B0CD6 }} 53 | package: '*.war' 54 | -------------------------------------------------------------------------------- /bin/.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | target/* 11 | 12 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 13 | hs_err_pid* 14 | 15 | # eclipse 16 | .classpath 17 | .project 18 | .settings 19 | 20 | # intellij 21 | .idea 22 | /target/ 23 | -------------------------------------------------------------------------------- /bin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM tomcat:latest 2 | WORKDIR /home/devopsadmin 3 | COPY ./mvn-hello-world.war /usr/local/tomcat/webapps 4 | RUN cp -r /usr/local/tomcat/webapps.dist/* /usr/local/tomcat/webapps 5 | -------------------------------------------------------------------------------- /bin/Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent { label 'javabuildserver' } 3 | 4 | 5 | tools { 6 | // Install the Maven version configured as "M3" and add it to the path. 7 | jdk "aws_open_jdk" 8 | maven "slave_maven" 9 | } 10 | 11 | environment { 12 | DOCKERHUB_CREDENTIALS=credentials('dockerloginid') 13 | } 14 | 15 | stages { 16 | stage('SCM Checkout') { 17 | steps { 18 | // Get some code from a GitHub repository 19 | git 'https://github.com/LoksaiETA/devops-java-webapp.git' 20 | } 21 | } 22 | stage('Maven Build') { 23 | steps { 24 | // Run Maven on a Unix agent. 25 | sh "mvn -Dmaven.test.failure.ignore=true clean package" 26 | } 27 | } 28 | stage("Docker build"){ 29 | steps { 30 | sh 'docker version' 31 | sh "docker build -t loksaieta/loksai-eta-app:${BUILD_NUMBER} ." 32 | sh 'docker image list' 33 | sh "docker tag loksaieta/loksai-eta-app:${BUILD_NUMBER} loksaieta/loksai-eta-app:latest" 34 | } 35 | } 36 | stage('Login2DockerHub') { 37 | 38 | steps { 39 | sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin' 40 | } 41 | } 42 | stage('Approve - push Image to dockerhub'){ 43 | steps{ 44 | 45 | //----------------send an approval prompt------------- 46 | script { 47 | env.APPROVED_DEPLOY = input message: 'User input required Choose "yes" | "Abort"' 48 | } 49 | //-----------------end approval prompt------------ 50 | } 51 | } 52 | stage('Push2DockerHub') { 53 | 54 | steps { 55 | sh "docker push loksaieta/loksai-eta-app:latest" 56 | } 57 | } 58 | stage('Approve - Deployment to Kubernetes Cluster'){ 59 | steps{ 60 | 61 | //----------------send an approval prompt----------- 62 | script { 63 | env.APPROVED_DEPLOY = input message: 'User input required Choose "yes" | "Abort"' 64 | } 65 | //-----------------end approval prompt------------ 66 | } 67 | } 68 | stage('Deploy to Kubernetes Cluster') { 69 | steps { 70 | script { 71 | sshPublisher(publishers: [sshPublisherDesc(configName: 'kubernetescluster', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'kubectl apply -f k8smvndeployment.yaml', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '.', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '*.yaml')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)]) 72 | } 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /bin/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Justin Beall 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /bin/README.md: -------------------------------------------------------------------------------- 1 | # mvn-hello-world-web-app 2 | Java Hello World web application created using maven-archetype-webapp 3 | 4 | #Test 5 | 6 | ## Dependancies 7 | * git 8 | * maven 9 | * tomcat 10 | 11 | -------------------------------------------------------------------------------- /bin/k8smvndeployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: loksai-deploy 5 | labels: 6 | app: loksai-mvn-app 7 | spec: 8 | replicas: 3 9 | selector: 10 | matchLabels: 11 | app: loksai-mvn-app 12 | template: 13 | metadata: 14 | labels: 15 | app: loksai-mvn-app 16 | spec: 17 | containers: 18 | - name: loksai-mvn-container 19 | image: loksaieta/loksaidevops:v1.0 20 | ports: 21 | - containerPort: 8080 22 | --- 23 | apiVersion: v1 24 | kind: Service 25 | metadata: 26 | name: loksai-np-service 27 | labels: 28 | app: loksai-mvn-app 29 | spec: 30 | selector: 31 | app: loksai-mvn-app 32 | 33 | type: NodePort 34 | ports: 35 | - nodePort: 31000 36 | port: 8080 37 | targetPort: 8080 38 | -------------------------------------------------------------------------------- /bin/nodePort.yaml: -------------------------------------------------------------------------------- 1 | #Service Type nodePort 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: loksai-np-service 6 | labels: 7 | app: loksai-mvn-app 8 | spec: 9 | selector: 10 | app: loksai-mvn-app 11 | 12 | type: NodePort 13 | ports: 14 | - nodePort: 31000 15 | port: 8080 16 | targetPort: 8080 17 | -------------------------------------------------------------------------------- /bin/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | com.dev3l.hello_world 6 | mvn-hello-world 7 | war 8 | 1.0-SNAPSHOT 9 | mvn-hello-world Maven Webapp 10 | http://maven.apache.org 11 | 12 | 13 | javax.servlet 14 | servlet-api 15 | 2.5 16 | 17 | 18 | 19 | junit 20 | junit 21 | 4.12 22 | test 23 | 24 | 25 | 26 | org.apache.logging.log4j 27 | log4j-api 28 | 2.5 29 | 30 | 31 | org.apache.logging.log4j 32 | log4j-core 33 | 2.5 34 | 35 | 36 | 37 | mvn-hello-world 38 | 39 | 40 | org.apache.maven.plugins 41 | maven-compiler-plugin 42 | 3.1 43 | 44 | 1.8 45 | 1.8 46 | 47 | 48 | 49 | 50 | org.apache.maven.plugins 51 | maven-war-plugin 52 | 2.4 53 | 54 | false 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /bin/s1.txt: -------------------------------------------------------------------------------- 1 | adfas 2 | adf 3 | asdhffghf 4 | f 5 | g 6 | hfg 7 | asdgasdas,nj,nknl 8 | jklklkjlk 9 | dfsdf 10 | 11 | 12 | adf 13 | -------------------------------------------------------------------------------- /bin/s2.txt: -------------------------------------------------------------------------------- 1 | ngfdhgfhgf 2 | sdfasd 3 | fasd 4 | fasasdfasdfasdasdfasdfasdfasdfasdf 5 | asd 6 | fasdf 7 | as 8 | df 9 | s 10 | df 11 | sadf 12 | s 13 | dfs 14 | dffas 15 | df 16 | asdf 17 | asd 18 | fasdf 19 | sa 20 | df 21 | s 22 | df 23 | sdf 24 | sdf 25 | sd 26 | f 27 | dfas 28 | df 29 | asdfasdfasdfasd 30 | fasdfas 31 | df 32 | asd 33 | f 34 | asdfasdf 35 | sdf 36 | adfasdfasd 37 | f 38 | asdf 39 | asdfsdf 40 | adfasdf 41 | asd 42 | fasd 43 | fas 44 | df 45 | asdf 46 | sad 47 | fs 48 | df 49 | asdf 50 | asdfdfsdf 51 | -------------------------------------------------------------------------------- /bin/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | Archetype Created Web Application 7 | 8 | -------------------------------------------------------------------------------- /bin/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | www.loksaieta.com 6 | 7 | 8 | 9 |
10 | Spidertocat 12 |

Hello Everyone

13 |

dcp april.......... ...

14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /bin/src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./log 5 | WARNING 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /bin/src/test1.txt: -------------------------------------------------------------------------------- 1 | test1 2 | -------------------------------------------------------------------------------- /bin/src/test2.txt: -------------------------------------------------------------------------------- 1 | adfas 2 | -------------------------------------------------------------------------------- /bin/src/testvsfile.txt: -------------------------------------------------------------------------------- 1 | rec1 2 | 3 | rece 4 | 5 | -------------------------------------------------------------------------------- /k8smvndeployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: loksai-deploy 5 | labels: 6 | app: loksai-mvn-app 7 | spec: 8 | replicas: 3 9 | selector: 10 | matchLabels: 11 | app: loksai-mvn-app 12 | template: 13 | metadata: 14 | labels: 15 | app: loksai-mvn-app 16 | spec: 17 | containers: 18 | - name: loksai-mvn-container 19 | image: loksaieta/loksaidevops:v1.0 20 | ports: 21 | - containerPort: 8080 22 | --- 23 | apiVersion: v1 24 | kind: Service 25 | metadata: 26 | name: loksai-np-service 27 | labels: 28 | app: loksai-mvn-app 29 | spec: 30 | selector: 31 | app: loksai-mvn-app 32 | 33 | type: NodePort 34 | ports: 35 | - nodePort: 31000 36 | port: 8080 37 | targetPort: 8080 38 | -------------------------------------------------------------------------------- /nodePort.yaml: -------------------------------------------------------------------------------- 1 | #Service Type nodePort 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: loksai-np-service 6 | labels: 7 | app: loksai-mvn-app 8 | spec: 9 | selector: 10 | app: loksai-mvn-app 11 | 12 | type: NodePort 13 | ports: 14 | - nodePort: 31000 15 | port: 8080 16 | targetPort: 8080 17 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | com.dev3l.hello_world 6 | mvn-hello-world 7 | war 8 | 1.0-SNAPSHOT 9 | mvn-hello-world Maven Webapp 10 | http://maven.apache.org 11 | 12 | 13 | javax.servlet 14 | servlet-api 15 | 2.5 16 | 17 | 18 | 19 | junit 20 | junit 21 | 4.12 22 | test 23 | 24 | 25 | 26 | org.apache.logging.log4j 27 | log4j-api 28 | 2.5 29 | 30 | 31 | org.apache.logging.log4j 32 | log4j-core 33 | 2.5 34 | 35 | 36 | 37 | mvn-hello-world 38 | 39 | 40 | org.apache.maven.plugins 41 | maven-compiler-plugin 42 | 3.1 43 | 44 | 1.8 45 | 1.8 46 | 47 | 48 | 49 | 50 | org.apache.maven.plugins 51 | maven-war-plugin 52 | 2.4 53 | 54 | false 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /s1.txt: -------------------------------------------------------------------------------- 1 | adfasfdasdfsd 2 | ghfg 3 | -------------------------------------------------------------------------------- /s2.txt: -------------------------------------------------------------------------------- 1 | asdfasdfasdfasdfsadfds 2 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | Archetype Created Web Application 7 | 8 | -------------------------------------------------------------------------------- /src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | www.loksaieta.com 6 | 7 | 8 | 9 |
10 | Spidertocat 12 |

Hello Everyone

13 |

My Web App - SA-RDevOps-30thMar - poll scm! ...

14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/test/java/com/dev3l/hello_world/test/ExampleTest.java: -------------------------------------------------------------------------------- 1 | package com.dev3l.hello_world.test; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | public class ExampleTest { 7 | @Test 8 | public void exampleTest() { 9 | Assert.assertTrue(true); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./log 5 | WARNING 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/test1.txt: -------------------------------------------------------------------------------- 1 | test1 2 | jhbjbhjbhjk -------------------------------------------------------------------------------- /src/test2.txt: -------------------------------------------------------------------------------- 1 | adfas 2 | -------------------------------------------------------------------------------- /src/testvsfile.txt: -------------------------------------------------------------------------------- 1 | rec1 2 | 3 | rece 4 | 5 | --------------------------------------------------------------------------------