Note: This post is not sponsored by Clever Cloud by any mean, but it's a service I really like : great UX, great support, and made in Europe
Clever Cloud is great, nevertheless it took me a small hour to deploy a static NextJS app the first time. But their support was really efficient and we sorted it out really fast ! Just by setting up the correct environment variables.
Context: We're working on a monorepo, meaning that in a single github repository we have many folders such as api
, app
, admin
, dashboard
, etc. So the NextJS app is located in the app
folder, that's all we need to know here.
Back in Clever Cloud Console:
- Create a new application
- Choose "Create from a Github Repository" and select your repo
- Step "What kind of application is it ?", select "Static", with a feather 🪶 as an icon
- Config your instances as you wish (Autoscalability, Horizontal scaling, Vertical scaling), name it as you wish, choose your region and create it
- Then go to "Environment variables" and setup the variables this way:
APP_FOLDER="app"
CC_CACHE_DEPENDENCIES="true"
CC_CGI_IMPLEMENTATION="proxy_fcgi"
CC_NODE_DEV_DEPENDENCIES="install"
CC_PRE_BUILD_HOOK="cd app && npm install --also=dev && npm run build"
CC_WEBROOT="/out"
HOST="0.0.0.0"
NEXT_PUBLIC_ANY_VARIABLES="{variables you defined for your project}"
NODE_ENV="production"
PORT="8080"
And that's it !
Clever Cloud moto is
Vous développez, nous déployons
You code, we deploy
Cannot be more true ! 🥸
Top comments (2)
Thank you !!
It really works !!
Thanks you !