Skip to content

tabana1/MultiCloudDevOpsProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi Cloud DevOps Project

describe the project

This project demonstrates a complete CI/CD pipeline setup for a Java application using Terraform, Ansible, Jenkins, SonarQube, and OpenShift. The pipeline begins with infrastructure provisioning on AWS using Terraform, followed by configuration management and application deployment using Ansible, Jenkins, SonarQube and Deploy on OpenShift Cluster.

Table of Contents

Prerequisites

  • AWS Account
  • Terraform installed
  • Ansible installed
  • GitHub Account
  • OpenShift Cluster
  • DockerHub Account

Project Structure

Certainly! Here's the structured representation of your project directory that includes descriptions and explanations for each directory and its contents:

│   Jenkinsfile                    # Jenkins pipeline file for automation.
│   README.md                      # Project documentation file.
│
├───ansible                        # Directory for Ansible configurations and playbooks.
│   │   ansible.cfg                # Ansible configuration file.
│   │   ansible_playbook.yml       # Main Ansible playbook.
│   │   aws_ec2.yml                # Ansible playbook for AWS EC2 instances.
│   │   Project.pem                # PEM file for AWS access.
│   │
│   ├───Jenkins                    # Ansible roles and configurations for Jenkins.
│   │   │   .travis.yml            # Travis CI configuration for Jenkins.
│   │   │   README.md              # Documentation for Jenkins setup.
│   │   │
│   │   ├───defaults               # Default variables for Jenkins setup.
│   │   │       main.yml
│   │   │
│   │   ├───files                  # Directory for Jenkins files.
│   │   │
│   │   ├───handlers               # Ansible handlers for Jenkins.
│   │   │       main.yml
│   │   │
│   │   ├───meta                   # Ansible metadata for Jenkins role.
│   │   │       main.yml
│   │   │
│   │   ├───tasks                  # Ansible tasks for Jenkins.
│   │   │       main.yml
│   │   │
│   │   ├───templates              # Directory for Jenkins templates.
│   │   │
│   │   ├───tests                  # Tests directory for Jenkins.
│   │   │       inventory          # Inventory file for testing Jenkins.
│   │   │       test.yml           # Test playbook for Jenkins.
│   │   │
│   │   └───vars                   # Ansible variables for Jenkins.
│   │           main.yml
│   │
│   ├───OpenShift                  # Ansible roles and configurations for OpenShift.
│   │   │   .travis.yml            # Travis CI configuration for OpenShift.
│   │   │   README.md              # Documentation for OpenShift setup.
│   │   │
│   │   ├───defaults               # Default variables for OpenShift setup.
│   │   │       main.yml
│   │   │
│   │   ├───files                  # Directory for OpenShift files.
│   │   │
│   │   ├───handlers               # Ansible handlers for OpenShift.
│   │   │       main.yml
│   │   │
│   │   ├───meta                   # Ansible metadata for OpenShift role.
│   │   │       main.yml
│   │   │
│   │   ├───tasks                  # Ansible tasks for OpenShift.
│   │   │       main.yml
│   │   │
│   │   ├───templates              # Directory for OpenShift templates.
│   │   │
│   │   ├───tests                  # Tests directory for OpenShift.
│   │   │       inventory          # Inventory file for testing OpenShift.
│   │   │       test.yml           # Test playbook for OpenShift.
│   │   │
│   │   └───vars                   # Ansible variables for OpenShift.
│   │           main.yml
│   │
│   ├───postgres                   # Ansible roles and configurations for PostgreSQL.
│   │   │   .travis.yml            # Travis CI configuration for PostgreSQL.
│   │   │   README.md              # Documentation for PostgreSQL setup.
│   │   │
│   │   ├───defaults               # Default variables for PostgreSQL setup.
│   │   │       main.yml
│   │   │
│   │   ├───files                  # Directory for PostgreSQL files.
│   │   │
│   │   ├───handlers               # Ansible handlers for PostgreSQL.
│   │   │       main.yml
│   │   │
│   │   ├───meta                   # Ansible metadata for PostgreSQL role.
│   │   │       main.yml
│   │   │
│   │   ├───tasks                  # Ansible tasks for PostgreSQL.
│   │   │       main.yml
│   │   │
│   │   ├───templates              # Directory for PostgreSQL templates.
│   │   │
│   │   ├───tests                  # Tests directory for PostgreSQL.
│   │   │       inventory          # Inventory file for testing PostgreSQL.
│   │   │       test.yml           # Test playbook for PostgreSQL.
│   │   │
│   │   └───vars                   # Ansible variables for PostgreSQL.
│   │           main.yml
│   │
│   ├───prerequisite               # Ansible roles and configurations for prerequisites.
│   │   │   .travis.yml            # Travis CI configuration for prerequisites.
│   │   │   README.md              # Documentation for prerequisites setup.
│   │   │
│   │   ├───defaults               # Default variables for prerequisites setup.
│   │   │       main.yml
│   │   │
│   │   ├───files                  # Directory for prerequisite files.
│   │   │
│   │   ├───handlers               # Ansible handlers for prerequisites.
│   │   │       main.yml
│   │   │
│   │   ├───meta                   # Ansible metadata for prerequisites role.
│   │   │       main.yml
│   │   │
│   │   ├───tasks                  # Ansible tasks for prerequisites.
│   │   │       main.yml
│   │   │
│   │   ├───templates              # Directory for prerequisite templates.
│   │   │
│   │   ├───tests                  # Tests directory for prerequisites.
│   │   │       inventory          # Inventory file for testing prerequisites.
│   │   │       test.yml           # Test playbook for prerequisites.
│   │   │
│   │   └───vars                   # Ansible variables for prerequisites.
│   │           main.yml
│   │
│   └───sonarqube                  # Ansible roles and configurations for SonarQube.
│       │   .travis.yml            # Travis CI configuration for SonarQube.
│       │   README.md              # Documentation for SonarQube setup.
│       │
│       ├───defaults               # Default variables for SonarQube setup.
│       │       main.yml
│       │
│       ├───files                  # Directory for SonarQube files.
│       │       sonarqube.service  # Systemd service file for SonarQube.
│       │
│       ├───handlers               # Ansible handlers for SonarQube.
│       │       main.yml
│       │
│       ├───meta                   # Ansible metadata for SonarQube role.
│       │       main.yml
│       │
│       ├───tasks                  # Ansible tasks for SonarQube.
│       │       main.yml
│       │
│       ├───templates              # Directory for SonarQube templates.
│       │
│       ├───tests                  # Tests directory for SonarQube.
│       │       inventory          # Inventory file for testing SonarQube.
│       │       test.yml           # Test playbook for SonarQube.
│       │
│       └───vars                   # Ansible variables for SonarQube.
│               main.yml
│
├───my-app                          # Project-specific files and configurations.
│   │   .DS_Store                    # macOS system file, can be ignored.
│   │   build.gradle                 # Gradle build file for the project.
│   │   Dockerfile                   # Docker configuration file.
│   │   gradlew                      # Gradle wrapper script for Unix-based systems.
│   │   gradlew.bat                  # Gradle wrapper script for Windows.
│   │   settings.gradle              # Gradle settings file for the project.
│   │
│   ├───gradle                       # Gradle wrapper directory.
│   │   └───wrapper
│   │           gradle-wrapper.jar   # Gradle wrapper JAR.
│   │           gradle-wrapper.properties  # Gradle wrapper properties file.
│   │
│   └───src                          # Source directory for the project.
│       └───main
│           ├───java                 # Java source directory.
│           │   └───com/example/demo # Package structure for Java classes.
│           │       └───controller   # Controller classes.
│           │               HomeController.java  # Example controller.
│           │
│           └───resources            # Resource directory.
│               │   application.properties  # Application properties file.
│               │
│               └───templates        # Templates directory.
│                       index.html   # Example HTML template file.
│
├───openshift                       # OpenShift deployment configuration files.
│       deployment.yaml              # Deployment configuration for OpenShift.
│       route.yaml                   # Route configuration for OpenShift.
│       service.yaml                 # Service configuration for OpenShift.

Terraform Setup

  1. Clone the Repository:

    git clone <repository-url>
    cd <repository-directory>/terraform
    
    
  2. Configure Variables:

    Edit the terraform.tfvars file to set values for your AWS setup.

  3. Initialize Terraform:

    terraform init
    
    
  4. Review the Plan:

     terraform plan
    
    
  5. Apply the Configuration:

    terraform apply
    

    Confirm the action by typing yes when prompted.

Review the Created Enviroment

  1. AWS Resources Created:

    • EC2 Instances

    • CloudWatch with SNS topic for email notifications

    • S3 Bucket for Terraform state file backend

Ansible Setup

  1. Navigate to Ansible Directory:

    cd ../Ansible
    
    
  2. Install Jenkins, SonarQube, Docker, and OC CLI:

    Use Ansible roles to install the necessary services.

  3. Dynamic Inventory:

    Use the aws_ec2 plugin for dynamic inventory.

  4. Generate Private Key:

    Terraform will generate private_key.pem and add it to the Ansible folder.

  5. Run Ansible Playbook:

    ansible-playbook -i aws_ec2.yml playbook.yml
    
    

Jenkins

  1. Pipeline Configration:

    • Choose SCM and add repository URL and branch name.

Running the Pipeline

  1. Run Pipeline: Execute the pipeline from Jenkins.

  2. Monitor Pipeline:

    Ensure the pipeline runs successfully.

Results

  1. SonarQube :

    Review code quality reports on SonarQube.

  1. Application Deployment:

    Verify your application is running on the OpenShift cluster.

    Login In Your Cluster and Run

    oc get all -n namespace
    
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published