nb portal

nb portal quản lý workspace Portal. Một Portal có thể có mã nguồn frontend, đường dẫn truy cập và kết quả triển khai riêng; nhóm lệnh này kết nối bản ghi Portal trong NocoBase với workspace cục bộ và source storage.

Quy trình thường là tạo workspace cục bộ, chạy chế độ phát triển, đẩy thay đổi mã nguồn lên source storage, sau đó build và deploy. Nếu tiếp nhận một Portal đã có, hãy pull về cục bộ trước.

Cách dùng

nb portal <command>

Lệnh con

LệnhMô tả
nb portal configCập nhật cấu hình mã nguồn của workspace Portal cục bộ và đồng bộ với bản ghi Portal từ xa khi có thể
nb portal createTạo workspace Portal cục bộ từ template và tạo hoặc cập nhật bản ghi Portal
nb portal deployBuild và triển khai workspace Portal đã chỉ định
nb portal destroyXóa bản ghi Portal và workspace cục bộ
nb portal devKhởi động chế độ phát triển cho workspace Portal đã chỉ định
nb portal infoHiển thị chi tiết bản ghi Portal và workspace cục bộ đã chỉ định
nb portal listLiệt kê bản ghi Portal và trạng thái đồng bộ workspace cục bộ
nb portal pullKéo mã nguồn Portal từ source storage về workspace cục bộ
nb portal pushĐẩy thay đổi mã nguồn Portal cục bộ lên source storage

Quy trình điển hình

Tạo một Portal tên customer:

nb portal create customer -e dev --yes

Khởi động chế độ phát triển cục bộ:

nb portal dev customer -e dev --yes

Kiểm tra workspace cục bộ và bản ghi từ xa:

nb portal info customer -e dev --yes
nb portal list -e dev --yes

Đẩy mã nguồn và triển khai:

nb portal push customer -e dev --yes --message "Update customer portal"
nb portal deploy customer -e dev --yes

Tiếp nhận một Portal đã có:

nb portal list -e dev --yes
nb portal pull customer -e dev --yes
nb portal dev customer -e dev --yes

Chuyển source storage:

nb portal config customer -e dev --yes --source-storage git --git-repo git@github.com:nocobase/customer-portal.git
nb portal push customer -e dev --yes --message "Move customer portal source to Git"

source storage

Khi tạo Portal, hãy chọn nơi quản lý mã nguồn:

Chế độMô tả
nocobaseDefault mode. Source code is managed by NocoBase source storage.
gitSource code is stored in a Git repository, configured with --git-repo, --git-branch, and --git-path.

For quick creation and development, the default nocobase storage is usually enough. Use git when the Portal source should be reviewed, versioned, or built through an existing team workflow.

Source configuration is written to portal.config.json in the local workspace. create, pull, and config maintain this file; push and deploy read it to sync source or deployment output.

Env Types

nb portal currently supports local, docker, and http envs:

Chế độMô tả
localThe workspace and app storage are on the current machine. With default nocobase storage, pull/push usually do not need extra sync.
dockerThe workspace is shared with the app through a Docker volume. With default nocobase storage, pull/push usually do not need extra sync.
httpSource and deployment output are synced through APIs. pull downloads a source archive, and push uploads one.

ssh envs do not support Portal management in the current version.

Local Workspace Path

Portals are stored under the selected env storage:

<storagePath>/portals/<app>/<portal>

The main app access path is usually:

<appPublicPath>/x/<portal>/

A sub-app access path is usually:

<appPublicPath>/x/apps/<app>/<portal>/

Env Confirmation

Most nb portal subcommands support --env and --yes:

Tham sốMô tả
--env, -eCLI env name. If omitted, the current env is used.
--yes, -ySkip cross-env confirmation when an explicit --env targets a different env from the current env.

In scripts or AI agent workflows, pass --env and --yes explicitly to avoid stopping at an interactive confirmation.

Lệnh liên quan