环境:增加监控服务器配置

部署:修改 pm2 启动相关文件
This commit is contained in:
liangtongchuan
2021-04-20 14:57:52 +08:00
parent fb52dfbfda
commit 011335ff1f
14 changed files with 337 additions and 5 deletions
+1
View File
@@ -0,0 +1 @@
../../shared/resource
+61
View File
@@ -0,0 +1,61 @@
import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg';
const path = require('path');
export default (appInfo: EggAppInfo) => {
const config = {} as PowerPartial<EggAppConfig>;
// override config from framework / plugin
// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1597499383757_3508';
config.security = {
csrf: {
enable: false,
},
domainWhiteList: [ '*' ],
};
config.cors = {
origin: '*', // 匹配规则 域名+端口 *则为全匹配
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
};
// add your egg config in here
config.middleware = [ 'parmsDecode' ];
config.mongoose = {
url: 'mongodb://dbop:zyzMon2021@dds-8vb7474e31ba7ed41.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vb7474e31ba7ed42.mongodb.zhangbei.rds.aliyuncs.com:3717/zyz?replicaSet=mgset-505529944', // 内网
options: { useNewUrlParser: true, useUnifiedTopology: true },
};
config.alinode = {
appid: '86043',
secret: '54ef0364995b0c4f2ab42150e29ad30df8327a3a',
error_log: [ '/root/logs/zyz/zyz-web.log', '/root/logs/zyz/common-error.log', '/root/logs/zyz/egg-agent.log' ],
packages: [ '/root/zyz/web-server/package.json' ],
};
config.view = {
root: path.join(appInfo.baseDir, '/app/public'),
defaultViewEngine: 'nunjucks',
mapping: {
'.html': 'nunjucks' //左边写成.html后缀,会自动渲染.html文件
},
};
config.decodeParm = true;
config.static = {
prefix: '/',
dir: path.join(appInfo.baseDir, '/app/public'),
};
// add your special config in here
const bizConfig = {
sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`,
};
// the return config will combines to EggAppConfig
return {
...config,
...bizConfig,
};
};
+4 -1
View File
@@ -21,7 +21,8 @@
"lint": "eslint . --ext .ts",
"clean": "ets clean",
"local": "cross-env EGG_SERVER_ENV=local npm run dev",
"isbn": "cross-env EGG_SERVER_ENV=isbn npm run dev"
"isbn": "cross-env EGG_SERVER_ENV=isbn npm run dev",
"monitor": "cross-env EGG_SERVER_ENV=monitor npm run dev"
},
"dependencies": {
"cross-env": "^7.0.3",
@@ -33,6 +34,8 @@
"egg-view-nunjucks": "^2.2.0",
"mongoose-transactions": "^1.1.4",
"reflect-metadata": "^0.1.13",
"request": "^2.88.2",
"request-promise": "^4.2.6",
"underscore": "^1.12.0"
},
"devDependencies": {