作者:
    Creation:2026-09-21Last update:2026-09-21

    Intlayer CLI Init Infra 命令

    描述

    init infra 命令用于在您的机器上设置 Intlayer 基础设施。它会下载适用于您平台的托管安装程序(macOS / Linux 上为 https://intlayer.org/install.sh,Windows 上为 https://intlayer.org/install.ps1),并在终端中运行,以便完整显示安装程序自身的菜单和进度输出。

    安装程序会询问您希望如何运行 Intlayer:

    • 桌面应用:下载适用于您的操作系统和 CPU 的原生控制面板并打开或安装。桌面版本连接至 Intlayer Cloud 后端。
    • 多合一 Docker:在由单个卷支持的单个容器中运行控制面板 + API + MongoDB + Redis + MinIO。写入包含生成密钥的 ./intlayer.env 并拉取 intlayer/cms-all 镜像。
    • Docker Compose:每个服务一个容器,用于可扩展的自行托管。将 docker-compose.yml.env 写入 ./intlayer/ 并拉取镜像。

    托管安装程序是安装流程的唯一真实来源:CLI 运行它而不是重新实现相同步骤,因此 npx intlayer init infracurl -fsSL https://intlayer.org/install.sh | sh 执行完全相同的操作。

    用法

    bash
    npx intlayer init infra [options]
    

    npx intlayer init --interactive 的检查列表中也提供了相同的步骤,位于 基础设施 (桌面应用 / 自行托管) 下。

    选项

    • -m, --mode <mode> - 可选。跳过安装程序菜单并直接运行特定模式。接受的值:desktopdocker(多合一)或 compose。任何其他值都会退出并显示错误列出接受的模式。

    示例

    以交互方式选择模式

    bash
    npx intlayer init infra
    

    安装桌面应用

    bash
    npx intlayer init infra --mode desktop
    

    使用多合一容器自行托管

    bash
    npx intlayer init infra --mode docker
    

    使用 Docker Compose 自行托管

    bash
    npx intlayer init infra --mode compose
    

    示例输出

    bash
    npx intlayer init infra --mode compose
      Installer downloaded
     Fetching docker-compose.yml into ./intlayer
     Writing ./intlayer/.env
     Pulling images
    
      Everything is installed. Two steps left.
    
      1. Configure a mailer in:
    
           ./intlayer/.env
    
         Either RESEND_API_KEY (resend.com) or the MAIL_SMTP_* block — the first
         account cannot be verified without a working mailer.
      2. Start the stack:
    
           cd ./intlayer && docker compose up -d
    
      Then open http://localhost:3000 first boot initialises the
      datastores, so give it a minute. The first account you create becomes the
      super admin.
    
        Logs      docker compose logs -f
        Stop      docker compose down
        Upgrade   docker compose pull && docker compose up -d
    

    安装程序设置

    安装程序会读取一些环境变量,CLI 会原样传递这些变量。在运行命令前请在 shell 中进行设置:

    bash
    INTLAYER_COMPOSE_DIR=./cms npx intlayer init infra --mode compose
    
    变量默认值适用于描述
    INTLAYER_MODE(询问)全部desktopdockercompose,与 --mode 相同
    INTLAYER_DOWNLOAD_DIR~/Downloadsdesktop应用安装程序保存位置
    INTLAYER_IMAGEintlayer/cms-all:latestdocker要拉取的多合一镜像
    INTLAYER_ENV_FILE./intlayer.envdocker环境文件写入位置
    INTLAYER_CONTAINER_NAMEintlayerdocker容器名称
    INTLAYER_DATA_VOLUMEintlayer-datadocker挂载在 /data 的具名卷
    INTLAYER_APP_PORT3000docker控制面板主机端口
    INTLAYER_API_PORT3100dockerAPI 主机端口
    INTLAYER_S3_PORT9000dockerMinIO S3 API 主机端口
    INTLAYER_CONSOLE_PORT9001dockerMinIO 控制台主机端口
    INTLAYER_COMPOSE_DIR./intlayercompose写入 docker-compose.yml.env 的位置
    INTLAYER_SELFHOST_REFmain两者获取 compose 文件和 env 模板的 Git ref
    端口变量仅更改映射的 主机 端。已发布的镜像在控制面板包中预编译了 http://localhost:3000http://localhost:3100http://localhost:9000,因此除非您构建自己的镜像,否则请保留默认值:请参阅自行托管指南

    环境要求

    • 桌面应用 需要 Node.js:该应用内嵌了控制面板服务器,并使用机器自身的 node 二进制文件启动。
    • Docker 模式 需要 Docker(Windows 上需要带有 WSL 2 后端的 Docker Desktop)。Compose 模式还需要 docker compose 插件。

    注意事项

    • 重新运行该命令是安全的:现有的环境文件绝不会被覆盖,因此它也作为升级路径(安装程序会拉取最新镜像并保留您的密钥)。
    • 安装程序会被下载到临时目录中,无论结果如何,退出时都会被删除。
    • 该命令的退出代码即为安装程序的退出代码。如果下载本身失败,CLI 将打印等效的 curl … | sh(或 irm … | iex)命令,以便您可以直接运行安装程序。
    • Docker 模式仍需要邮件发送服务来发送登录邮件。安装程序完成后,请在生成的环境文件中配置 Resend 或 SMTP:请参阅全局邮件程序

    相关内容