> For the complete documentation index, see [llms.txt](https://docs.zongsoft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zongsoft.com/overview/deployment.md).

# 部署模型

了解 Zongsoft 中部署、打包和升级的整体模型。

Zongsoft 的部署模型围绕插件式应用展开。部署不是简单复制编译输出，而是把插件、配置、映射、证书和资源按规则组装到宿主程序的目标目录中。

## 部署

部署由 `dotnet-deploy` 工具执行，规则写在 `.deploy` 文件中。部署文件描述了源文件、NuGet 包、目标目录和过滤条件。

典型部署内容包括：

* 主插件文件。
* 插件程序集。
* 选项配置文件。
* 数据映射文件。
* 本地化资源。
* 证书或站点配置。

## 打包

部署完成后，可以用 `dotnet-pack` 将发布目录制作成 Linux 常见包格式：

* `.tar.gz`
* `.deb`
* `.rpm`

打包阶段关注安装路径、systemd 服务、生命周期脚本、包元数据和文件权限。

## 自动升级

自动升级由 framework 仓库中的 upgrading 组件和 `dotnet-upgrade` 工具支持。升级包通常包含应用发布文件、清单、校验码和部署执行器信息。

## 推荐路径

开发阶段优先使用 `terminal` 宿主调试插件；联调 Web API 时使用 `web/default` 宿主；准备部署时使用 `daemon` 或 `web` 宿主配合部署、打包和升级工具。

## 三类产物不要混用

| 阶段  | 输入              | 输出与验收                       |
| --- | --------------- | --------------------------- |
| 部署  | 宿主发布文件、插件包和方案配置 | 可启动的运行目录，完成一次业务调用           |
| 安装包 | 已验证运行目录和安装元数据   | tar/deb/rpm，核对路径、服务及升级/卸载脚本 |
| 升级包 | 新版运行文件和发布身份     | ZIP/manifest，核对发现、交接和新进程健康  |

部署参数中的编译配置、安装包的产品身份、升级包的版本分发名各有用途，不应只因选项重名就套用相同值。持久数据和环境秘密也不应无差别收集进程序包。

具体操作：[部署宿主](/hosting/deployment.md)、[打包工具](/tools/packager.md)、[自动升级](/framework/upgrading.md)。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.zongsoft.com/overview/deployment.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
