Authored by TaoHuang

fix config

... ... @@ -7,26 +7,21 @@
############################################################
#base image : ccr.ccs.tencentyun.com/yoho-base/nodejs
FROM ccr.ccs.tencentyun.com/yoho-base/nodejs
FROM ccr.ccs.tencentyun.com/yoho-base/node:10.4.1-alpine-fix
MAINTAINER jimi <jimi.ji@yoho.cn>
MAINTAINER tao.huang <tao.huang@yoho.cn>
ENV NODE_ENV production
ENV NODE_HOME /home/yoho-node-ci
RUN mkdir -p "$NODE_HOME"
ENV NODE_ENV=production \
NODE_HOME=/home
WORKDIR $NODE_HOME
RUN cd /home && \
mkdir -p /home/yoho-node-ci
COPY yoho-node-ci.tar.gz $NODE_HOME
COPY . /home/yoho-node-ci
RUN set -x \
&& mkdir -p /Data/logs/node/yoho-node-ci \
&& tar -xzf yoho-node-ci.tar.gz -C "$NODE_HOME" \
&& rm -rf yoho-node-ci.tar.gz
WORKDIR /home/yoho-node-ci
#expose port
EXPOSE 9000
CMD ["node","app.js"]
\ No newline at end of file
EXPOSE 6001
CMD ["node","/home/yoho-node-ci/app.js"]
... ...
... ... @@ -32,6 +32,11 @@ app.keys = ['yoho-node-ci secret'];
app.use(compress())
// docker验证项目是否正常发布
app.use('/node/status.html', (req, res) => {
return res.status(204).end();
});
app.use(errorHandle(app));
app.use(serve(__dirname + '/public'));
app.use(convert(session({}, app)));
... ... @@ -50,7 +55,6 @@ app.use(convert(body({
})));
app.use(mount('/', webApp));
server.listen(port, () => {
console.log(`app started in ${port}`);
... ...
... ... @@ -2,7 +2,11 @@
const path = require('path');
const env = process.env.NODE_ENV || 'development';
let env = process.env.NODE_ENV || 'development';
if (process.env.NODE_ENV === 'test3') {
env = 'test';
}
const defaults = {
port: 9000,
... ... @@ -70,7 +74,37 @@ const defaults = {
const specific = {
development: {},
test: {},
test: {
redis: {
connect: {
host: 'redis.yohoops.com',
// host: '192.168.102.49',
port: '6379',
enable_offline_queue: false,
retry_strategy(options) {
if (options.error && options.error.code === 'ECONNREFUSED') {
console.log('connect redis server fail');
}
if (options.attempt < 10) {
return Math.min(options.attempt * 100, 1000);
} else if (options.attempt > 10 && options.attempt < 100) {
return 1000;
} else {
return 1000 * 10;
}
}
}
},
mysql: {
host: '192.168.102.219',
user: 'yh_test',
password: 'yh_test',
port: '3306',
database: 'yoho_seo'
},
},
production: {
apm: {
aws: {
... ...