Commit 214a8292 authored by alish's avatar alish
Browse files

fix: pm2 functionality for Admin and ShopWeb apps

parent d4250abd
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -10,23 +10,22 @@
	"tslint.enable": true,
	"typescript.preferences.quoteStyle": "single",
	"files.exclude": {
		"**/.vscode": true,
		".git": true,
		"**/.git": true,
		".build": true,
		".git": true,
		"**/.build": true,
		"**/.DS_Store": true,
		"**/*.js": true,
		"**/.git": true,
		"**/.sourcemaps": true,
		"**/.vscode": true,
		"**/*.js.map": true,
		"build/**/*.js": {
			"when": "$(basename).ts"
		},
		"**/node_modules": true,
		"**/dist": true,
		"**/build": true,
		"**/.build": true,
		"**/.sourcemaps": true,
		"**/dist": true,
		"**/node_modules": true,
		"**/www": true,
		"**/yarn.lock": true
		"**/yarn.lock": true,
		"build/**/*.js": {
			"when": "$(basename).ts"
		}
	},
	"search.exclude": {
		"**/.vscode": true,
+2 −2
Original line number Diff line number Diff line
@@ -80,9 +80,9 @@
		"@types/jasminewd2": "^2.0.6",
		"@types/leaflet": "^1.5.12",
		"@types/node": "^10.9.4",
		"@types/source-map": "^0.5.7",
		"@types/socket.io": "^2.1.4",
		"@types/socket.io-client": "^1.4.32",
		"@types/source-map": "^0.5.7",
		"@types/swiper": "^4.4.2",
		"@types/uglify-js": "^3.0.4",
		"@types/uuid": "^3.4.4",
@@ -115,6 +115,7 @@
		"envalid": "^5.0.0",
		"exports-loader": "^0.7.0",
		"expose-loader": "^0.7.5",
		"extract-text-webpack-plugin": "^3.0.2",
		"file-loader": "^4.3.0",
		"find-root": "^1.1.0",
		"gh-pages": "^2.0.1",
@@ -189,7 +190,6 @@
		"webpack": "4.42.1",
		"webpack-bundle-analyzer": "^3.6.1",
		"webpack-cli": "^3.3.10",
		"webpack-command": "^0.5.0",
		"webpack-dev-middleware": "^3.7.2",
		"webpack-dev-server": "^3.9.0",
		"webpack-graphql-loader": "^1.0.2",
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@
		"config:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max_old_space_size=4096 yarn run config -- --environment=prod",
		"start": "cross-env NODE_ENV=development NODE_OPTIONS=--max_old_space_size=4096 yarn run config:dev && ng serve",
		"start:server:prod": "cross-env NODE_ENV=development NODE_OPTIONS=--max_old_space_size=4096 yarn run build:prod && node --harmony ./dist/out-tsc/app.js",
		"start:server:pm2": "cross-env NODE_ENV=production NODE_OPTIONS=--max_old_space_size=4096 yarn run build:prod && node --harmony ./dist/out-tsc/pm2bootstrap.js",
		"start:server:pm2": "cross-env NODE_ENV=production NODE_OPTIONS=--max_old_space_size=4096 yarn run build:prod && node --harmony ./dist/out-tsc/packages/admin-web-angular/src/pm2bootstrap.js",
		"build": "cross-env NODE_ENV=development NODE_OPTIONS=--max_old_space_size=4096 yarn run config:dev && yarn ng:dev build && yarn tsc",
		"build:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max_old_space_size=4096 yarn run config:prod && yarn ng:prod build -- --prod --aot=false --build-optimizer=false && yarn tsc",
		"test": "cross-env NODE_ENV=development NODE_OPTIONS=--max_old_space_size=4096 yarn run config:dev && ng:dev test",
+2 −2
Original line number Diff line number Diff line
import connect from 'connect';
import path from 'path';
import serveStatic from 'serve-static';
import { env } from './scripts/env';
import { env } from '../scripts/env';

const port: number = env.PORT;

connect()
	.use(serveStatic(path.join(__dirname, '../')))
	.use(serveStatic(path.join(__dirname, '../../../../../build')))
	.listen(port);

console.log(`listening on ${port}`);
+2 −2
Original line number Diff line number Diff line
require('dotenv').config();
const pm2 = require('pm2');

import { env } from './scripts/env';
import { env } from '../scripts/env';

const MACHINE_NAME = process.env.KEYMETRICS_MACHINE_NAME;
const PRIVATE_KEY = process.env.KEYMETRICS_SECRET_KEY;
@@ -14,7 +14,7 @@ const port = env.PORT;
pm2.connect(function () {
	pm2.start(
		{
			script: './dist/out-tsc/app.js',
			script: './dist/out-tsc/packages/admin-web-angular/src/app.js',
			name: appName, // ----> THESE ATTRIBUTES ARE OPTIONAL:
			exec_mode: 'fork', // ----> https://github.com/Unitech/PM2/blob/master/ADVANCED_README.md#schema
			instances,
Loading