Complete infrastructure for the SmartClass face-recognition attendance system.
┌─────────────────────────────────────────────────────────────────────┐
│ Docker Compose Stack │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────┐ ┌──────────┐ ┌─────────┐ ┌──────────────────────┐ │
│ │ Redis │ │PostgreSQL│ │ API │ │ API Worker │ │
│ │ :6379 │ │ :5432 │ │ :8000 │ │ (background jobs) │ │
│ └────┬────┘ └────┬─────┘ └────┬────┘ └──────────┬───────────┘ │
│ │ │ │ │ │
│ ┌────┴─────────────┴─────────────┴───────────────────┘ │
│ │ │
│ ┌─────────┐ ┌──────────┐ ┌──────────────┐ │
│ │ Edge │ │ Frontend │ │ Prometheus │ │
│ │ :9100 │ │ :5173 │ │ :9090 │ │
│ └─────────┘ └──────────┘ └──────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘
1 git clone < repo-url > smartclass
2 cd smartclass
3
4 # Create environment file
5 cp .env.example .env
6
7 # Generate a secure JWT secret
8 python -c "import secrets; print(f'JWT_SECRET_KEY={secrets.token_hex(32)}')" >> .env
1 # Start the full stack
2 docker compose up -d
3
4 # Check all services are running
5 docker compose ps
6
7 # View logs
8 docker compose logs -f
1 # Quick health check
2 ./scripts/healthcheck.sh
3
4 # Full smoke test
5 python scripts/postdeploy_smoke_check.py
smartclass-ops/
├── docker-compose.yml # Full service stack
├── Dockerfile # Edge node container
├── .env.example # Environment template
├── .github/
│ └── workflows/
│ └── ci-cd.yml # CI/CD pipeline
├── services/
│ └── api/
│ ├── Dockerfile # API server container
│ ├── alembic.ini # Migration config
│ ├── alembic/
│ │ ├── env.py # Async SQLAlchemy support
│ │ ├── script.py.mako # Migration template
│ │ └── versions/
│ │ └── 001_initial.py # Initial schema
│ └── init_db.sql # DB initialization
├── frontend/
│ ├── Dockerfile # Multi-stage React build
│ └── nginx.conf # SPA routing config
├── monitoring/
│ ├── prometheus.yml # Scrape configuration
│ ├── smartclass_alerts.yml # Alert rules (6 alerts)
│ └── grafana_dashboard.json # Pre-built dashboard
├── scripts/
│ ├── healthcheck.sh # System health check
│ ├── postdeploy_smoke_check.py # Post-deploy validation
│ ├── create_deploy_bundle.py # Bundle creation for edge
│ ├── apply_deploy_bundle.ps1 # Bundle deployment (PowerShell)
│ └── register_edge_node.py # Edge node registration
├── src/
│ └── edge_metrics.py # Prometheus metrics exporter
└── config/
└── edge_config.yaml # Edge node configuration
1 # Start all
2 docker compose up -d
3
4 # Stop all (preserve data)
5 docker compose down
6
7 # Stop all (remove data)
8 docker compose down -v
9
10 # Restart single service
11 docker compose restart api
1 # Rebuild API
2 docker compose up -d --build api
3
4 # Rebuild edge
5 docker compose up -d --build edge
6
7 # Rebuild all
8 docker compose up -d --build
1 docker compose logs -f api # API server
2 docker compose logs -f edge # Edge pipeline
3 docker compose logs -f api_worker # Background worker
4 docker compose logs --tail 100 api # Last 100 lines
1 # Apply all pending migrations
2 docker compose exec api alembic upgrade head
3
4 # Create new migration after model changes
5 docker compose exec api alembic revision --autogenerate -m "Add new table"
6
7 # Rollback last migration
8 docker compose exec api alembic downgrade -1
9
10 # View migration history
11 docker compose exec api alembic history
1 python scripts/register_edge_node.py \
2 --node-id rpi5-room301 \
3 --section AIML-3-A \
4 --api-url http://central-server:8000
1 python scripts/create_deploy_bundle.py --section AIML-3-A
2 python scripts/create_deploy_bundle.py --section AIML-3-A --include-models
1 powershell - ExecutionPolicy Bypass - File scripts/apply_deploy_bundle . ps1 `
2 - BundleZip data / deploy/latest_bundle . zip `
3 - SectionKey AIML-3-A `
4 - DataDir data
1 docker run -d \
2 --name smartclass-edge \
3 -v /opt/smartclass/config:/opt/smartclass/config:ro \
4 -v /opt/smartclass/models:/opt/smartclass/models:ro \
5 -v /opt/smartclass/data:/opt/smartclass/data \
6 -p 9100 :9100 \
7 -e REDIS_URL = redis://central-server:6379 \
8 -e EDGE_CONFIG_PATH = /opt/smartclass/config/edge_config.yaml \
9 smartclass-edge:latest
1 - targets : [ "192.168.1.103:9100" ]
2 labels :
3 service : "edge"
4 section : "CSE-2-B"
5 location : "room-205"
6 environment : "production"
1 git tag v1.2.0
2 git push origin v1.2.0
1 # Check logs
2 docker compose logs api
3
4 # Common fixes:
5 # 1. Database not ready - check postgres health
6 docker compose exec postgres pg_isready
7
8 # 2. Missing JWT_SECRET_KEY
9 grep JWT_SECRET_KEY .env
10
11 # 3. Run migrations
12 docker compose exec api alembic upgrade head
1 # Check Redis is running
2 docker compose exec redis redis-cli ping
3
4 # Check from edge container
5 docker compose exec edge python -c "import redis; r=redis.from_url('redis://redis:6379'); print(r.ping())"
6
7 # Check network
8 docker network inspect smartclass-ops_smartclass-net
1 # Check build args
2 docker compose logs frontend
3
4 # Rebuild with correct API URL
5 VITE_API_URL = http://your-api-server:8000 docker compose up -d --build frontend
1 # Check container memory usage
2 docker stats --no-stream
3
4 # Increase limits in docker-compose.yml:
5 # deploy:
6 # resources:
7 # limits:
8 # memory: 2G
This model repository was generated by
ML Intern , an agent for machine learning research and development on the Hugging Face Hub.
1 from transformers import AutoModelForCausalLM , AutoTokenizer
2
3 model_id = "balaji958685/smartclass-ops"
4 tokenizer = AutoTokenizer . from_pretrained ( model_id )
5 model = AutoModelForCausalLM . from_pretrained ( model_id )