Zum Inhalt springen

Deploy your Astro Site to Zerops

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Zerops is a dev-first cloud platform that can be used to deploy both Static and SSR Astro site.

This guide will walk you through seting up and deploying both Static and SSR Astro sites on Zerops.

Running apps on Zerops requires two steps:

  1. Creating a project
  2. Triggering build & deploy pipeline

Creating a project and a service for Astro Static

Section titled Creating a project and a service for Astro Static

Projects and services can be added either through a Project add wizard or imported using a yaml structure:

# see https://docs.zerops.io/references/import for full reference
project:
name: recipe-astro
services:
- hostname: app
type: static

This will create a project called recipe-astro with a Zerops Static service called app.

Deploying your Astro Static site

Section titled Deploying your Astro Static site

To tell Zerops how to build and run your site, add a zerops.yml to your repository:

zerops.yml
# see https://docs.zerops.io/references/zeropsyml for full reference
zerops:
- setup: app
build:
base: nodejs@20
buildCommands:
- npm i
- npm build
deployFiles:
- dist/~
run:
base: static

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.

Creating a project and a service for Astro SSR (Node.js)

Section titled Creating a project and a service for Astro SSR (Node.js)

Projects and services can be added either through a Project add wizard or imported using a yaml structure:

# see https://docs.zerops.io/references/import for full reference
project:
name: recipe-astro
services:
- hostname: app
type: nodejs@20

This will create a project called recipe-astro with Zerops Node.js service called app.

To tell Zerops how to build and run your site using the official Astro Node.js adapter in standalone mode, add a zerops.yml file to your repository:

zerops.yml
# see https://docs.zerops.io/references/zeropsyml for full reference
zerops:
- setup: app
build:
base: nodejs@20
buildCommands:
- npm i
- npm run build
deployFiles:
- dist
- package.json
- node_modules
run:
base: nodejs@20
ports:
- port: 3000
httpSupport: true
envVariables:
PORT: 3000
HOST: 0.0.0.0
start: npm start

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.

Trigger the pipeline using Zerops CLI (zcli)

Section titled Trigger the pipeline using Zerops CLI (zcli)
  1. Install the Zerops CLI.

    Terminal window
    # To download the zcli binary directly,
    # use https://github.com/zeropsio/zcli/releases
    npm i -g @zerops/zcli
  2. Open Settings > Access Token Management in the Zerops app and generate a new access token.

  3. Log in using your access token with the following command:

    Terminal window
    zcli login <token>
  4. Navigate to the root of your app (where zerops.yml is located) and run the following command to trigger the deploy:

    Terminal window
    zcli push

Weitere Veröffentlichungs-Anleitungen