Deploy your Astro Site to Zerops
यह कंटेंट अभी तक आपकी भाषा में उपलब्ध नहीं है।
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.
Want to test running Astro on Zerops without installing or setting up anything? Using repositories Zerops x Astro - Static or Zerops x Astro - SSR on Node.js you can deploy example Astro site with a single click.
Running apps on Zerops requires two steps:
- Creating a project
- Triggering build & deploy pipeline
One Zerops project can contain multiple Astro sites.
Astro Static site on Zerops
Section titled Astro Static site on ZeropsCreating a project and a service for Astro Static
Section titled Creating a project and a service for Astro StaticProjects 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 referenceproject: name: recipe-astroservices: - hostname: app type: staticThis 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 siteTo tell Zerops how to build and run your site, add a zerops.yml to your repository:
# see https://docs.zerops.io/references/zeropsyml for full referencezerops: - setup: app build: base: nodejs@20 buildCommands: - npm i - npm build deployFiles: - dist/~ run: base: static# see https://docs.zerops.io/references/zeropsyml for full referencezerops: - setup: app build: base: nodejs@20 buildCommands: - pnpm i - pnpm build deployFiles: - dist/~ run: base: static# see https://docs.zerops.io/references/zeropsyml for full referencezerops: - setup: app build: base: nodejs@20 buildCommands: - yarn - yarn build deployFiles: - dist/~ run: base: staticNow 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.
Astro SSR site on Zerops
Section titled Astro SSR site on ZeropsCreating 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 referenceproject: name: recipe-astroservices: - hostname: app type: nodejs@20This will create a project called recipe-astro with Zerops Node.js service called app.
Deploying your Astro SSR site
Section titled Deploying your Astro SSR siteTo 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:
# see https://docs.zerops.io/references/zeropsyml for full referencezerops: - 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# see https://docs.zerops.io/references/zeropsyml for full referencezerops: - setup: app build: base: nodejs@20 buildCommands: - pnpm i - pnpm 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: pnpm start# see https://docs.zerops.io/references/zeropsyml for full referencezerops: - setup: app build: base: nodejs@20 buildCommands: - yarn - yarn 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: yarn startNow 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)-
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