Skip to content

Frida7771/cloud-dist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CloudDist

A lightweight cloud storage built with Go, Gin, and GORM.

Prerequisites

  • Go 1.23+
  • MySQL
  • Redis
  • AWS S3
  • Node.js 18+ (for frontend)

Quick Start

One-Click Startup (Recommended)

  1. Setup Database

    mysql -u root -p < setup_db.sql
  2. Install Dependencies

    # Backend dependencies
    go mod tidy
    
    # Frontend dependencies
    cd frontend && npm install && cd ..
  3. Configure Edit configs/config.yaml or set environment variables:

    export AWSAccessKeyID=your-access-key
    export AWSSecretAccessKey=your-secret-key
    export S3Bucket=your-bucket-name
    export AWSRegion=us-east-1
  4. Start All Services

    ./start.sh

    This will start:

  5. Stop All Services

    ./stop.sh

    Or press Ctrl+C in the terminal where start.sh is running.

Manual Startup (Alternative)

If you prefer to start services separately:

Backend:

go run ./cmd/cloud-dist/main.go -config configs/config.yaml

Frontend:

cd frontend
npm run dev

Stripe CLI (for webhook testing):

stripe listen --forward-to localhost:8888/api/storage/purchase/webhook

Visit http://localhost:3000 to use the application.

Features

  • User authentication with JWT
  • File upload/download with S3 storage
  • File management (folders, rename, move, delete)
  • File sharing and friend system
  • Storage purchase with Stripe payment

Tech Stack

  • Backend: Go, Gin, GORM
  • Frontend: React, JavaScript
  • Storage: AWS S3
  • Cache: Redis
  • Payment: Stripe

Monitoring (optional)

The backend exposes Prometheus metrics at http://localhost:8888/metrics (HTTP request rate / latency, Go runtime, upload-pipeline outcomes, S3 call duration). A pre-wired Prometheus + Grafana stack lives under deploy/monitoring/:

cd deploy/monitoring && docker compose up -d
  • Grafana: http://localhost:3001 (admin / admin) — the Cloud Disk Overview dashboard is auto-loaded with four sections (HTTP, Upload pipeline, S3, Go runtime).
  • Prometheus: http://localhost:9090 — scrape targets and ad-hoc PromQL.

The Prometheus scrape target is host.docker.internal:8888, which works out of the box on Docker Desktop (Mac / Windows). On Linux, uncomment the extra_hosts block in deploy/monitoring/docker-compose.yaml (or replace the target in deploy/monitoring/prometheus/prometheus.yml with your host's LAN IP).

To shut everything down: docker compose down (the named volumes keep your Grafana state and Prometheus history across restarts; add -v to wipe them).

Demo

CloudDist Interface

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors