Authored by 陈峰

Revert "Revert "Merge branch 'feature/docker' into 'master'""

This reverts commit c39a4709
############################################################
# Dockerfile to build hystrix + turbin Installed Containers
# Based on centos 6.7
# How to build new image: docker build -t yoho-hystrix-qcloud .
# the hystrix alert need to post events to influxdb.yohoops.org.
# nginx version: 1.12.0
############################################################
#base image : ccr.ccs.tencentyun.com/yoho-base/nodejs:8.9.1
FROM ccr.ccs.tencentyun.com/yoho-base/nodejs:8.9.1
MAINTAINER feng.chen <feng.chen@yoho.cn>
ENV NODE_ENV=production \
NODE_HOME=/home
COPY yoho-blk-wap.tar.gz /home
RUN cd /home && \
mkdir -p /home/yoho-blk-wap && \
mkdir -p /Data/log/yoho-blk-wap && \
mkdir -p /Data/log/yohoblk-wap && \
tar -xzvf yoho-blk-wap.tar.gz -C /home/yoho-blk-wap && \
rm -rf yoho-blk-wap.tar.gz
WORKDIR /home/yoho-blk-wap
#expose port
EXPOSE 6004
CMD ["node","/home/yoho-blk-wap/app.js"]
... ...
... ... @@ -42,12 +42,32 @@ module.exports = {
},
useOneapm: false,
useCache: true,
memcache: {
master: ['127.0.0.1:11211'],
slave: ['127.0.0.1:11211'],
session: ['127.0.0.1:11211'],
timeout: 1000,
retries: 0
redis: {
connect: {
host: '127.0.0.1',
// 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;
}
}
},
session: {
host: '127.0.01',
port: '6379',
prefix: 'yohoblk_session:'
}
},
interfaceShunt: {
useInterfaceShunt: false,
... ... @@ -64,25 +84,21 @@ module.exports = {
infoFile: {
name: 'info',
level: 'info',
filename: 'logs/info.log',
filename: '/Data/logs/yohoblk-wap/info.log',
maxFiles: 7
},
errorFile: {
name: 'error',
level: 'error',
filename: 'logs/error.log',
filename: '/Data/logs/yohoblk-wap/error.log',
handleExceptions: true,
maxFiles: 7
},
udp: { // send by udp
level: 'debug', // logger level
host: 'influxdblog.yohoops.org', // influxdb host
port: '4444' // influxdb port
},
console: {
level: 'debug',
colorize: 'all',
prettyPrint: true
prettyPrint: true,
debugStdout: true
}
},
thirdLogin: {
... ... @@ -101,12 +117,31 @@ if (isProduction) {
service: 'http://api.yoho.yohoops.org/',
singleApi: 'http://api.yoho.yohoops.org/',
},
memcache: {
master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
slave: [],
session: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
timeout: 100,
retries: 0
redis: {
connect: {
host: 'web.redis.yohoops.org',
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;
}
}
},
session: {
host: 'redis.web.yohoops.org',
port: '6379',
pass: 'redis9646',
prefix: 'yohoblk_session:'
}
},
useOneapm: true,
useCache: true,
... ... @@ -125,25 +160,22 @@ if (isProduction) {
infoFile: {
name: 'info',
level: 'info',
filename: 'logs/info.log',
filename: '/Data/logs/yohoblk-wap/info.log',
maxFiles: 7
},
errorFile: {
name: 'error',
level: 'error',
filename: 'logs/error.log',
filename: '/Data/logs/yohoblk-wap/error.log',
handleExceptions: true,
maxFiles: 7
},
udp: { // send by udp
level: 'debug', // logger level
host: 'influxdblog.yohoops.org', // influxdb host
port: '4444' // influxdb port
},
console: {
close: true,
level: 'info',
colorize: 'all',
prettyPrint: true
prettyPrint: true,
debugStdout: true
}
},
report: {
... ... @@ -160,14 +192,7 @@ if (isProduction) {
service: process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/',
singleApi: process.env.TEST_SINGLE || 'http://api-test1.yohops.com:9999/'
},
memcache: {
master: ['127.0.0.1:11211'],
slave: ['127.0.0.1:11211'],
session: ['127.0.0.1:11211'],
timeout: 100,
retries: 0
},
useOneapm: true,
useCache: true
});
}
\ No newline at end of file
}
... ...
... ... @@ -20,14 +20,14 @@ const cookieParser = require('cookie-parser');
const favicon = require('serve-favicon');
const yohoLib = require('yoho-node-lib');
const session = require('express-session');
const memcached = require('connect-memcached');
const redis = require('connect-redis');
const pkg = require('./package.json');
const devtools = require('./doraemon/middleware/devtools');
const _ = require('lodash');
const uuid = require('uuid');
const MemcachedStore = memcached(session);
const redisStore = redis(session);
// 全局注册library
yohoLib.global(config);
... ... @@ -79,10 +79,7 @@ exports.createApp = async (app) => {
domain: 'yohoblk.com',
httpOnly: false
},
store: new MemcachedStore({
hosts: config.memcache.session,
prefix: 'yohoblk_session:'
})
store: new redisStore(config.redis.session)
}));
app.use((req, res, next) => {
... ... @@ -115,6 +112,10 @@ exports.createApp = async (app) => {
await require('./doraemon/middleware/ssr')(app);
require('./dispatch')(app);
app.use('/crm/common/ok.jsp', (req, res) => {
res.status(204).end();
});
app.all('*', errorHanlder.notFound()); // 404
// YOHO 后置中间件
... ...
#!/bin/bash
wordir=$2
cd $wordir
rm -rf yoho-blk-wap.tar.gz
yarn
if [[ $1 == "TEST1" ]] || [[ $1 == "TEST2" ]] || [[ $1 == "TEST3" ]]
then
yarn build
fi
tar -czvf yoho-blk-wap.tar.gz *
... ...
... ... @@ -12,6 +12,7 @@ const routes = [
{
route: /product\/\d+/,
cache: true,
// disable: true
},
{
... ...
... ... @@ -30,8 +30,8 @@
"babel-polyfill": "^6.26.0",
"bluebird": "^3.4.2",
"body-parser": "^1.15.2",
"connect-memcached": "^0.2.0",
"connect-multiparty": "^2.0.0",
"connect-redis": "^3.3.3",
"cookie-parser": "^1.4.3",
"express": "^4.15.4",
"express-session": "^1.14.1",
... ... @@ -42,7 +42,6 @@
"lodash": "^4.15.0",
"lodash-cli": "^4.17.4",
"lru-cache": "^4.1.1",
"memcached": "^2.2.1",
"mint-ui": "^1.0.2",
"moment": "^2.14.1",
"morgan": "^1.7.0",
... ... @@ -68,7 +67,7 @@
"yoho-cookie": "1.2.0",
"yoho-jquery": "^2.2.4",
"yoho-md5": "^2.0.0",
"yoho-node-lib": "=0.6.1",
"yoho-node-lib": "=0.6.8",
"yoho-qs": "1.0.1",
"yoho-store": "^1.3.20"
},
... ...
... ... @@ -12,7 +12,7 @@ yoho.ready(() => {
yoho.showLoading(false);
$('.home').on('click', () => {
if(yoho.isYohoBuy) {
if (yoho.isYohoBuy) {
yoho.goNewBack();
} else {
yoho.goBack();
... ...
... ... @@ -1916,12 +1916,6 @@ connect-history-api-fallback@^1.3.0:
version "1.5.0"
resolved "http://npm.yohops.com/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz#b06873934bc5e344fef611a196a6faae0aee015a"
connect-memcached@^0.2.0:
version "0.2.0"
resolved "http://npm.yohops.com/connect-memcached/-/connect-memcached-0.2.0.tgz#64907180324e117d9e8f299c994c0cb03d5020cf"
dependencies:
memcached "2.2.x"
connect-multiparty@^2.0.0:
version "2.1.0"
resolved "http://npm.yohops.com/connect-multiparty/-/connect-multiparty-2.1.0.tgz#b562232ea638e13222d87e7b67be437f7ad89814"
... ... @@ -1931,9 +1925,12 @@ connect-multiparty@^2.0.0:
qs "~6.5.1"
type-is "~1.6.15"
connection-parse@0.0.x:
version "0.0.7"
resolved "http://npm.yohops.com/connection-parse/-/connection-parse-0.0.7.tgz#18e7318aab06a699267372b10c5226d25a1c9a69"
connect-redis@^3.3.3:
version "3.3.3"
resolved "http://npm.yohops.com/connect-redis/-/connect-redis-3.3.3.tgz#0fb8f370192f62da75ec7a9507807599fbe15b37"
dependencies:
debug "^3.1.0"
redis "^2.1.0"
console-browserify@^1.1.0:
version "1.1.0"
... ... @@ -2594,6 +2591,10 @@ dot-prop@^4.1.0, dot-prop@^4.1.1:
dependencies:
is-obj "^1.0.0"
double-ended-queue@^2.1.0-0:
version "2.1.0-0"
resolved "http://npm.yohops.com/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz#103d3527fd31528f40188130c841efdd78264e5c"
duplexer2@0.0.2, duplexer2@~0.0.2:
version "0.0.2"
resolved "http://npm.yohops.com/duplexer2/-/duplexer2-0.0.2.tgz#c614dcf67e2fb14995a91711e5a617e8a60a31db"
... ... @@ -3992,13 +3993,6 @@ hasha@^2.2.0:
is-stream "^1.0.1"
pinkie-promise "^2.0.0"
hashring@3.2.x:
version "3.2.0"
resolved "http://npm.yohops.com/hashring/-/hashring-3.2.0.tgz#fda4efde8aa22cdb97fb1d2a65e88401e1c144ce"
dependencies:
connection-parse "0.0.x"
simple-lru-cache "0.0.x"
hawk@3.1.3, hawk@~3.1.3:
version "3.1.3"
resolved "http://npm.yohops.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4"
... ... @@ -4683,12 +4677,6 @@ isstream@0.1.x, isstream@~0.1.2:
version "0.1.2"
resolved "http://npm.yohops.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
jackpot@>=0.0.6:
version "0.0.6"
resolved "http://npm.yohops.com/jackpot/-/jackpot-0.0.6.tgz#3cff064285cbf66f4eab2593c90bce816a821849"
dependencies:
retry "0.6.0"
jpeg-js@0.0.4:
version "0.0.4"
resolved "http://npm.yohops.com/jpeg-js/-/jpeg-js-0.0.4.tgz#06aaf47efec7af0b1924a59cd695a6d2b5ed870e"
... ... @@ -5336,13 +5324,6 @@ mem@^1.1.0:
dependencies:
mimic-fn "^1.0.0"
memcached@2.2.x, memcached@^2.2.1, memcached@^2.2.2:
version "2.2.2"
resolved "http://npm.yohops.com/memcached/-/memcached-2.2.2.tgz#68f86ccfd84bcf93cc25ed46d6d7fc0c7521c9d5"
dependencies:
hashring "3.2.x"
jackpot ">=0.0.6"
memory-fs@^0.2.0:
version "0.2.0"
resolved "http://npm.yohops.com/memory-fs/-/memory-fs-0.2.0.tgz#f2bb25368bc121e391c2520de92969caee0a0290"
... ... @@ -7475,10 +7456,26 @@ redent@^2.0.0:
indent-string "^3.0.0"
strip-indent "^2.0.0"
redis-commands@^1.2.0:
version "1.3.5"
resolved "http://npm.yohops.com/redis-commands/-/redis-commands-1.3.5.tgz#4495889414f1e886261180b1442e7295602d83a2"
redis-commands@^1.3.1:
version "1.3.4"
resolved "http://npm.yohops.com/redis-commands/-/redis-commands-1.3.4.tgz#4822139fab8eaf366fdaaa98a12736054a2fd625"
redis-parser@^2.6.0:
version "2.6.0"
resolved "http://npm.yohops.com/redis-parser/-/redis-parser-2.6.0.tgz#52ed09dacac108f1a631c07e9b69941e7a19504b"
redis@^2.1.0, redis@^2.8.0:
version "2.8.0"
resolved "http://npm.yohops.com/redis/-/redis-2.8.0.tgz#202288e3f58c49f6079d97af7a10e1303ae14b02"
dependencies:
double-ended-queue "^2.1.0-0"
redis-commands "^1.2.0"
redis-parser "^2.6.0"
reduce-css-calc@^1.2.6:
version "1.3.0"
resolved "http://npm.yohops.com/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz#747c914e049614a4c9cfbba629871ad1d2927716"
... ... @@ -7816,10 +7813,6 @@ ret@~0.1.10:
version "0.1.15"
resolved "http://npm.yohops.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc"
retry@0.6.0:
version "0.6.0"
resolved "http://npm.yohops.com/retry/-/retry-0.6.0.tgz#1c010713279a6fd1e8def28af0c3ff1871caa537"
rgb@~0.1.0:
version "0.1.0"
resolved "http://npm.yohops.com/rgb/-/rgb-0.1.0.tgz#be27b291e8feffeac1bd99729721bfa40fc037b5"
... ... @@ -8158,10 +8151,6 @@ signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
resolved "http://npm.yohops.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
simple-lru-cache@0.0.x:
version "0.0.2"
resolved "http://npm.yohops.com/simple-lru-cache/-/simple-lru-cache-0.0.2.tgz#d59cc3a193c1a5d0320f84ee732f6e4713e511dd"
slash@^1.0.0:
version "1.0.0"
resolved "http://npm.yohops.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
... ... @@ -10031,9 +10020,9 @@ yoho-md5@^2.0.0:
version "2.0.0"
resolved "http://npm.yohops.com/yoho-md5/-/yoho-md5-2.0.0.tgz#e801a5cce8e08f5d7211e9a2e789ea7275eb9332"
yoho-node-lib@=0.6.1:
version "0.6.1"
resolved "http://npm.yohops.com/yoho-node-lib/-/yoho-node-lib-0.6.1.tgz#df5f4a22a945371b84db63360d44d37ff68510e6"
yoho-node-lib@=0.6.8:
version "0.6.8"
resolved "http://npm.yohops.com/yoho-node-lib/-/yoho-node-lib-0.6.8.tgz#299266f52b9a8cf86f3a439529a5e00b9e9592f2"
dependencies:
dnscache "^1.0.1"
handlebars "^4.0.5"
... ... @@ -10041,9 +10030,9 @@ yoho-node-lib@=0.6.1:
lodash "^4.13.1"
lru-cache "^4.1.1"
md5 "^2.1.0"
memcached "^2.2.2"
moment "^2.13.0"
pidusage "^1.1.6"
redis "^2.8.0"
request "^2.81.0"
uuid "^3.0.1"
walk "^2.3.9"
... ...