feat: pm2 support and start script for production env

This commit is contained in:
lefuturiste 2020-07-26 13:43:13 +00:00
parent ecf9a0720e
commit 289e7839c6
3 changed files with 22 additions and 2 deletions

18
ecosystem.config.js Normal file
View file

@ -0,0 +1,18 @@
module.exports = {
apps: [{
name: "fva_server",
script: "./dist/app.js",
env: {
NODE_ENV: "development"
},
env_test: {
NODE_ENV: "test",
},
env_staging: {
NODE_ENV: "staging",
},
env_production: {
NODE_ENV: "production"
}
}]
}

View file

@ -48,10 +48,10 @@
"test": "jest --verbose --detectOpenHandles", "test": "jest --verbose --detectOpenHandles",
"test-watch": "jest --verbose --watchAll", "test-watch": "jest --verbose --watchAll",
"dev": "./node_modules/.bin/tsc --watch", "dev": "./node_modules/.bin/tsc --watch",
"serve": "./node_modules/.bin/nodemon dist/app.js", "serve": "env ASSETS_PATH=./assets/development ./node_modules/.bin/nodemon dist/app.js",
"build": "./node_modules/.bin/tsc", "build": "./node_modules/.bin/tsc",
"assets": "./node_modules/.bin/gulp build", "assets": "./node_modules/.bin/gulp build",
"start": "node app.js" "start": "env ASSETS_PATH=./assets/production node ./dist/app.js"
}, },
"main": "dist/index.js", "main": "dist/index.js",
"devDependencies": { "devDependencies": {

2
start.sh Normal file
View file

@ -0,0 +1,2 @@
pm2 start --name fva_server npm -- start