Chạy local và sửa code
Backend
Chạy bằng Docker là đường chính của dự án:
cd E:\Sach\Sua\LMS_hohulili
copy .env.dev.example .env
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d db backend
Kiểm tra:
docker ps --format "table {{.Names}}\t{{.Ports}}\t{{.Status}}"
curl http://localhost:8088/actuator/health
API chính ở http://localhost:8088/api/v3, Swagger ở http://localhost:8088/swagger-ui.
Nếu docker ps cho thấy port 8088 đang thuộc container khác, curl localhost:8088 sẽ không phải backend LMS. Khi đó cần dừng container gây trùng port hoặc đổi port trước khi test LMS.
Frontend
cd E:\Sach\Sua\LMS_hohulili\fe
npm install
npm start
Mở http://localhost:4200.
Site tài liệu Just the Docs
Khuyến nghị chạy bằng Docker để không phải cài Ruby trực tiếp trên Windows:
cd E:\Sach\Sua\LMS_hohulili
docker rm -f lms-docs-site
docker run -d --name lms-docs-site -p 4010:4000 -v "${PWD}:/workspace" -w /workspace/docs-site ruby:3.3 bash -lc "gem install bundler -N && bundle install && bundle exec jekyll serve --host 0.0.0.0 --port 4000"
Nếu máy đã cài Ruby/Jekyll thì có thể chạy trực tiếp:
cd E:\Sach\Sua\LMS_hohulili\docs-site
bundle install
bundle exec jekyll serve --host 127.0.0.1 --port 4010 --livereload
Mở http://127.0.0.1:4010.
Nếu cần kiểm container docs đang chạy:
docker ps --filter name=lms-docs-site
docker logs lms-docs-site --tail 50
Port 4000 là port mặc định bên trong Jekyll container. Bên ngoài máy Windows đang map sang 4010, nên mở http://127.0.0.1:4010.
Khi thầy yêu cầu sửa code
| Việc cần sửa | Thường mở file |
|---|---|
| Đổi màu, spacing, layout | fe/src/styles.scss, component .scss, Tailwind class trong template |
| Đổi logic UI | component .ts, service trong fe/src/app/core hoặc features/.../services |
| Đổi route | fe/src/app/app.routes.ts, features/**/**.routes.ts |
| Đổi API frontend gọi | fe/src/app/api/client, fe/src/app/api/endpoints, service feature |
| Đổi logic nghiệp vụ backend | backend/src/main/java/com/example/lms/<module>/application/usecase |
| Đổi schema DB | tạo migration mới trong backend/src/main/resources/db/migration |
| Đổi upload/video/offline | shared, learning_delivery, fe/src/app/core/services |
Không sửa migration đã chạy ở production. Nếu cần đổi database, tạo file Vxxx__description.sql mới.