Micro -tailored for microservices. Core - algorithm model centric
A Python Framework to build microservice.
Developers routinely grapple with boilerplate code and server, sinking valuable time into these repetitive tasks when building microservices.
Moreover, efforts across different projects to build microservices are often fragmented, leading to duplicated work and inefficiencies.
MicroCore's aim is to consolidate the collective expertise of developers into a singular, feature-rich framework that is not only robust and reliable but also rigorously tested to meet real-world challenges.
- Rapidly build production-ready microservices using code/algorithm/model functions.
- Auto-generate API endpoints with API-docs
- Configurable through config file, to prefine features such as interfaces (REST API/Kafka), run-modes (CLI/GUI, Batch/RealTime)
- Logging & Monitoring using OpenTelemetry
- (in-progress) Automatically load pre-defined GUI templates for interaction.
- (in-progress) Docker Export
- (in plans) Internal watchdog and health monitoring
- (in plans) Adminstration with activity and performance metrics stored in sqlite Database.
- (in plans) Microservices Security and Authentication such as Token-Based Authentication(JWT/oAuth2.0), Role-Based Access Control,Data Encryption and Audit, Rate limiting against DDoS.
Status | Feature(s) | Goal |
---|---|---|
In-progress | Alpha | Implementation of core features including communication interfaces (API/KAFKA), Logging & Monitoring, deployment using config |
❏ | Dockerisation | Samples to dockerise a model/algorithm |
-
Python version 3.8+
-
Install using
pip
:from Gitlab repo (click to expand...)
pip install [email protected]:wog/htx/s-s-coe/htx-inxeption/MicroCore.git
from source code (click to expand...)
pip install <your_directory>/Micro_core
from .whl file (click to expand...)
#Download the wheel file from the repository release page. pip install MicroCore_v1.0.whl
The following collection of examples demonstrate how MicroCore can support a variety of use-cases:
- 📄 Source Code
- 🌅 [UI Demo](coming soon)
- 📄 Source Code
- 🌅 [UI Demo](coming soon)
- 📄 Nothing here
CORE • HTTP API • GUI • OpenTelemetry • Docker Export
The core of every microservices built with MicroCore framework, is a template function that fulfills the following requirements:
- A single parameter called
input
which MUST be a subclass of the Pydantic BaseModel. - A single return
value
that MUST be a subclass of the Pydantic BaseModel. - The
input
parameter and returnvalue
MUST be annotated with Python typing hints.
With MicroCore, you can instantly launch a local HTTP (REST) API server for any compatible function:
#through function call in code
instance_core = MicroCore(your_function)
launch_api(instance_core,port,hostname)
This will launch a FastAPI server based on the OpenAPI standard and with an automatic interactive documentation.
💡 Go to your microservice "https://hostname:port/docs#/" to checkout the API endpoints .
Coming soon
OpenTelemetry is an open-source tool for monitoring and tracing applications. It's useful for FastAPI to trace requests and responses, revealing bottlenecks, while for Kafka, it traces the flow of messages to monitor processing times and detect issues.
To visualize the collected data, you can integrate OpenTelemetry with Jaeger, an open-source distributed tracing system, to gain insights into how your applications behave.
Checkout the repository wiki for the guide to monitor your microservices using dockerised Jaeger.
Coming soon
MicroCore provides the capability to export to a Docker image:
MicroCore export <your_microserice_app_folder> --format=docker my-microserice:latest
💡 The Docker export requires that Docker is installed on your machine.
After the successful export, the Docker image can be run as shown below:
docker run -p <your_port>:<your_port> my-microserice:latest