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 kho | txapm source |
| Thêm kho HTTPS | txapm 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 token | txapm source add congty <url> --token-env CONGTY_TOKEN |
| Cho phép tải bộ cài từ máy chủ LAN | txapm source add congty <url> --allow-lan |
| Tắt / bật một kho | txapm source disable txa · txapm source enable txa |
| Xoá kho | txapm source remove congty |
| Làm mới / sao lưu cấu hình | txapm source update · txapm source export |
Về mặc định (chỉ kho txa) | txapm source reset |
| Chỉ tìm / cài từ một kho | txapm search app -s congty · txapm install App -s congty |
- Kho được hỏi theo thứ tự:
txatrướ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 upgradeluô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
- Tạo thư mục có
manifests/<chữ-cái>/<Namespace>/<AppName>/<X.Y.Z>/(soạn card bằngtxacreate new <url> --dry-run --out <thư-mục>cho nhanh; cấu trúc card xem manifest-schema.md). - 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 - Đưa thư mục
D:\kho-txa-sitelên bất kỳ máy chủ HTTPS nào (IIS, nginx, GitHub Pages, S3…), rồitxapm 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
| Goal | Command |
|---|---|
| List sources | txapm source |
| Add an HTTPS source | txapm 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 token | txapm source add company <url> --token-env COMPANY_TOKEN |
| Allow installers hosted on a LAN server | txapm source add company <url> --allow-lan |
| Disable / enable a source | txapm source disable txa · txapm source enable txa |
| Remove a source | txapm source remove company |
| Refresh / back up the configuration | txapm source update · txapm source export |
Back to default (only txa) | txapm source reset |
| Search / install from one source only | txapm search app -s company · txapm install App -s company |
- Sources are asked in order:
txafirst, 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 upgradealways 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://localhostfor testing).
Hosting a repository
- Create a folder with
manifests/<letter>/<Namespace>/<AppName>/<X.Y.Z>/(write the cards quickly withtxacreate new <url> --dry-run --out <folder>; the card layout is in manifest-schema.en.md). - 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 - Put
D:\txa-repo-siteon any HTTPS server (IIS, nginx, GitHub Pages, S3…), thentxapm 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.