Zerops
预设:zerops
¥Preset: zerops
Zerops 支持在项目根目录中使用简单的配置文件部署静态和服务器端渲染的应用。
¥Zerops supports deploying both static and server-side rendered apps with a simple configuration file in your project root.
入门模板
¥Starter templates
如果你想快速开始使用 zerops 和 nitro,你可以使用代码库 zeropsio/recipe-nitro-nodejs
和 zeropsio/recipe-nitro-static
入门模板。
¥If you want to quckly get started with zerops and nitro you can use repositories zeropsio/recipe-nitro-nodejs
and zeropsio/recipe-nitro-static
starter templates.
项目设置
¥Project setup
项目和服务可以通过 项目添加向导 添加,也可以使用 zerops-project-import.yml
导入。
¥Projects and services can be added either through project add wizard or imported using zerops-project-import.yml
.
project:
name: nitro-app
services:
- hostname: app
type: nodejs@20
然后在项目根目录中创建 zerops.yml
配置:
¥Then create a zerops.yml
config in your project root:
zerops:
- setup: app
build:
base: nodejs@20
envVariables:
SERVER_PRESET: zerops
buildCommands:
- pnpm i
- pnpm run build
deployFiles:
- .output
- package.json
- node_modules
run:
base: nodejs@20
ports:
- port: 3000
httpSupport: true
start: node .output/server/index.mjs
现在,你可以触发 使用 Zerops CLI 构建和部署管道,或者在服务详情中将应用服务连接到你的 GitHub/GitLab 存储库。
¥Now you can trigger the build & deploy pipeline using the Zerops CLI or by connecting the app service with your GitHub / GitLab repository from inside the service detail.
构建和部署
¥Build and deploy
在 Zerops 应用中打开 设置 > 访问令牌管理 并生成新的访问令牌。
¥Open Settings > Access Token Management in the Zerops app and generate a new access token.
使用你的访问令牌通过以下命令登录:
¥Log in using your access token with the following command:
npx @zerops/zcli login <token>
导航到应用的根目录(zerops.yml
所在的位置),并运行以下命令触发部署:
¥Navigate to the root of your app (where zerops.yml
is located) and run the following command to trigger the deploy:
npx @zerops/zcli push
通过将服务连接到你的 GitHub/GitLab 存储库,你的代码可以在每次提交或添加新标签时自动部署。此连接可以在服务详细信息中设置。
¥Your code can be deployed automatically on each commit or a new tag by connecting the service with your GitHub / GitLab repository. This connection can be set up in the service detail.