Skip to content

Java Maven Application Deployed Using Terraform Module and Jenkins . The final project of SDA DevOps Boot Camp 2022

Notifications You must be signed in to change notification settings

raghadmta/duihua-devops-project

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Description

The project is designed to provision a Sonarqube and MySql server using Docker Containers to be used in this Module.

  • it uses Terraform Scripts as infrastructure as a code (IaC) to create:

    • EC2 instance
    • VPC
    • S3 bucket
    • ElasticBeanstalk on high-availability infrastructure (Load Balancer)
    • CloudFront

    The project will host the maven application that is tested, scanned using Sonarqube, and built using Jenkins pipeline as a CI/CD tool.

Architecture-diagram

architecture-diagram

Terraform structure

  .
  └── Terraform
    ├── install.sh
    ├── main.tf
    ├── outputs.tf
    ├── variables.tf
    ├── modules
         ├── aws-ec2
         │   ├── main.tf
         │   ├── outputs.tf
         │   └── variables.tf
         ├── aws-ec2-key
         │   ├── main.tf
         │   ├── outputs.tf
         │   └── variables.tf
         ├── aws-elasticbeanstalk-cloudfront
         │   ├── main.tf
         │   ├── outputs.tf
         │   └── variables.tf
         ├── aws-s3bucket
         │   ├── main.tf
         │   ├── outputs.tf
         │   └── variables.tf
         └── aws-vpc
            ├── main.tf
            ├── outputs.tf
            └── variables.tf

Step by Step Guide

to run this deployment pipline follow this steps:

To clone a specific branch:

git clone --branch <branch> <remote_repo_url>
  • add the deployment pipline files in youre project

    • image

    • Screenshot 2022-09-19 093436

  • Add the .gitignore file content in this repository to the .gitignore file in your project

    • image
  • search for /// and fill the necessary changes which are :

    • S3 bucket name
    • Screenshot 2022-09-19 115443
  • Run the next commands in main diectory:

    • terraform -chdir=Terraform init

    • Screenshot 2022-09-19 120256

    • terraform -chdir=Terraform plan

    • terraform -chdir=Terraform apply

    • Screenshot 2022-09-19 125708

      • After the apply the Public public_ip of The EC2 instance will be printed in the Termianl
        • Screenshot 2022-09-19 121134
    • First: Change the application.properties

      • we used a docker container image as our MySql Database
        • go to \src\main\resources\application.properties and change the Database properties to
          spring.mvc.view.prefix=/WEB-INF/
          spring.datasource.url=jdbc:mysql://public_ip:3306/mysql
          spring.datasource.username=mysql
          spring.datasource.password=mysql
          spring.jpa.hibernate.ddl-auto=create
          spring.mvc.hiddenmethod.filter.enabled=true
          
        • image

    • Secound: SonarQube

      • go to public_ip:9000 which will open the SonarQube Login page

        • image
        • Login as Admin
          • Username: admin
          • Passowrd: admin
          • image
      • Create a SonarQube Project

        • image
      • add the values in Jenkinsfile of youre project

        • Screenshot 2022-09-19 122141
      • push it to youre git-hub Repository


    • Third: Jenkins server

      • ssh into the aws EC2 instance and run

        sudo cat /var/lib/jenkins/secrets/initialAdminPassword
        
        • 2022-09-19 (20)
      • copy the password and set up Jenkins at public_ip:8080

        • image
        • image
      • Jenkins Credentials you need to run this project:

        • aws Credentails

          • add aws Credentails with these ID in Jenkins server:
            • jenkins-access-key-id
            • jenkins-secret-access-key
              • image
        • Git-hub App (if youre repository was private)

    • Forth: Create a pipline in Jenkins

      • set Your Git-hub Repository in it and Build it
        • image

ElasticBeanStalk:

  • image

  • image

  • image


CloudFront:

  • image
  • image
  • image

The End .

Contributors

Sudos Team:

  1. Mohammed Shaikh
  2. Raghad Almutlaq
  3. Aisha Alsubaie
  4. Roba Almehmadi
  5. Eman Alotaibi

This project was part of Saudi Digital Acadmy's ( SDA ) DevOps BootCamp 2022 , Sudos Team

About

Java Maven Application Deployed Using Terraform Module and Jenkins . The final project of SDA DevOps Boot Camp 2022

Topics

Resources

Stars

Watchers

Forks

Languages

  • Java 72.0%
  • HCL 13.8%
  • CSS 5.8%
  • JavaScript 4.0%
  • HTML 2.2%
  • Shell 2.2%