Skip to content

πŸš€ A multi-container app using Docker Compose with a MySQL DB and a Python-based ML API. Accepts user input, returns predictions, and logs results with response time into the database.

Notifications You must be signed in to change notification settings

Aymen016/ModelOps-in-Docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Multi-Container Application Development and Deployment

πŸ“„ Overview

This project demonstrates the development and deployment of a multi-container application using Docker. It involves developing a simple application with two containers: a MySQL database container and a machine learning (ML) model serving API container.

πŸ”§ Develop a Simple Application with Two Containers

The task involves creating a custom multi-container application that consists of:

πŸ—„οΈ 1. DB Container (MySQL Database)

  • Database Name: Model_Logger
  • Table: Log
    • Columns:
      • πŸ†” ID: Unique identifier for each log entry.
      • πŸ“… Current_Date_Time: Timestamp of the log entry.
      • πŸ“₯ Input_Params: Input parameters for the ML model.
      • πŸ“€ Output: The output generated by the ML model.
      • ⏱️ Response Time: Time taken to process the input and generate the output.

πŸ€– 2. ML Serving API Container

  • This container runs a pre-trained ML model as a serving API.

  • The API accepts input, processes it with the ML model, generates an output, and then:

    • πŸ“‹ Logs the input parameters, output, and response time into the Log table in the MySQL database (running in a separate container).
    • πŸ’» Returns the result to the user.

    User Interface

    Below is a screenshot of the application's interface:

Screenshot 2024-11-04 184813

The interface allows users to input their height and weight, press the Predict button, and view the prediction result.

πŸ› οΈ Docker Compose

  • A docker-compose.yml file is included to manage both containers.
  • With Docker Compose, you can easily start and stop the entire application.

πŸ“‚ Directory Structure

  • app: Contains the code for the ML model serving API.
  • db-init-scripts: Contains SQL scripts to initialize the database, create the Model_Logger database, and Log table.
  • docker-compose.yml: The Docker Compose file to run and manage both containers.

πŸ“ Notes

  • Ensure that the ML model API is configured to connect to the MySQL database container for logging purposes.
  • Verify that the MySQL container is properly initialized with the required database and table on startup.

βš™οΈ Requirements

  • 🐳 Docker
  • πŸ“¦ Docker Compose

▢️ How to Run

  1. πŸ“₯ Clone the repository.
  2. πŸ’Ύ Ensure Docker and Docker Compose are installed on your machine.
  3. πŸš€ Run the application:
    docker-compose up
    
  4. πŸ›‘Stop the application:
    docker-compose down
    
    

About

πŸš€ A multi-container app using Docker Compose with a MySQL DB and a Python-based ML API. Accepts user input, returns predictions, and logs results with response time into the database.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published