The project showcases containerization using Docker, CI/CD pipeline automation with Jenkins, and Kubernetes orchestration with Minikube. The repository also includes automated testing for application reliability.
- Containerization: The application is containerized using Docker for consistent deployments.
- CI/CD Automation: Jenkins pipelines automate the build, test, and deployment processes.
- Kubernetes Deployment: Kubernetes YAML files manage the deployment and services on Minikube.
- Configuration Management: Ansible playbooks automate server setup and application deployment.
- Testing Framework: Automated testing with Pytest ensures application robustness.
├── ansible # Ansible playbooks for configuration management
│ ├── deploy.yaml # Deployment playbook
│ └── inventory.ini # Ansible inventory file
├── data # Data files for the AI application
│ └── sample.csv
├── k8s # Kubernetes YAML configurations
│ ├── deployment.yaml # Kubernetes deployment configuration
│ └── service.yaml # Kubernetes service configuration
├── src # Source code of the AI application
│ ├── app.py # Flask application
│ ├── analysis.py # Data analysis script
├── tests # Pytest test scripts
│ └── test_analysis.py
├── deployment_app.dockerfile # Dockerfile for building the application
├── Jenkinsfile # Jenkins pipeline for CI/CD
├── requirements.txt # Python dependencies
├── README.md # Documentation
- Python 3.8 or higher
- Docker
- Minikube
- Jenkins
Clone the repository:
git clone https://github.com/shubhambhavsar/Deployment_of_AI_Solutions.git
Create a virtual environment and activate it:
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
Install the necessary dependencies:
pip install -r requirements.txt
Start the Flask application:
python src/app.py
Now you can access the application by visiting http://127.0.0.1:5000 in your browser.
To containerize the application, run the following command:
docker build -t data-analytics-app .
Once the image is built, run the container:
docker run -p 5000:5000 data-analytics-app
- Install Jenkins on your local machine.
- Install the required plugins, such as Docker and GitHub.
The provided Jenkinsfile
defines the build, test, and deploy stages. You can modify it based on your needs.
In Jenkins, configure a new pipeline job pointing to this GitHub repository and trigger the pipeline to automate the process.
To start the Minikube local cluster, run:
minikube start
Apply the Kubernetes manifests to deploy the app:
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
Retrieve the Minikube IP to access the application:
minikube ip
Visit the provided IP in your browser.
To run the unit tests using Pytest, execute the following:
pytest tests/
Ensure all tests pass successfully.