From 4963406fdc50b8fd5c438c329571ca83f03f7c4f Mon Sep 17 00:00:00 2001 From: Mats Date: Thu, 20 Aug 2020 08:20:33 +0200 Subject: [PATCH] Added pm2 deployment script --- Deployments.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Deployments.md diff --git a/Deployments.md b/Deployments.md new file mode 100644 index 0000000..8d6248f --- /dev/null +++ b/Deployments.md @@ -0,0 +1,43 @@ +### Create a production build + +``` +npm run build +``` + +### Start the application + +``` +npm start +``` + +By default this will launch the application on `http://localhost:3000`. You will need to either +[proxy](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/) requests from your web server +or change the [port](https://nextjs.org/docs/api-reference/cli#production) to serve the application directly. + +### pm2 + +Start the application with pm2 'the process manager for production Node.js application' as follows: + +``` +pm2 start npm --name "unami" -- start +``` + +### Custom port + +Add the custom port in the file 'package.json' as follows: + +Add the custom port (here '-p 3010') at the start script and follow one of the run scripts above: + +```json +"scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start -p 3010", + "build-tracker": "rollup -c rollup.tracker.config.js", + "build-mysql-schema": "dotenv prisma introspect -- --schema=./prisma/schema.mysql.prisma", + "build-mysql-client": "dotenv prisma generate -- --schema=./prisma/schema.mysql.prisma", + "build-postgresql-schema": "dotenv prisma introspect -- --schema=./prisma/schema.postgresql.prisma", + "build-postgresql-client": "dotenv prisma generate -- --schema=./prisma/schema.postgresql.prisma" +}, +``` +(Here the custom port is added with '-p 3010') \ No newline at end of file