Reputation: 403
I have no experience with Next.js and its deployment. Our team has been developing an app in Next.js and I need to deploy it into our Jelastic platform. I am very much familiar with Apache server and haven't used any other servers than that.
I found out that Next.js can't be deployed with Apache (or at least static export is not the best idea). So, I created a Node.js server environment in Jelastic and I have no idea how to make the application accessible. I read the Next.js documentation and it says that the production build files after next build
are stored inside .next
folder but I didn't find any entry point files (as in Apache) such as index.html
in that folder.
I tried running next start
and a server was started on localhost on port 3000, but I couldn't access that remotely.
I didn't find much about Next.js deployment in different environments anywhere. I am probably missing several things here, but I am clueless. How do I deploy and run Next.js application in Jelastic?
Upvotes: 0
Views: 521
Reputation: 117
It all depends on whether your appication is dockerized or not, and whether you are using cluster or swarm. If you have only one server for the deployements of your apps, then from your JElastic admin board, you find "Add new environnement", "Import" and "MarketPlace" in the top menu bar.
From the "MarketPlace" you can install the docker Engine, and afterward "add new environnement" with "Nodejs" language available also in the second menu bar.
After you have the Node environnement setup, you can then click on the "Import" menu. the popup will show you a dialog box coming with option to browse through you local machine to load your build project.
Your "build" project is the new directory named "build" that is automatically created in the root of your local project when you run : npm run build. That folder you need to zip it and the load the build.zip file to your Jelastic platform.
Upvotes: 0
Reputation: 51
Basically, port 3000 is not open on the firewall side on the NodeJS nodes that Virtuozzo provides. I think the server would have been accessible if you had opened the corresponding port through the dashboard. You can test if your application is accessible from the NodeJS node by doing a "curl localhost:3000".
Otherwise, I think the best way to make your application accessible from the outside is to use your NodeJS node as you do, but add a loadbalancer NGinx node in front of it. Change the configuration provided to point to port 3000 and not 80 of your NodeJS node. This should be enough.
Upvotes: 0