Deploy your Astro Site to Zerops
このコンテンツはまだ日本語訳がありません。
Zerops is a dev-first cloud platform that can be used to deploy an SSR Astro site.
This guide will walk you through deploying an Astro project using the Node.js adapter to Zerops.
Prerequisites
Section titled Prerequisites- An Astro project using the @astrojs/nodeSSR adapter
- A Zerops account - If you don’t already have one, you can create a Zerops account for free.
The Zerops x Astro - Node.js example app can be imported directly into your Zerops Dashboard, and deployed in one click!
project:  name: astroservices:  - hostname: astronode    type: nodejs@20    buildFromGit: https://github.com/zeropsio/recipe-astro-nodejs    ports:      - port: 4321        httpSupport: true    enableSubdomainAccess: true    minContainers: 1Creating a Zerops Node.js project
Section titled Creating a Zerops Node.js projectYou can create a Node.js service for your Astro site through the Zerops project add wizard, or by importing an Astro site using .yaml.
The following YAML structure will setup a project called my-astro-sites with a Node.js v20 service called hellothere. One Zerops project can contain many Astro apps.
project:  name: my-astro-sitesservices:  - hostname: hellothere    type: nodejs@20    ports:      - port: 4321        httpSupport: true    minContainers: 1Building and deploying your app to Zerops
Section titled Building and deploying your app to ZeropsNow that you’ve prepared a Node.js service on Zerops,  you will need to create a zerops.yml file at the root of your project to trigger the build and deploy pipeline on Zerops.
The following example shows configuring the required build and run operations for the example project with hostname hellothere:
  zerops:    - setup: hellothere      build:        base: nodejs@20        buildCommands:          - npm i          - npm run build        deploy:          - dist          - package.json          - node_modules        cache:          - node_modules          - package-lock.json      run:        start: node dist/server/entry.mjs      envVariables:        HOST: 0.0.0.0        NODE_ENV: production  zerops:    - setup: hellothere      build:        base: nodejs@20        buildCommands:          - pnpm i          - pnpm run build        deploy:          - dist          - package.json          - node_modules        cache:          - node_modules          - pnpm-lock.yaml      run:        start: node dist/server/entry.mjs      envVariables:        HOST: 0.0.0.0        NODE_ENV: production  zerops:    - setup: astronode      build:        base: nodejs@20        buildCommands:          - yarn          - yarn build        deploy:          - dist          - package.json          - node_modules        cache:          - node_modules          - yarn.lock      run:        start: node dist/server/entry.mjs      envVariables:        HOST: 0.0.0.0        NODE_ENV: productionTrigger the pipeline using GitHub / GitLab
Section titled Trigger the pipeline using GitHub / GitLabTo setup continuous deployment on either a push to a branch or on a new release, go to your Node.js service detail and connect your Zerops service with a GitHub or GitLab repository.
Trigger the pipeline Using Zerops CLI (zcli)
Section titled Trigger the pipeline Using Zerops CLI (zcli)- 
Install the Zerops CLI. Terminal window # To download the zcli binary directly,# use https://github.com/zeropsio/zcli/releasesnpm i -g @zerops/zcli
- 
Open Settings > Access Token Managementin the Zerops app and generate a new access token.
- 
Log in using your access token with the following command: Terminal window zcli login <token>
- 
Navigate to the root of your app (where zerops.ymlis located) and run the following command to trigger the deploy:Terminal window zcli push