Skip to content

amanbh321/spe_mini_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scientific Calculator with DevOps Integration

Overview

This project is a Scientific Calculator implemented in Java and containerized using Docker. It follows DevOps best practices by integrating Jenkins for CI/CD, Docker for containerization, and Ansible for local deployment.

Features

  • Mathematical Functions:
    • Square Root (√x)
    • Factorial (x!)
    • Natural Logarithm (ln(x))
    • Power Function (x^b)
  • Dockerized for easy deployment
  • Automated deployment using Ansible
  • CI/CD Integration with Jenkins

Prerequisites

Make sure you have the following installed:

  • Java 11 or later
  • Docker
  • Ansible (for local deployment)
  • Jenkins (for CI/CD automation)
  • Git

Installation & Setup

1. Clone the Repository

git clone https://github.com/your-username/scientific-calculator.git
cd scientific-calculator

2. Build the Java Application

javac -d . src/com/aman/ScientificCalculator.java
jar -cvf ScientificCalculator.jar -C . com

3. Run Locally (Without Docker)

java -jar ScientificCalculator.jar

Docker Setup

1. Build Docker Image

docker build -t amanbh321/scientific-calculator:v3 .

2. Run Docker Container

docker run -d --name scientific-calculator -p 9090:8080 amanbh321/scientific-calculator:v3

3. Check Running Container

docker ps

4. View Logs

docker logs scientific-calculator

Ansible Deployment

1. Run Ansible Playbook

ansible-playbook deploy.yml

This will:

  • Start the Docker service
  • Pull the latest Docker image
  • Stop any existing container
  • Deploy the updated version

CI/CD Pipeline with Jenkins

If Jenkins is configured, the following happens on git push:

  1. Jenkins Pulls Latest Code
  2. Builds Docker Image
  3. Pushes to DockerHub
  4. Deploys using Ansible

How to Demonstrate the Project

1. Running the Calculator in Docker

docker exec -it scientific-calculator /bin/bash
java -jar /app/ScientificCalculator.jar

2. Access the Web App (If applicable)

http://localhost:9090

3. Stop and Remove Containers After Demo

docker stop scientific-calculator
docker rm scientific-calculator

Troubleshooting

Check Docker Logs for Errors

docker logs scientific-calculator

Restart Docker Service

sudo systemctl restart docker

Rebuild & Redeploy If Issues Persist

docker rm -f scientific-calculator
docker rmi amanbh321/scientific-calculator:v3
docker build -t amanbh321/scientific-calculator:v3 .
docker run -d -p 9090:8080 amanbh321/scientific-calculator:v3

Author

Aman Bahuguna


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors