Skip to content

Maven Application which is being Deployed to the Host Server using the Continuous Integration and Continuous Deployment Infrastructural Pipeline.

License

Notifications You must be signed in to change notification settings

Tanish-Mishra/Maven-App-Deployment-Using-CI-CD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven Webapp Deployment Using Continuous Integration and Continuous Deployment Infrastructure


Github Jenkins Ansible Docker Tomcat

👨‍💻Live Version

Check out the website: Webapp Maven Application

  1. Project Description

    Hi 👋, This Project is about Maven Webapp Deployment by using the Continuous Integration and Continuous Deployment Infrastructure settled on the Jenkins Automation Server!.We are going to Build,Test and Deploy the Application on the Deployment Server which can be further modified by Anyone by forking the repository and make the changes to it then after raise the Pull Request which will be inspected to be merged after being merged(Steps Described Ahead in additon to do the changes to the Project) we will be able to see the Jenkins Job be triggered up by the github webhook In order to actually montior the Jenkins Job visit Click Here Login by Credentials given as follows -

    Username - guest
    Password - IamGuest
    1.Click on the Application Deployment Job

    As the Job Completes It triggers the Continuous Deployment Job

    2.Click on the Continuous Deployment Job

    Eventually,This Job Deploys the Application on the Tomcat Container Deployment Server


    This application consists of the following components:
    • A single-AWS-Linux-instance used as a Jenkins Automation Server to Build,Test and Deploy the Applicaion
    • A single-AWS-Linux-instance used as a Ansible App Deployment Server
    • A single-AWS-Linux-instance used as a Tomcat-Deployment Server where our Maven App will be Deployed

  2.    An elastic IP is allocated to the Deployment Server and Jenkins Automation Server so NO Worries about the IP being changed even after the unfortunate restart or shutdown! Visit the address with ease which are provided at required places!
    
  3. Tools and Technology
  4. Stages
    • The project includes three Stages for Maven Application Deployment. The modules are Building and Testing, shiping the artifact on Dockerhub and Deployment on Tomcat Docker Container on the Deployment Sever.

      • Building the Artifact and Testing Automatically by Maven

          First stage is about creation of Artifact and Testing Automatically by maven.Basically,Jenkins hold the charge and starts our Continuous Integration Process(know more about CI and CD here Know more) of building and Testing the application by Its plugin called Maven Integration Plugin which provides us the ease of Building the application and Testing it!

        • Docker image Creation:

          Again,Jenkins holds the charge and by using the plugin called publish over ssh the webapp artifact is sent to the ansible server where it is built as a Docker image by using the Dockerfile and the meaningfull ansible playbook which is triggerd by the Publish over ssh plugin as the webapp artifact is Successfully Publish over the ssh to the ansible Application Deployment Server!

      • Shipping to the Dockerhub

          Shipping is the process of pushing docker image to the repo where it is stored for the further use at any enviroment despite of the configuration mess.Here,Dockerhub is used as the service for the having the docker images

        • Tagging and Pushing

          By using the same Ansible Playbook responsible for the creation of the Docker Image further Modules does the tagging and Pushing to the DockerHub!

      • Deploying To The Tomcat Container on the Host Server

          Deloyment is done via the Approach of the Continuous Deployment where no Human Intervention is Required to make the configurations Ready to deploy the Application our Automated Pipeline reduces human efforts at massive extent.

        • Process of Deployment:

          Ansible Playbook lying on the Ansible Application Deployment Server is triggered by our Automation Server Jenkins and Ansible playbook starts the Process of Deploying the Application on The Tomcat Application Deployment Server by pulling the Application Image on the Deployment server and Creates the Container out of it with proper configuration and removes any older version of the image,removes any older running tomcat container with the older configuration and Deploys Fresh Application on the Server.Basically,If the Application does not exist on the Deployment server then the our playbook ignores the error caused by it and goes through the futher process defined.

How to make changes to the Project (overall process)

  1. Fork the project using the gray Fork button in the top right of this page.
  2. Make any changes in your forked repository.
  3. On this repo, click Pull Requests (which is the third option at the top of this page after the options Code and Issues) and raise a Pull Request by clicking the green New Pull Request button and selecting your fork from the right dropdown field.

You can ask questions by raising an issue.

How to clone the repository and make changes locally

  • Click on the green Code button, then either the HTTPS or SSH option and, click the icon to copy the URL. Now you have a copy of the project. Thus, you can play around with it locally on your computer.

  • Run the following commands into a terminal window (Command Prompt, Powershell, Terminal, Bash, ZSH). Do this to download the forked copy of this repository to your computer.

  git clone https://github.com/Tanish-Mishra/Maven-App-Deployment-Using-CI-CD.git
  • Switch to the cloned folder. You can paste this command into the same terminal window.
  cd Maven-App-Deployment-Using-CI-CD
  • Make a new branch. Your username would make a good branch because it's unique.
  git checkout -b <name-of-new-branch>
  • Open the /webapp/src/main/webapp/index.jsp file

  • Do changes. It can be a simple HTML element addition

  • Stage your changes.

  git add .
  • Commit the changes.
  git commit -m "YOUR-NAME"
  • Check the status of your repository.
  git status
  • The response should be like this:
On branch <name-of-your-branch>
nothing to commit, working tree clean
  • Pushing your repository to GitHub.
  git push origin <name-of-your-branch>

or

  git branch -M main
  git push -u origin main

If you get an error message like the one below, you probably forgot to fork the repository before cloning it. It is best to start over and fork the project repository first.

ERROR: Permission to Tanish-Mishra/Maven-App-Deployment-Using-CI-CD denied to <your-github-username>.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
  • On the GitHub website, navigate to your forked repo - on the top of the files section, you'll notice a new section containing a Compare & Pull Request button!

  • Click on that button, this will load a new page, comparing the local branch in your forked repository against the main branch in the Tanish-Mishra Maven-App-Deployment-Using-CI-CD repository. Accept the default values in the dropdown boxes and click the green Create Pull Request button. After creating the PR (Pull Request). Note: A pull request allows us to merge your changes with the original project repo.

  • Your pull request will be reviewed and then eventually merged.

Hurray! You successfully have made your Changes and also pushed them; Now you may,visit Click Here to see your changes! 🎉

NOTE: You will be Informed with a message that at what time your changes are going to be merged so that you can visit and see the Jenkins Job working in the Console Output ! Till then Please Be Patient:) !


About

Maven Application which is being Deployed to the Host Server using the Continuous Integration and Continuous Deployment Infrastructural Pipeline.

Resources

License

Stars

Watchers

Forks

Packages

No packages published