Skip to content

TuLe142857/DocumentHub

Repository files navigation

Run pytest

Requirement

  • Python version: >= 3.12.x
  • Docker
  • uv
  • GNU Make(optional): dùng để viết các script build, run , ... cho gọn.
  • Hệ điều hành: Windows/Linux/MacOS

For Development & Testing

Clone repo & setup

git clone https://github.com/TuLe142857/DocumentHub.git
cd DocumentHub

# tạo sẵn thư mục này tránh docker tự tạo khi build(dễ dính quyền root)
mkdir -p ./backend/test_reports 

# Copy file .env từ .env.example
cp .env.example .env

Note

Có thể giữ nguyên file .env giống với file .env.example vẫn chạy được

Build

make build

Các port expose từ docker container ra máy host(Có thể chỉnh bằng <>_PORT_EXTERNAL trong file .env):

  • NGINX: 80
  • Backend: 8000
  • MYSQL: 3306
  • Redis: 6379
  • RedisInsight(Redis Web UI): 5540
  • MinIO API: 9001
  • MinIO Web UI: 9001
  • MailHog(SMTP server): 1025
  • MailHog(Web UI): 8025

Khởi tạo dữ liệu ban đầu

make enter-db command="cli db seed"

Run test

make test

Enter docker container

# service: tên service trong docker-compose.yml/docker-compose-dev.yml
# command: lệnh chạy (mặc định là bash để mở terminal)
# Ví dụ: make enter service=backend
make enter service=<> command=<>
# similar to 'make enter service=backend'
make enter-backend
# vào trực tiếp mysql cli bằng root account
make-enter-db
# Vào redis-cli(tự động đăng nhập)
make enter-redis

Stop

Dừng tất cả docker container, không xóa image và volume

make down

Stop and Clean

Dừng docker container, xóa image(local image(như backend), không bao gồm các image pull từ internet(như mysql, redis, ...)), xóa toàn bộ volume

make clean

For Production

Clone repo & setup

git clone https://github.com/TuLe142857/DocumentHub.git
cd DocumentHub

# tạo sẵn thư mục này tránh docker tự tạo khi build(dễ dính quyền root)
mkdir -p ./backend/test_reports 

# Copy file .env từ .env.example
cp .env.example .env

Note

Cần chỉnh sủa file .env:

  • Chỉnh giá trị ENVIROMENT=prod
  • Thay thế các giá trị changethis
  • Nhập các giá trị liên quan SMTP phù hợp

Build

SSH to server and run:

export ENVIRONMENT=prod
export target=prod
make build

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors