Dennis

Dennis

Planned

I need to test whether it's easy in Ploi to host Next JS and/or Nuxt JS projects easily.

seitenumbruch

seitenumbruch

· · Edited
·

Not sure if this is useful or not... But I am currently working with Nuxt JS (v2) and I don't find it particularly difficult to host Nuxt projects (using SSR) using Ploi. This is what I do:

(1) Create a new site with project type "None" and web directory "/".

(2) Alter deploy code like so:

cd /home/someuser/project.com
git pull origin master

npm i
npm run build

echo "🚀 Application deployed!"

(3) Alter Nginx config according/similar to NuxtJS Nginx example for Laravel Forge.

(4) In /home/someuser/ create file ecosystem.config.js:

module.exports = {
  apps: [
    {
      name: "project.com",
      exec_mode: "cluster",
      instances: "max",
      cwd: "./project.com",
      script: "./node_modules/nuxt/bin/nuxt.js",
      args: "start",
      env: {
        PORT: 3000,
      },
    },
  ],
}

(5) Deploy.

(6) SSH into server and run pm2 start ecosystem.config.js.

(7) In deploy code add pm2 reload "project.com":

cd /home/someuser/project.com
git pull origin master

npm i
npm run build
pm2 reload "project.com" # <-- this

echo "🚀 Application deployed!"

I am not sure if this is a good way to go about things... but it works for me.

3 total votes
Green17 Azurite Solutions SMIT.
SMIT.

SMIT.

·
·

@Dennis I can give you examples for 2 different deployment styles for Nuxt3.

  1. Build on server (basic)
  2. Build locally/remote (ci/cd) and only deploy the .output of Nuxt3
no votes yet
Felix

Felix

·
·

Is there any update on this?

The current process for deploying Nuxt 3 applications feels quite unintuitive. The main pain point is the manual intervention required after each deployment. We have to SSH into the server to update the Nginx configuration with the correct port from the ecosystem.config.js. This manual step breaks the otherwise smooth, automated workflow that Ploi provides.

The general setup for a Nuxt 3 app using the "Node.js" server type in Ploi isn't very clear. It would be a huge improvement if Ploi could automatically handle the port mapping from the ecosystem.config.js to the Nginx configuration during the deployment process.

no votes yet

Test: Next JS & Nuxt JS hosting

15 total votes
  • Dennis moved item to board Planned

    2 years ago
  • Dennis moved item to project Site Level Requests

    2 years ago
  • Dennis created the item

    2 years ago