This project is a multi-service application that integrates a machine learning service, a frontend, a database, and a camera service for classroom face recognition.
- ml_service: Provides ML-based face detection/recognition (exposes HTTP endpoints on port 8000).
- frontend: Hosts the user interface and classroom updates (exposes HTTP endpoints on port 3000).
- database: Manages student data (exposes HTTP endpoints on port 5002).
- camera: A one-shot service that captures an image, processes it, and triggers updates in the other services.
- Docker installed and running.
- Basic familiarity with Docker and Docker Compose.
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Build and run all services:
There are multiple ways to build and run the services:
Option 1: Using Docker Compose directly (recommended):
# Build and start all services docker-compose up # Or to rebuild from scratch: docker-compose up --build # To run in background mode: docker-compose up -d
Option 2: Using Makefiles:
make all
Option 3: Run camera service which triggers the pipeline:
docker-compose run camera
-
Running individual services:
You can also build or run services individually:
-
Using Docker Compose:
docker-compose up ml-service docker-compose up database docker-compose up frontend
-
Using Makefiles:
make ml_service make database make frontend make camera
-
After running docker-compose up, you can test each service individually using curl commands:
# Test the ML service health endpoint
curl http://localhost:8000/api/health
# Test face recognition with a sample image
curl -X POST \
-H "Content-Type: application/json" \
-d "{\"Image\": {\"Bytes\": \"$(base64 -i ./database/db_images/jayvin.jpg)\"} }" \
http://localhost:8000/api/predict# Check database health
curl http://localhost:5002/api/health
# Get a student by ID
curl http://localhost:5002/api/student?studentId=jayvin
# Add a new student
curl -X POST \
-H "Content-Type: application/json" \
-d '{"studentId": "newstudent", "name": "New Student", "email": "new@example.com", "photoReference": "newstudent.jpg"}' \
http://localhost:5002/api/student# Stop all services but keep volumes
docker-compose down
# Stop services and remove volumes (complete cleanup)
docker-compose down -v