I have a nextjs project and don't know how to deploy on Zerops.io?

can someone help me deploy my nextjs project on Zerops.io?
83 Replies
Aleš
Aleš4w ago
have you tried the example app ? https://app.zerops.io/recipe/nextjs-nodejs (or SSG, if you prefer static https://app.zerops.io/recipe/nextjs-static)
ZenitoGR | Chris | new dev
yeah I have deployed that but I don't know how to migrate my project can we go to voice channel to share my screen maybe? are you available?
nermal
nermal4w ago
hey, what does your project use?
ZenitoGR | Chris | new dev
nextjs I think ssr
nermal
nermal4w ago
does it use any redis or postgres ? or its a basic project ?
ZenitoGR | Chris | new dev
supabase I just started it
nermal
nermal4w ago
okay so you have your envs right ?
ZenitoGR | Chris | new dev
I set up supabase authentication and homepage profile page
nermal
nermal4w ago
setup a service and setup envs there
nermal
nermal4w ago
and
zerops:
- setup: app
build:
base: nodejs@20
buildCommands:
- pnpm i
- pnpm run build
deployFiles: ./
run:
base: nodejs@20
ports:
- port: 3000
httpSupport: true
start: pnpm start
zerops:
- setup: app
build:
base: nodejs@20
buildCommands:
- pnpm i
- pnpm run build
deployFiles: ./
run:
base: nodejs@20
ports:
- port: 3000
httpSupport: true
start: pnpm start
use this yml and push to the service
ZenitoGR | Chris | new dev
can I use lts nodejs?
nermal
nermal4w ago
assuming you know how to push via zcli
ZenitoGR | Chris | new dev
is it 22 I think?
nermal
nermal4w ago
yea yea nodejs@22
ZenitoGR | Chris | new dev
ok how to push?
nermal
nermal4w ago
do you have zcli on your system ?
nermal
nermal4w ago
Using zCLI | Zerops
Learn how to install and use zCLI, the powerful command-line tool for interacting with Zerops. Explore zCLI commands, streamline service management, and simplify your workflow from your terminal.
ZenitoGR | Chris | new dev
its zerops cli? right? ok
nermal
nermal4w ago
set it up on your system and ping me when you're done
nermal
nermal4w ago
No description
nermal
nermal4w ago
make sure to login 😄
ZenitoGR | Chris | new dev
I mean I run npm i -g @zerops/cli ok
nermal
nermal4w ago
yeah it will install zcli globally on your system
nermal
nermal4w ago
when did you get this error ? are you sure about the hostname ?
ZenitoGR | Chris | new dev
when using your recipe
nermal
nermal4w ago
Oh are you trying to import the yml i sent you ?
nermal
nermal4w ago
oh it doesn't work like that you'll have to create a zerops.yml in the root of your project and then do zcli push (make sure you're logged in) from your terminal
ZenitoGR | Chris | new dev
how to login from terminal?
nermal
nermal4w ago
@ZenitoGR | Chris | new dev here^ grab your personal access token from zerops dashboard
ZenitoGR | Chris | new dev
ok cool
nermal
nermal4w ago
and then do zcli login <paste your token>
ZenitoGR | Chris | new dev
ok now what? I create yml zerops: - setup: app build: base: nodejs@22 buildCommands: - pnpm i - pnpm run build deployFiles: ./ run: base: nodejs@22 ports: - port: 3000 httpSupport: true start: pnpm start
nermal
nermal4w ago
yes
ZenitoGR | Chris | new dev
is there usage costs? on free tier?
nermal
nermal4w ago
actually we don't really give out free tier but we do give out free credits.
ZenitoGR | Chris | new dev
oh I see :/
nermal
nermal4w ago
so most likely it'll cost $1.45 per month if its a basic nextjs ssr project
ZenitoGR | Chris | new dev
oh nice!
nermal
nermal4w ago
either way - do you have a zerops project ?
ZenitoGR | Chris | new dev
no how to push? or first create? how to create?
nermal
nermal4w ago
create one and setup a nodejs v22 servicefirst wait
ZenitoGR | Chris | new dev
ok can we hop on voice to share my screen? please?
nermal
nermal4w ago
im a bit busy with something right now - not the right time sorry
nermal
nermal4w ago
@ZenitoGR | Chris | new dev here^
nermal
nermal4w ago
ZenitoGR | Chris | new dev
I went to import before ok
nermal
nermal4w ago
when you're creating your service - you can just add your secrets and after you're done with all this
nermal
nermal4w ago
just push your changes with zcli push
ZenitoGR | Chris | new dev
here? I am not very good with github
nermal
nermal4w ago
its a preference
ZenitoGR | Chris | new dev
when I commit I want to have production and dev
nermal
nermal4w ago
you don't really need to setup that i'm not sure what you mean by this
ZenitoGR | Chris | new dev
like I have the main branch for production and dev branch for dev/preview
Aleš
Aleš4w ago
yea you can do that
Aleš
Aleš4w ago
add two services, prod and dev, in prod select to trigger on "Push to branch" and select main from branches in dev do the same but select branch preview
ZenitoGR | Chris | new dev
great! thank you! will come back if I have any other questions!
Aleš
Aleš4w ago
btw you zerops.yml needs to reflect that
ZenitoGR | Chris | new dev
NEXT_PUBLIC_SUPABASE_URL do I put this in env?
Aleš
Aleš4w ago
you can do
zerops:
- setup: base
build:
base: nodejs@20
buildCommands:
- pnpm i
- pnpm run build
deployFiles: ./
run:
base: nodejs@20
envVariables:
NEXT_PUBLIC_SUPABASE_URL: ...
ports:
- port: 3000
httpSupport: true
start: pnpm start
- setup: prod
extends: base
- setup: dev
extends: base
zerops:
- setup: base
build:
base: nodejs@20
buildCommands:
- pnpm i
- pnpm run build
deployFiles: ./
run:
base: nodejs@20
envVariables:
NEXT_PUBLIC_SUPABASE_URL: ...
ports:
- port: 3000
httpSupport: true
start: pnpm start
- setup: prod
extends: base
- setup: dev
extends: base
ZenitoGR | Chris | new dev
or supabase has some kind of connection?
Aleš
Aleš4w ago
see 👆
ZenitoGR | Chris | new dev
yes let me check
Aleš
Aleš4w ago
this config assumes you've added two nodejs22 services names prod and dev btw
Aleš
Aleš4w ago
you can define your variables like this, the same can be done in the build section for your build
No description
Aleš
Aleš4w ago
if you need some sensitive information in your variables, you can go to the service detail in GUI, find Environments variables and add it as a "Secret variable"
Aleš
Aleš4w ago
open pipeline detail and show build log
ZenitoGR | Chris | new dev
but my app runs locally with npm run dev? is it eslint? like on vercel?
Aleš
Aleš4w ago
what happens when you do npm run build locally?
ZenitoGR | Chris | new dev
ok same let me fix the eslint build bugs and If I have any issue will come back but one question I still need two services on zerops for production and dev? even with this yml file you shared?
Aleš
Aleš4w ago
yes, you don't want your production to possibly be affected by whatever you are doing in development / preview, that's just the best practice you can easily start / stop the dev service when you don't need it and it will cost nothing

Did you find this page helpful?