Skip to content

KSU-MS/cloud-nix-sandbox

Repository files navigation

FSAE Log Hosting Service

A comprehensive log hosting service built specifically for Formula SAE teams to manage and access log files efficiently.

Features

  • File Upload: Support for multiple log file formats (.mcap, .bag, .can, .log, .csv)
  • Automatic Metadata Extraction: Extracts metadata from MCAP files including timestamps, message counts, and channels
  • Google Cloud Storage Integration: Secure file storage with signed URL downloads
  • MongoDB Indexing: Fast search and filtering capabilities
  • Real-time Indexing: Background service automatically indexes new files
  • RESTful API: FastAPI backend with automatic documentation
  • Modern Frontend: React 18 with Vite for fast development
  • Authentication: Token-based API security
  • Docker Deployment: Easy local development and production deployment

Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   React App     │    │   FastAPI       │    │   Indexer       │
│   (Frontend)    │◄──►│   (Backend API) │    │   (Background)  │
│   Port: 3000    │    │   Port: 8000    │    │                 │
└─────────────────┘    └─────────────────┘    └─────────────────┘
         │                       │                       │
         │                       │                       │
         ▼                       ▼                       ▼
┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│     MongoDB     │    │  Google Cloud   │    │     MongoDB     │
│   Port: 27017   │    │    Storage      │    │   (Indexing)    │
└─────────────────┘    └─────────────────┘    └─────────────────┘

Quick Start

Prerequisites

  • Docker and Docker Compose
  • Google Cloud Platform account with Storage API enabled
  • Service account key for GCS access

Setup

  1. Clone the repository

    git clone <repository-url>
    cd cloud-nix-sandbox
  2. Create environment file

    cp .env.example .env
  3. Configure environment variables Edit .env with your configuration:

    # MongoDB Configuration
    MONGO_INITDB_ROOT_USERNAME=admin
    MONGO_INITDB_ROOT_PASSWORD=your-secure-password
    MONGO_EXPRESS_USERNAME=admin
    MONGO_EXPRESS_PASSWORD=your-express-password
    
    # Google Cloud Storage
    GCS_BUCKET=your-bucket-name
    GOOGLE_APPLICATION_CREDENTIALS=/app/service-account-key.json
    
    # API Security
    API_TOKEN=your-secure-api-token
  4. Add your GCS service account key Place your service account JSON file as service-account-key.json in the root directory.

  5. Start the services

    docker-compose -f compose.prod.yaml up -d
  6. Access the application

API Endpoints

Upload Log File

POST /upload
Authorization: Bearer {token}
Content-Type: multipart/form-data

Form Data:
- file: Log file to upload
- car_name: Name of the car (required)
- label: Optional description/label

List Log Files

GET /logs?car_name={car}&log_type={type}&start_date={date}&end_date={date}
Authorization: Bearer {token}

Get Download URL

GET /logs/{log_id}/download
Authorization: Bearer {token}

Health Check

GET /health

Development

Backend Development

cd backend/api
pip install -r requirements.txt
uvicorn main:app --reload --host 0.0.0.0 --port 8000

Frontend Development

cd frontend
npm install
npm run dev

Indexer Development

cd backend/indexer
pip install -r requirements.txt
python main.py

About

frick sharepoint

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published