Skip to content

ana-slkn/Cloud-Lab

Repository files navigation

1: Setting Up the Environment

  1. Configured WSL/Ubuntu and installed prerequisites:

    • python3, pip, venv, docker, kubectl
  2. Downloaded monolithic source files

    • Including the MobileNet SSD model files
  3. Tested monolith.py locally

    • Verified result was saved as result.jpg

2: Splitting into Microservices

1. image_grab_service

  • Accepts images via /upload (Flask + HTTP POST)
  • Stores image to MinIO: original/<image_id>.jpg
  • Pushes metadata (image_id, original_path) to resize_queue

2. resize_service

  • Listens to resize_queue
  • Downloads image from MinIO
  • Resizes image (25%)
  • Stores to resized/<image_id>.jpg
  • Pushes metadata (path, origin_h, origin_w) to grayscale_queue

3. grayscale_service

  • Listens to grayscale_queue
  • Converts image to grayscale
  • Stores to grayscale/<image_id>.jpg
  • Pushes metadata to objectdetect_queue

4. objectdetect_service

  • Listens to objectdetect_queue
  • Loads MobileNet SSD model
  • Runs detection on grayscale image (converted to BGR)
  • Pushes detections and image_id to tag_queue

5. tag_service

  • Listens to tag_queue
  • Loads original image
  • Draws labeled bounding boxes
  • Stores final result to tagged/<image_id>.jpg

3: Containerization (Docker)

Each service:

  • Has its own Dockerfile
  • Installs dependencies via requirements.txt
  • Entrypoint is the service's Python script

4: Kubernetes Deployment

  1. Deployed Redis using redis.yaml

  2. Deployed MinIO using minio.yaml

    • Web UI exposed via NodePort 30003
  3. Each microservice had a .yamlfile used for deployment. It sets environment variables for redis and minio.

  4. Exposed ImageGrabService on NodePort 30005

  5. Example:

docker build -t aneka457/resize-service .
docker push aneka457/resize-service
kubectl apply -f resize-deployment.yaml

5: Execution Flow

  1. Image uploaded via curl:
curl -X POST -F "image=@test.jpg" http://<EC2_IP>:30005/upload
  1. Image passed through all stages:

    • Saved at each step in MinIO
  2. Final image viewable/downloadable from MinIO Web UI under tagged/

Image Processing Pipeline

                     ┌─────────────────────┐
                     │   ImageGrabService  │
                     │  ────────────────   │
                     │ Accepts image via   │
 curl/upload  ───▶   │ HTTP POST (/upload) │
                     │ Stores to:          │
                     │ images/original/    │
                     │ Pushes to:          │
                     │ resize_queue        │
                     └─────────┬───────────┘
                               │
                               ▼
                     ┌─────────────────────┐
                     │   ResizeService     │
                     │  ────────────────   │
                     │ Downloads from:     │
                     │ images/original/    │
                     │ Stores to:          │
                     │ images/resized/     │
                     │ Pushes to:          │
                     │ grayscale_queue     │
                     └─────────┬───────────┘
                               │
                               ▼
                     ┌─────────────────────┐
                     │  GrayscaleService   │
                     │  ────────────────   │
                     │ Downloads from:     │
                     │ images/resized/     │
                     │ Stores to:          │
                     │ images/grayscale/   │
                     │ Pushes to:          │
                     │ objectdetect_queue  │
                     └─────────┬───────────┘
                               │
                               ▼
                     ┌────────────────────────┐
                     │ ObjectDetectService    │
                     │  ────────────────────  │
                     │ Downloads from:        │
                     │ images/grayscale/      │
                     │ Pushes detection info  │
                     │ (no image) to:         │
                     │ tag_queue              │
                     └─────────┬──────────────┘
                               │
                               ▼
                     ┌─────────────────────┐
                     │     TagService      │
                     │  ────────────────   │
                     │ Downloads from:     │
                     │ images/original/    │
                     │ Draws boxes         │
                     │ Stores to:          │
                     │ images/tagged/      │
                     └─────────────────────┘

                     ┌──────────────┐
                     │     MinIO    │  -> queue system, do one thing
                     │ Object Store │  -> does not depend directly on the others, communicate through a queue system
                     └──────────────┘  -> each service pushes metadata (like image ID and path) into a Redis queue, and the next     service listens for it.

                     ┌──────────────┐
                     │    Redis     │  -> acts as object storage for big files (like a local Amazon S3)
                     │ Message Bus  │  -> images are too big to be passed through a reddis queue, so we pass only the metadata
                     └──────────────┘  -> each service reads from or writes to a subfolder in the images bucket

Future work:

  • Add detailed logs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors