TXA. Kho gói phần mềmPackage index

Kho nguồn riêng và tự dựng khoCustom sources and hosting your own repository

Trang này đọc trực tiếp từ thư mục docs của kho nên luôn khớp với bản trên GitHub.This page is read straight from the repository's docs folder, so it always matches what is on GitHub. Sửa trên GitHubEdit on GitHub

Ngoài kho chính txa, bạn có thể thêm kho riêng: phần mềm nội bộ công ty, bản build riêng của nhóm… Kho riêng chỉ cần phục vụ cùng REST API txa.v1 (hai file JSON tĩnh), hoặc đơn giản là một thư mục chứa manifests/.

English: custom-source.en.md

Quản lý kho nguồn với txapm source

Muốn làm gìLệnh
Xem các khotxapm source
Thêm kho HTTPStxapm source add congty https://pkgs.congty.vn/api/txa/v1
Thêm kho là thư mục (ổ mạng, máy cá nhân)txapm source add noibo \\server\share\txa
Kho riêng tư cần tokentxapm source add congty <url> --token-env CONGTY_TOKEN
Cho phép tải bộ cài từ máy chủ LANtxapm source add congty <url> --allow-lan
Tắt / bật một khotxapm source disable txa · txapm source enable txa
Xoá khotxapm source remove congty
Làm mới / sao lưu cấu hìnhtxapm source update · txapm source export
Về mặc định (chỉ kho txa)txapm source reset
Chỉ tìm / cài từ một khotxapm search app -s congty · txapm install App -s congty
  • Kho được hỏi theo thứ tự: txa trước, rồi các kho thêm sau. Nếu cùng một Id có ở nhiều kho, TXA dừng và yêu cầu chọn bằng -s <kho> để tránh cài nhầm.
  • Gói nhớ nó được cài từ kho nào, nên txapm upgrade luôn lấy bản mới từ đúng kho đó.
  • Token không bao giờ được ghi vào file cấu hình: TXA chỉ lưu tên biến môi trường, và chỉ gửi token tới đúng máy chủ của kho đó.
  • Kho phải dùng HTTPS (ngoại trừ http://localhost để thử nghiệm).

Tự dựng một kho

  1. Tạo thư mục có manifests/<chữ-cái>/<Namespace>/<AppName>/<X.Y.Z>/ (soạn card bằng txacreate new <url> --dry-run --out <thư-mục> cho nhanh; cấu trúc card xem manifest-schema.md).
  2. Dùng ngay dạng thư mục: txapm source add noibo D:\kho-txa. Hoặc sinh REST API tĩnh:
    txaci build-api --root D:\kho-txa --out D:\kho-txa-site
    
  3. Đưa thư mục D:\kho-txa-site lên bất kỳ máy chủ HTTPS nào (IIS, nginx, GitHub Pages, S3…), rồi txapm source add congty https://<máy-chủ>/api/txa/v1.

Có cả bot kiểm định 16 bước như kho chính

Fork repo TXAVL/txa-repo, thay namespace trong policy.txa.yaml, rồi chạy:

scripts\setup-github.ps1 -Owner <tổ-chức>

Script cấu hình nhãn, CODEOWNERS và bảo vệ nhánh. Muốn bot hiện tên riêng thay vì github-actions thì xem github-app.md.

Besides the official txa source you can add your own: internal company software, your team's own builds… A source only has to serve the same txa.v1 REST API (two static JSON files), or simply be a folder containing manifests/.

Tiếng Việt: custom-source.md

Managing sources with txapm source

GoalCommand
List sourcestxapm source
Add an HTTPS sourcetxapm source add company https://pkgs.company.com/api/txa/v1
Add a folder source (network drive, personal machine)txapm source add internal \\server\share\txa
Private source that needs a tokentxapm source add company <url> --token-env COMPANY_TOKEN
Allow installers hosted on a LAN servertxapm source add company <url> --allow-lan
Disable / enable a sourcetxapm source disable txa · txapm source enable txa
Remove a sourcetxapm source remove company
Refresh / back up the configurationtxapm source update · txapm source export
Back to default (only txa)txapm source reset
Search / install from one source onlytxapm search app -s company · txapm install App -s company
  • Sources are asked in order: txa first, then the ones you added. If the same Id exists in several sources, TXA stops and asks you to choose with -s <source> so nothing is installed by mistake.
  • A package remembers which source it came from, so txapm upgrade always takes the new version from that source.
  • Tokens are never written to the config file: TXA stores only the environment variable name and sends the token only to that source's own server.
  • A source must use HTTPS (except http://localhost for testing).

Hosting a repository

  1. Create a folder with manifests/<letter>/<Namespace>/<AppName>/<X.Y.Z>/ (write the cards quickly with txacreate new <url> --dry-run --out <folder>; the card layout is in manifest-schema.en.md).
  2. Use it as a folder right away: txapm source add internal D:\txa-repo. Or generate the static REST API:
    txaci build-api --root D:\txa-repo --out D:\txa-repo-site
    
  3. Put D:\txa-repo-site on any HTTPS server (IIS, nginx, GitHub Pages, S3…), then txapm source add company https://<server>/api/txa/v1.

Including the 16-step validation bot

Fork TXAVL/txa-repo, change the namespace in policy.txa.yaml, then run:

scripts\setup-github.ps1 -Owner <organization>

The script configures labels, CODEOWNERS and branch protection. For a bot with its own name instead of github-actions, see github-app.en.md.