KB-197C

Kiến trúc Storage — VPS Metadata + Google Drive Files

2 min read Revision 1
architecturevisionstoragegoogle-drivemetadatavps

Kiến trúc Storage — VPS Metadata + Google Drive Files

Ngày: 2026-03-24. Trạng thái: Thiết kế — chưa triển khai. Đọc: search_knowledge("storage google drive metadata")


NGUYÊN TẮC

  • VPS (96GB NVMe): chỉ lưu metadata (PG) + file nhỏ (thumbnail, avatar)
  • Google Drive (2TB, đã trả): lưu file thực (documents, images, videos, PDFs)
  • User/khách không biết file nằm ở GDrive — trải nghiệm liền mạch

FLOW

Upload: User → Web (VPS) → lưu tạm → Google Drive API → ghi metadata PG → xóa tạm
Download: User click → redirect GDrive link (hoặc VPS proxy stream)

TRIỂN KHAI

Directus hỗ trợ sẵn Google Drive Storage Adapter. Config env, không cần code thêm.

Hoặc script đơn giản: upload xong → gọi GDrive API → ghi gdrive_id vào PG → xóa local.

LƯU Ý

  • File lớn (>5MB): GDrive direct link, không proxy qua VPS
  • File nhỏ (thumbnail): giữ trên VPS cho nhanh
  • Google Drive API: miễn phí, 12,000 req/phút
  • Backup: GDrive tự backup, không cần lo
  • Assembly First: Directus Storage Adapter đã giải quyết