DTURelifeLink

Hướng dẫn cài đặt và import ứng dụng

Yêu cầu hệ thống

Phương án 1: Import từ Git Repository

Appsmith cho phép import ứng dụng trực tiếp từ Git repository thông qua Deploy Keys. Đây là cách được khuyến nghị để đảm bảo version control và collaboration.

Chi tiết có thể tham khảo tại Import apps from Git - Appsmith Docs

Bước 1: Tạo và thiết lập repositories

  1. Tạo các repositories mới trên GitHub:
    • Tạo repo cho Admin Portal (ví dụ: your-username/admin-portal)
    • Tạo repo cho Workforce Portal (ví dụ: your-username/workforce-portal)
    • Tạo repo cho User Portal (ví dụ: your-username/user-portal)
  2. Fork repositories mẫu:

Lưu ý:

Bước 2: Import vào Appsmith

  1. Truy cập Appsmith workspace
    • Mở Appsmith workspace
    • Click nút Create New ở góc phải trên
    • Chọn Import > Import from Git repository
  2. Cấu hình Git cho từng ứng dụng:
    • Chọn GitHub làm service provider
    • Click Configure Git
    • Copy SSH URL của repository của bạn (ví dụ: git@github.com:your-username/admin-portal.git)
    • Paste URL và click Generate SSH Keys
    • Copy key được tạo (ECDSA 256 hoặc RSA 4096)
    • Thêm Deploy key vào repository:
      • Vào Repository Settings > Deploy keys
      • Click “Add deploy key”
      • Paste key và đặt title
      • Check “Allow write access”
      • Click “Add key”
    • Quay lại Appsmith, click Connect Git
  3. Cấu hình Datasource
    • Trong modal Reconnect Datasources
    • Cập nhật thông tin kết nối cho từng datasource
    • Kiểm tra kết nối và lưu cấu hình

Bước 3: Kiểm tra hoạt động

Phương án 2: Import trực tiếp từ file

Nếu bạn không muốn sử dụng Git, bạn có thể import trực tiếp file JSON của ứng dụng:

  1. Download các file JSON từ thư mục src:
  2. Import vào Appsmith:
    • Click Create New > Import
    • Chọn Import from file
    • Upload file JSON tương ứng
    • Cấu hình lại datasources:
      • Kết nối MongoDB với URI có sẵn:
        mongodb+srv://admin:admin@cluster0.gw0vs.mongodb.net/rescue_alert
        

Xử lý lỗi thường gặp

Lỗi import do trùng tên datasource

Nếu workspace đích đã có datasource trùng tên nhưng khác loại với datasource trong git repository, việc import sẽ thất bại. Giải pháp:

Lỗi kết nối Git

Tài liệu tham khảo

Cấu hình MongoDB Atlas

Cách 1: Kết nối bằng URI (Khuyến nghị)

  1. Trong Appsmith Workspace:
    • Vào phần Datasources
    • Click “New Datasource” > “MongoDB”
    • Chọn “Use mongo connection string URI” = “Yes”
    • Paste connection string sau:
      mongodb+srv://admin:admin@cluster0.gw0vs.mongodb.net/rescue_alert
      
    • Click “Test Connection” để kiểm tra
    • Sau khi test thành công, click “Save” để lưu

Lưu ý:

Cách 2: Kết nối thủ công

Nếu bạn muốn sử dụng MongoDB Atlas riêng:

  1. Truy cập MongoDB Atlas
  2. Tạo tài khoản và cluster mới
  3. Lấy connection string từ cluster của bạn
  4. Trong Appsmith:
    • Chọn “Use mongo connection string URI” = “Yes”
    • Paste connection string của bạn
    • Thay thế <username>, <password> và tên database

Tài liệu tham khảo:

🧩 Plugins

DTU AppSmith Map

DTU AppSmith RealTime

Chi tiết cách cài đặt của AppSmith tại AppSmith

⚙️ Services

DTU ServerSocket

🐳 Docker Appsmith

Yêu cầu tiên quyết

Bạn sẽ cần phải khởi động lại máy tính sau khi hoàn tất quá trình cài đặt.


- Nếu git clone về không có docker-compose.yml thì bạn cần tạo 1 file docker-compose.yml và cấu hình sau: 
	version: "3"

services: appsmith: image: index.docker.io/appsmith/appsmith-ee container_name: appsmith ports: - “5555:80” - “444:443” volumes: - ./stacks:/appsmith-stacks restart: unless-stopped mysql: image: mysql:latest ports: - “33088:3306” container_name: mysql environment: - MYSQL_ROOT_PASSWORD=admin - MYSQL_DATABASE=appsmith volumes: - mysql-data:/var/lib/mysql restart: unless-stopped volumes: mysql-data:




- Trong thư mục appsmith, chạy lệnh sau để khởi động Appsmith trong Docker:

cd appsmith docker-compose up

Sau khi các container đã được khởi động, bạn có thể truy cập Appsmith qua trình duyệt.

- Mở trình duyệt và vào địa chỉ:

    - Truy cập Appsmith trên cổng http://localhost:5555 (HTTP) và http://localhost:444 (HTTPS).

    - Truy cập MySQL trên cổng http://localhost:33088.

Xem chi tiết tại [Docker Appsmith](https://docs.appsmith.com/getting-started/setup/installation-guides/docker)

## 🧩 Plugins
### DTU AppSmith Map
 -  NPM 

npm install dtuappsmithmap

 -  CDN
  - AppSmith
    - Thêm URL sau vào Resource của Appsmith:

https://cdn.jsdelivr.net/npm/dtuappsmithmap@2.2.20/dist/index.umd.js

Chi tiết hướng dẫn tại [DTUAppSmithMap](https://www.npmjs.com/package/dtuappsmithmap)

### DTU AppSmith RealTime
- NPM 

npm install dtuappsmithrealtime

- CDN
  
- AppSmith
  - Thêm URL sau vào Resource của Appsmith:

https://cdn.jsdelivr.net/npm/dtuappsmithrealtime@1.1.5/dist/index.umd.js

Chi tiết hướng dẫn tại [DTUAppSmithRealTime](https://www.npmjs.com/package/dtuappsmithrealtime/v/1.1.5)

Chi tiết cách cài đặt của AppSmith tại [AppSmith](https://docs.appsmith.com/core-concepts/writing-code/ext-libraries#prerequisites)

## ⚙️ Services
### DTU ServerSocket

- Xem chi tiết tại [DTUServerSocket](https://github.com/Truongpyeo/DTUServerSocket)

- Server Demo: [ServerDemo](https://socket.thanhtruongit.io.vn/login.html)

## 🐳 Docker Appsmith
### Yêu cầu tiên quyết
 - Docker (phiên bản 20.10.7 trở lên)  [Docker]( https://docs.docker.com/get-docker/)
 - Docker-Compose (phiên bản 1.29.2 trở lên) [Docker-Compose](https://docs.docker.com/compose/install/)

Bạn sẽ cần phải khởi động lại máy tính sau khi hoàn tất quá trình cài đặt.

- Clone repo của Appsmith từ GitHub về máy tính: 
git clone https://github.com/appsmithorg/appsmith.git

- Nếu git clone về không có docker-compose.yml thì bạn cần tạo 1 file docker-compose.yml và cấu hình sau: 
	version: "3"

services: appsmith: image: index.docker.io/appsmith/appsmith-ee container_name: appsmith ports: - “5555:80” - “444:443” volumes: - ./stacks:/appsmith-stacks restart: unless-stopped mysql: image: mysql:latest ports: - “33088:3306” container_name: mysql environment: - MYSQL_ROOT_PASSWORD=admin - MYSQL_DATABASE=appsmith volumes: - mysql-data:/var/lib/mysql restart: unless-stopped volumes: mysql-data:




- Trong thư mục appsmith, chạy lệnh sau để khởi động Appsmith trong Docker:

cd appsmith docker-compose up ``` Sau khi các container đã được khởi động, bạn có thể truy cập Appsmith qua trình duyệt.

Xem chi tiết tại Docker Appsmith

💡Nhà phát triển

” 🏫 DTU_DZ - DUY TAN UNIVERSITY - SCS ✨”

📞 Liên hệ

📚 Tài liệu

🤝 Đóng góp

Chúng tôi rất hoan nghênh mọi đóng góp! Xem CONTRIBUTING để biết thêm chi tiết.

🔄 Quy trình phát triển

  1. Fork repo này
  2. Tạo branch mới (git checkout -b feature/AmazingFeature)
  3. Commit thay đổi (git commit -m 'Add some AmazingFeature')
  4. Push lên branch (git push origin feature/AmazingFeature)
  5. Tạo Pull Request

🐛 Báo lỗi

Nếu bạn phát hiện lỗi, vui lòng tạo issue mới với:

📜 Changelog

Xem CHANGELOG để biết lịch sử thay đổi.

⚖️ Code of Conduct

Xem CODE_OF_CONDUCTđể biết các quy tắc và hành vi được chấp nhận.

Báo cáo lỗi & Góp ý

📝 License

Dự án được phân phối dưới giấy phép MIT License

“Được phát triển với ❤️ bởi Nhóm DTU-DZ”