环境:增加监控服务器配置
部署:修改 pm2 启动相关文件
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
require('xprofiler').start();
|
||||||
import { COM_TEAM_STATUS } from './app/consts';
|
import { COM_TEAM_STATUS } from './app/consts';
|
||||||
import {
|
import {
|
||||||
createTcpAcceptor,
|
createTcpAcceptor,
|
||||||
@@ -38,7 +39,7 @@ filePath.CONFIG_DIR = '/config';
|
|||||||
const adminfilePath = _pinus.DEFAULT_ADMIN_PATH;
|
const adminfilePath = _pinus.DEFAULT_ADMIN_PATH;
|
||||||
adminfilePath.ADMIN_FILENAME = 'adminUser';
|
adminfilePath.ADMIN_FILENAME = 'adminUser';
|
||||||
adminfilePath.ADMIN_USER = 'config/adminUser';
|
adminfilePath.ADMIN_USER = 'config/adminUser';
|
||||||
const ALL_ENVS = 'production|development|alpha|dev|isbn';
|
const ALL_ENVS = 'production|development|alpha|dev|isbn|monitor';
|
||||||
/**
|
/**
|
||||||
* 替换全局Promise
|
* 替换全局Promise
|
||||||
* 自动解析sourcemap
|
* 自动解析sourcemap
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"env":"alpha"}
|
{"env":"development"}
|
||||||
|
|||||||
@@ -24,5 +24,10 @@ module.exports = {
|
|||||||
'mongo': 'mongodb://root:Bantus123@dds-8vb74337eab84d641.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vb74337eab84d642.mongodb.zhangbei.rds.aliyuncs.com:3717/admin?replicaSet=mgset-504694158',
|
'mongo': 'mongodb://root:Bantus123@dds-8vb74337eab84d641.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vb74337eab84d642.mongodb.zhangbei.rds.aliyuncs.com:3717/admin?replicaSet=mgset-504694158',
|
||||||
'redis': 'r-8vbekkbb3z8ru2ckuj.redis.zhangbei.rds.aliyuncs.com',
|
'redis': 'r-8vbekkbb3z8ru2ckuj.redis.zhangbei.rds.aliyuncs.com',
|
||||||
'redispw': 'zyz_isbn_2021'
|
'redispw': 'zyz_isbn_2021'
|
||||||
|
},
|
||||||
|
'monitor': {
|
||||||
|
'mongo': 'mongodb://dbop:zyzMon2021@dds-8vb7474e31ba7ed41.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vb7474e31ba7ed42.mongodb.zhangbei.rds.aliyuncs.com:3717/zyz?replicaSet=mgset-505529944',
|
||||||
|
'redis': 'r-8vb130185rp2ir3lqn.redis.zhangbei.rds.aliyuncs.com',
|
||||||
|
'redispw': 'zyz_monitor_2021'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -23,5 +23,10 @@ module.exports = {
|
|||||||
'id': 'master-server-1',
|
'id': 'master-server-1',
|
||||||
'host': '127.0.0.1',
|
'host': '127.0.0.1',
|
||||||
'port': 3005
|
'port': 3005
|
||||||
|
},
|
||||||
|
'monitor': {
|
||||||
|
'id': 'master-server-1',
|
||||||
|
'host': '127.0.0.1',
|
||||||
|
'port': 3005
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -197,5 +197,35 @@ module.exports = {
|
|||||||
{'id': 'guild-server-1', 'host': '127.0.0.1', 'port': 6057, "args": " --inspect=9239"},
|
{'id': 'guild-server-1', 'host': '127.0.0.1', 'port': 6057, "args": " --inspect=9239"},
|
||||||
{'id': 'guild-server-2', 'host': '127.0.0.1', 'port': 6058, "args": " --inspect=9240"}
|
{'id': 'guild-server-2', 'host': '127.0.0.1', 'port': 6058, "args": " --inspect=9240"}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
'monitor': {
|
||||||
|
'connector': [
|
||||||
|
{'id': 'connector-server-1', 'port': 4050, 'clientHost': 'zyz_monitor.trgame.cn', 'host': '127.0.0.1', 'clientPort': 3050, 'frontend': true},
|
||||||
|
{'id': 'connector-server-2', 'port': 4051, 'clientHost': 'zyz_monitor.trgame.cn', 'host': '127.0.0.1', 'clientPort': 3051, 'frontend': true},
|
||||||
|
{'id': 'connector-server-3', 'port': 4052, 'clientHost': 'zyz_monitor.trgame.cn', 'host': '127.0.0.1', 'clientPort': 3052, 'frontend': true}
|
||||||
|
],
|
||||||
|
'chat': [
|
||||||
|
{'id': 'chat-server-1', 'host': '127.0.0.1', 'port': 6050},
|
||||||
|
],
|
||||||
|
'role': [
|
||||||
|
{'id': 'role-server-1', 'host': '127.0.0.1', 'port': 6053}
|
||||||
|
],
|
||||||
|
'battle': [
|
||||||
|
{'id': 'battle-server-1', 'host': '127.0.0.1', 'port': 6054}
|
||||||
|
],
|
||||||
|
'gate': [
|
||||||
|
{'id': 'gate-server-1', 'host': '127.0.0.1', 'clientHost': 'zyz_monitor.trgame.cn', 'clientPort': 3014, 'frontend': true},
|
||||||
|
{'id': 'gate-server-2', 'host': '127.0.0.1', 'clientHost': 'zyz_monitor.trgame.cn', 'clientPort': 3015, 'frontend': true}
|
||||||
|
],
|
||||||
|
'gm': [
|
||||||
|
{'id': 'gm-server-1', 'host': '127.0.0.1', 'port': 6055}
|
||||||
|
],
|
||||||
|
'systimer': [
|
||||||
|
{'id': 'systimer-server-1', 'host': '127.0.0.1', 'port': 6056}
|
||||||
|
],
|
||||||
|
'guild': [
|
||||||
|
{'id': 'guild-server-1', 'host': '127.0.0.1', 'port': 6057, "args": " --inspect=9239"},
|
||||||
|
{'id': 'guild-server-2', 'host': '127.0.0.1', 'port': 6058, "args": " --inspect=9240"}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
41
game-server/package-lock.json
generated
41
game-server/package-lock.json
generated
@@ -1799,6 +1799,11 @@
|
|||||||
"thenify-all": "^1.0.0"
|
"thenify-all": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nan": {
|
||||||
|
"version": "2.14.2",
|
||||||
|
"resolved": "https://registry.npm.taobao.org/nan/download/nan-2.14.2.tgz?cache=0&sync_timestamp=1602591700047&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnan%2Fdownload%2Fnan-2.14.2.tgz",
|
||||||
|
"integrity": "sha1-9TdkAGlRaPTMaUrJOT0MlYXu6hk="
|
||||||
|
},
|
||||||
"nanoid": {
|
"nanoid": {
|
||||||
"version": "3.1.12",
|
"version": "3.1.12",
|
||||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.12.tgz",
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.12.tgz",
|
||||||
@@ -2979,6 +2984,42 @@
|
|||||||
"resolved": "https://registry.npm.taobao.org/xmlhttprequest-ssl/download/xmlhttprequest-ssl-1.5.5.tgz?cache=0&sync_timestamp=1564594177335&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fxmlhttprequest-ssl%2Fdownload%2Fxmlhttprequest-ssl-1.5.5.tgz",
|
"resolved": "https://registry.npm.taobao.org/xmlhttprequest-ssl/download/xmlhttprequest-ssl-1.5.5.tgz?cache=0&sync_timestamp=1564594177335&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fxmlhttprequest-ssl%2Fdownload%2Fxmlhttprequest-ssl-1.5.5.tgz",
|
||||||
"integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4="
|
"integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4="
|
||||||
},
|
},
|
||||||
|
"xprofiler": {
|
||||||
|
"version": "1.2.5",
|
||||||
|
"resolved": "https://registry.npm.taobao.org/xprofiler/download/xprofiler-1.2.5.tgz",
|
||||||
|
"integrity": "sha1-ugaj1UMv9zIoQR6mhsNTnMWWTsQ=",
|
||||||
|
"requires": {
|
||||||
|
"moment": "^2.29.1",
|
||||||
|
"nan": "^2.14.2",
|
||||||
|
"node-pre-gyp": "^0.16.0",
|
||||||
|
"uuid": "^8.3.1",
|
||||||
|
"yargs": "^15.4.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"node-pre-gyp": {
|
||||||
|
"version": "0.16.0",
|
||||||
|
"resolved": "https://registry.npm.taobao.org/node-pre-gyp/download/node-pre-gyp-0.16.0.tgz?cache=0&sync_timestamp=1612890864161&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-pre-gyp%2Fdownload%2Fnode-pre-gyp-0.16.0.tgz",
|
||||||
|
"integrity": "sha1-I4+lQDZHhOUBXfzbp42jk34Y29w=",
|
||||||
|
"requires": {
|
||||||
|
"detect-libc": "^1.0.2",
|
||||||
|
"mkdirp": "^0.5.3",
|
||||||
|
"needle": "^2.5.0",
|
||||||
|
"nopt": "^4.0.1",
|
||||||
|
"npm-packlist": "^1.1.6",
|
||||||
|
"npmlog": "^4.0.2",
|
||||||
|
"rc": "^1.2.7",
|
||||||
|
"rimraf": "^2.6.1",
|
||||||
|
"semver": "^5.3.0",
|
||||||
|
"tar": "^4.4.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"uuid": {
|
||||||
|
"version": "8.3.2",
|
||||||
|
"resolved": "https://registry.npm.taobao.org/uuid/download/uuid-8.3.2.tgz?cache=0&sync_timestamp=1607460209394&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuuid%2Fdownload%2Fuuid-8.3.2.tgz",
|
||||||
|
"integrity": "sha1-gNW1ztJxu5r2xEXyGhoExgbO++I="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"xtend": {
|
"xtend": {
|
||||||
"version": "4.0.2",
|
"version": "4.0.2",
|
||||||
"resolved": "https://registry.npm.taobao.org/xtend/download/xtend-4.0.2.tgz",
|
"resolved": "https://registry.npm.taobao.org/xtend/download/xtend-4.0.2.tgz",
|
||||||
|
|||||||
@@ -50,7 +50,8 @@
|
|||||||
"request": "^2.88.2",
|
"request": "^2.88.2",
|
||||||
"request-promise": "^4.2.6",
|
"request-promise": "^4.2.6",
|
||||||
"source-map-support": "^0.5.0",
|
"source-map-support": "^0.5.0",
|
||||||
"ts-node": "^8.2.0"
|
"ts-node": "^8.2.0",
|
||||||
|
"xprofiler": "^1.2.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node-schedule": "^1.3.1",
|
"@types/node-schedule": "^1.3.1",
|
||||||
|
|||||||
121
game-server/pm2Config.js
Normal file
121
game-server/pm2Config.js
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
/**
|
||||||
|
* Created by superzhan on 2018/3/19.
|
||||||
|
*
|
||||||
|
* 根据pomelo 的 servers.json 生成 pm2 启动文件
|
||||||
|
*/
|
||||||
|
|
||||||
|
//服务器端 工程代码的目录
|
||||||
|
var cwd='./';
|
||||||
|
|
||||||
|
//项目的运行环境
|
||||||
|
var config = require('./config.json');
|
||||||
|
var envType= config.env;
|
||||||
|
|
||||||
|
//配置文件的输出目录
|
||||||
|
var outputFilePath = './pomeloPm2Start.json';
|
||||||
|
|
||||||
|
var masterJsonFile = require('./config/master.ts');
|
||||||
|
var serversJosnFile = require('./config/servers.ts');
|
||||||
|
|
||||||
|
//模板数据
|
||||||
|
var processConfigType = {
|
||||||
|
"name" : "",
|
||||||
|
"script" : "./dist/app.js",
|
||||||
|
"args" : [] ,
|
||||||
|
"watch": false,
|
||||||
|
"out_file": "./logs/app.log",
|
||||||
|
"error_file": "./logs/err.log",
|
||||||
|
"cwd": "",
|
||||||
|
"merge_logs": true,
|
||||||
|
"exec_mode": "fork_mode",
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//最后的结果数据
|
||||||
|
var resultJson={};
|
||||||
|
resultJson.apps=new Array();
|
||||||
|
|
||||||
|
|
||||||
|
var clone = function(origin) {
|
||||||
|
if(!origin) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var obj = {};
|
||||||
|
for(var f in origin) {
|
||||||
|
obj[f] = origin[f];
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
var masterConfig = masterJsonFile[envType];
|
||||||
|
var serversConfig = serversJosnFile[envType];
|
||||||
|
|
||||||
|
//生成master 的配置
|
||||||
|
var pm2Master = clone( processConfigType );
|
||||||
|
pm2Master.name="master";
|
||||||
|
pm2Master.args = new Array();
|
||||||
|
pm2Master.args.push('serverType=master');
|
||||||
|
pm2Master.args.push('id='+masterConfig.id);
|
||||||
|
pm2Master.args.push('host='+masterConfig.host);
|
||||||
|
pm2Master.args.push('port='+masterConfig.port);
|
||||||
|
pm2Master.args.push('env='+envType);
|
||||||
|
pm2Master.args.push('mode=stand-alone');
|
||||||
|
pm2Master.cwd= cwd;
|
||||||
|
pm2Master.out_file = './logs/'+masterConfig.id+"_app.log";
|
||||||
|
pm2Master.error_file='./logs/'+masterConfig.id+'_error.log';
|
||||||
|
resultJson.apps.push(pm2Master);
|
||||||
|
|
||||||
|
//生成当个服务器的配置
|
||||||
|
for(serverType in serversConfig)
|
||||||
|
{
|
||||||
|
var servers = serversConfig[serverType];
|
||||||
|
for(var i=0;i<servers.length;++i)
|
||||||
|
{
|
||||||
|
var singleServer= servers[i];
|
||||||
|
|
||||||
|
var appPm2Config = clone(processConfigType);
|
||||||
|
appPm2Config.name=singleServer.id;
|
||||||
|
appPm2Config.args= new Array();
|
||||||
|
appPm2Config.args.push('env='+envType);
|
||||||
|
appPm2Config.args.push('id='+singleServer.id);
|
||||||
|
appPm2Config.args.push('port='+singleServer.port);
|
||||||
|
appPm2Config.args.push('host='+singleServer.host);
|
||||||
|
appPm2Config.args.push('serverType='+serverType);
|
||||||
|
|
||||||
|
if(singleServer.frontend !=null)
|
||||||
|
{
|
||||||
|
appPm2Config.args.push('frontend='+ singleServer.frontend);
|
||||||
|
appPm2Config.args.push('clientPort='+singleServer.clientPort);
|
||||||
|
appPm2Config.args.push('clientHost='+singleServer.clientHost);
|
||||||
|
}
|
||||||
|
|
||||||
|
appPm2Config.cwd= cwd;
|
||||||
|
appPm2Config.out_file = './logs/'+ singleServer.id+'_app.log';
|
||||||
|
appPm2Config.error_file = './logs/'+singleServer.id+'_error.log';
|
||||||
|
|
||||||
|
resultJson.apps.push(appPm2Config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//生成结果数据
|
||||||
|
var resultFileStr = JSON.stringify(resultJson);
|
||||||
|
//console.log(resultFileStr);
|
||||||
|
|
||||||
|
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
|
fs.writeFile(outputFilePath, resultFileStr, function (err) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
} else {
|
||||||
|
console.log('finish genereate Server pm2 config');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
5
game-server/pm2Starter.sh
Executable file
5
game-server/pm2Starter.sh
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#/bin/bash
|
||||||
|
npm install #安装依赖库
|
||||||
|
npm run build
|
||||||
|
node pm2Config.js #使用pm2来做进程管理,生成进程配置文件
|
||||||
|
pm2 start pomeloPm2Start.json #pm2 启动游戏服务器
|
||||||
55
gm-server/config/config.monitor.ts
Normal file
55
gm-server/config/config.monitor.ts
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg';
|
||||||
|
|
||||||
|
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 + '_1600244957952_7142';
|
||||||
|
|
||||||
|
// add your egg config in here
|
||||||
|
config.middleware = [];
|
||||||
|
|
||||||
|
config.cluster = {
|
||||||
|
listen: {
|
||||||
|
port: 7500
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// add your special config in here
|
||||||
|
const bizConfig = {
|
||||||
|
sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`,
|
||||||
|
};
|
||||||
|
|
||||||
|
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.security = {
|
||||||
|
csrf: {
|
||||||
|
enable: false,
|
||||||
|
ignoreJSON: true
|
||||||
|
},
|
||||||
|
domainWhiteList: ['http://localhost:9000']
|
||||||
|
};
|
||||||
|
|
||||||
|
// 配置上传
|
||||||
|
config.multipart = {
|
||||||
|
fileSize: '50mb',
|
||||||
|
mode: 'stream',
|
||||||
|
fileExtensions: ['.zip', '.tar.gz'], // 扩展几种上传的文件格式
|
||||||
|
};
|
||||||
|
|
||||||
|
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' ],
|
||||||
|
};
|
||||||
|
|
||||||
|
// the return config will combines to EggAppConfig
|
||||||
|
return {
|
||||||
|
...config,
|
||||||
|
...bizConfig,
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -4,6 +4,7 @@ if [ $# != 1 ] ; then
|
|||||||
echo "stable: 同步代码到 stable 服务器上,作为正式服使用"
|
echo "stable: 同步代码到 stable 服务器上,作为正式服使用"
|
||||||
echo "alpha: 同步代码到 alpha 服务器上,作为测试服供服务开发使用"
|
echo "alpha: 同步代码到 alpha 服务器上,作为测试服供服务开发使用"
|
||||||
echo "dev: 同步代码到 dev 服务器上,作为测试服供服务开发使用"
|
echo "dev: 同步代码到 dev 服务器上,作为测试服供服务开发使用"
|
||||||
|
echo "monitor: 同步代码到 monitor 服务器上,用做监控和压力测试"
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -15,6 +16,8 @@ elif [ ${1} == 'dev' ] ; then
|
|||||||
destUrl="root@zyzdev:/root/zyz/"
|
destUrl="root@zyzdev:/root/zyz/"
|
||||||
elif [ ${1} == 'isbn' ] ; then
|
elif [ ${1} == 'isbn' ] ; then
|
||||||
destUrl="root@zyzisbn:/root/zyz/"
|
destUrl="root@zyzisbn:/root/zyz/"
|
||||||
|
elif [ ${1} == 'monitor' ] ; then
|
||||||
|
destUrl="root@zyzmon:/root/zyz/"
|
||||||
else
|
else
|
||||||
echo "需要一个参数指明服务器"
|
echo "需要一个参数指明服务器"
|
||||||
exit 1;
|
exit 1;
|
||||||
@@ -23,4 +26,4 @@ fi
|
|||||||
node ./game-server/config.js ${1}
|
node ./game-server/config.js ${1}
|
||||||
|
|
||||||
rsync -av --include '.babelrc' --include '.eslintrc.js' --exclude '.*' --exclude './game-server/node_modules' --exclude './game-server/node_modules' --exclude './game-server/dist' --exclude 'node_modules' --exclude 'bower_components' --exclude 'dist' --progress --inplace --no-owner --no-group --rsh='ssh -p22' . ${destUrl}
|
rsync -av --include '.babelrc' --include '.eslintrc.js' --exclude '.*' --exclude './game-server/node_modules' --exclude './game-server/node_modules' --exclude './game-server/dist' --exclude 'node_modules' --exclude 'bower_components' --exclude 'dist' --progress --inplace --no-owner --no-group --rsh='ssh -p22' . ${destUrl}
|
||||||
git checkout ./game-server/config.json
|
git checkout ./game-server/config.json
|
||||||
|
|||||||
1
web-server/app/resource
Symbolic link
1
web-server/app/resource
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../shared/resource
|
||||||
61
web-server/config/config.monitor.ts
Normal file
61
web-server/config/config.monitor.ts
Normal 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,
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -21,7 +21,8 @@
|
|||||||
"lint": "eslint . --ext .ts",
|
"lint": "eslint . --ext .ts",
|
||||||
"clean": "ets clean",
|
"clean": "ets clean",
|
||||||
"local": "cross-env EGG_SERVER_ENV=local npm run dev",
|
"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": {
|
"dependencies": {
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
@@ -33,6 +34,8 @@
|
|||||||
"egg-view-nunjucks": "^2.2.0",
|
"egg-view-nunjucks": "^2.2.0",
|
||||||
"mongoose-transactions": "^1.1.4",
|
"mongoose-transactions": "^1.1.4",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
|
"request": "^2.88.2",
|
||||||
|
"request-promise": "^4.2.6",
|
||||||
"underscore": "^1.12.0"
|
"underscore": "^1.12.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
Reference in New Issue
Block a user