Files
InstallerRobot/BUILD_SYSTEM.md
2026-05-13 08:14:36 +00:00

3.9 KiB

BUILD_SYSTEM.md

Linux Package Installer System

Server IP: 172.20.235.176

Mục tiêu: xây dựng hệ thống cài đặt, quản lý package .deb cho ứng dụng web trên Linux với luồng Web Server → Web Client → Local Installer Agent → Web Service.


1. Thành phần hệ thống

  1. Web Server (server.package.robot)

    • Node.js + Express
    • Chức năng:
      • Lưu trữ các file .deb
      • Metadata JSON về package: version, dependency, mô tả
      • API download package
      • Admin upload package
  2. Web Client (client.package.robot)

    • Frontend: React
    • Backend: Node.js
    • Chức năng:
      • Hiển thị danh sách package
      • Cho người dùng chọn Install / Modify / Update / Remove
      • Relay lệnh tới Local Installer Agent
      • Hiển thị tiến trình / status realtime
  3. Local Installer Agent

    • Python
    • Chạy ngầm trên Linux client
    • Chức năng:
      • Tải package từ Web Server
      • Kiểm tra checksum / chữ ký
      • Cài / gỡ / update bằng dpkg/apt
      • Start / restart các service systemd
      • Báo tiến trình / status về Web Client

2. Flow hệ thống

Admin / Developer │ Upload .deb và metadata ▼ Web Server (172.20.235.176) │ Serve .deb + metadata ▼ Web Client (React + Node.js) │ Hiển thị package list │ User chọn Install/Modify/Update/Remove ▼ Local Installer Agent (Python) │ Download .deb từ server │ Verify checksum │ Install / Remove / Update │ Start/Restart systemd service ▼ Web Service / Package Service │ Chạy sẵn ▼ User mở browser → truy cập service


3. Cấu trúc project

project-root/ ├── server/ │ ├── packages/ # .deb files │ ├── metadata/ # JSON metadata │ └── src/ # Node.js + Express │ ├── routes/ │ └── controllers/ │ ├── client/ │ ├── frontend/ # React UI │ └── backend/ # Node.js relay tới Agent │ ├── agent/ │ ├── bin/ # Python executable / script │ ├── service/ # systemd service file │ └── lib/ # logic install/update/remove/status │ └── packages/ # Build các .deb trước khi upload


4. Metadata JSON mẫu

{
  "applications": [
    {
      "id": "sample-app",
      "name": "Sample Package",
      "version": "1.0.0",
      "packages": [
        {"id": "sample-core", "required": true, "version": "1.0.0", "file": "sample-core_1.0.0_amd64.deb"},
        {"id": "sample-web", "required": false, "version": "1.0.0", "file": "sample-web_1.0.0_amd64.deb", "depends": ["sample-core"]},
        {"id": "sample-api", "required": false, "version": "1.0.0", "file": "sample-api_1.0.0_amd64.deb", "depends": ["sample-core"]}
      ]
    }
  ]
}
5. Flow Install / Modify / Update / Remove
User mở Web Client
Web Client fetch metadata từ Web Server
User chọn package muốn Install/Modify/Update/Remove
Web Client gửi JSON request tới Local Installer Agent
Local Agent:
Download package từ Web Server
Verify checksum
Install / Remove / Update package
Start / Restart systemd service
Báo tiến trình / status về Web Client
Sau khi cài xong, service chạy sẵn
User mở browser  truy cập Web Service
6. Công nghệ & ngôn ngữ
Thành phần	Ngôn ngữ / Framework
Web Server	Node.js + Express
Web Client Frontend	React
Web Client Backend	Node.js
Local Installer Agent	Python
Web Service	Tùy ứng dụng
7. Quy trình triển khai từ đầu
Build package .deb cho ứng dụng web, chia thành các package nhỏ nếu cần.
Upload package + metadata lên Web Server.
Web Client fetch metadata, hiển thị package list.
Cài đặt Local Installer Agent lần đầu trên Linux client.
User chọn package  Install / Modify / Update / Remove.
Local Installer Agent thực hiện cài/gỡ/update ngầm.
Web Service chạy sẵn, người dùng truy cập browser.
![alt text](image-1.png)