How to deploy Astro on Zerops (in 3 mins)
Hey everyone, this guide will walk you through deploying an AstroJS web app on a Node.js service using Zerops, a bare-metal cloud platform. Unlike Vercel, which is a wrapper on top of AWS, Zerops offers a straightforward onboarding process. If you’re building a project intended to serve a large number of users, Zerops might be a better choice compared to GCP, AWS, and Azure.
There are two ways to push your code to Zerops: using the zCLI or the GitHub repository method. In this guide, we’ll focus on using the zCLI. Make sure to download the zCLI first so you can follow along with the steps.
FIRST, GO TO THE ZEROPS DASHBOARD AND ADD A NEW PROJECT
CREATE A NEW SERVICE WITH NODEJS AND SCROLL DOWN TO ADD
CHANGE THE HOSTNAME TO YOUR PREFERRED NAME
ADD THE NEW NODE.JS SERVICE TO CONTINUE
COPY THE ZEROPS.YML CODE
CREATE A ZEROPS.YML FILE IN THE ROOT OF YOUR PROJECT AND PASTE THE YAML CODE THERE (I REMOVED ALL THE COMMENTS) AND ASLO ADD
zerops:
- setup: astro
build:
base: nodejs@20
buildCommands:
- npm i
- npm run build
deploy:
- dist
- package.json
- node_modules
cache:
- node_modules
- package-lock.json
run:
start: npm start
envVariables:
HOST: 0.0.0.0
ADD @ASTROJS/NODE TO YOUR PROJECT
MATCH YOUR ASTRO CONFIG WITH MINE(IGNORE TAILWIND IF YOU ARE NOT USING IT)
TYPE “ZCLI PUSH” & CHOOSE THE RIGHT PROJECT WITH ARROWS AND CLICK ENTER
CLICK ENTER TO CONTINUE
IT WILL WILL PUSH THE CODE AND THEN DEPLOY IT (IF IT FAILS IT’LL LET YOU KNOW)
GO TO SERVICES DASHBOARD AND CHECK THE CI/CD PIPELINE TO CHECK THE BUILD LOGS
WELL THIS IS WORKING
CHANGE THE DEFAULT 3000 PORT TO 4321 FROM INTERNAL PORTS
VOILAAAA!!
Examples : Zerops-Astro-Nodejs / Astro-with-Tailwind
For more info kindly check Zerops Docs and Zerops Discord Server