> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alforse.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 企业自部署

> 使用企业自部署许可在客户自有基础设施上部署 Alforse。

## 概览

企业自部署是面向持有 self\_hosted 商业计划和签名许可文件的客户运行时，不是内部工程运行方式。部署前应确认许可、基础设施、密钥管理、备份、文件扫描、邮件和监控策略。

## 前提条件

* 签名许可文件和 LICENSE\_PUBLIC\_KEY。
* 客户自有容器平台或受控主机。
* 两个 PostgreSQL 数据库：系统元数据与租户业务数据必须分离。
* Redis、S3 兼容对象存储、TLS 域名、邮件服务和文件扫描服务。
* 首个租户管理员的开通流程和恢复策略。

## 步骤

* Set `EDITION=self_hosted` and `NODE_ENV=production`.
* Configure `LICENSE_FILE` and `LICENSE_PUBLIC_KEY`.
* Run `docker compose -f docker-compose.self-hosted.yml up -d --build` from `apps/api`.
* Run `npm run prisma:generate`, `npm run prisma:migrate`, and `npm run db:seed`.
* Verify `GET /health` on the approved API origin.

## 运维检查

* 管理员 MFA 策略已生效。
* 密码重置、邀请和备份验证码邮件可送达。
* 文件下载遵守扫描策略。
* GET /health 已纳入监控。
* 数据库备份和恢复流程已演练。
