Added pm2 deployment script

master
Mats 2020-08-20 08:20:33 +02:00
parent 2536a72a0b
commit 4963406fdc
1 changed files with 43 additions and 0 deletions

43
Deployments.md Normal file

@ -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')