Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
)
go_binary(
name = "cmd",
embed = [":go_default_library"],
tags = ["automanaged"],
)
go_library(
name = "go_default_library",
srcs = ["main.go"],
data = ["app-feed-test.toml"],
importpath = "go-common/app/interface/main/app-feed/cmd",
tags = ["automanaged"],
deps = [
"//app/interface/main/app-feed/conf:go_default_library",
"//app/interface/main/app-feed/http:go_default_library",
"//library/ecode/tip:go_default_library",
"//library/log:go_default_library",
"//library/net/trace:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,367 @@
# This is a TOML document. Boom.
env = "uat"
tick = "1m"
[feed]
feedCacheCount = 200
liveFeedCount = 7
# index
[feed.index]
count = 10
iPadCount = 20
moePosition = 6
followPosition = 7
abnormal = false
interest = ["生活","游戏","影视","娱乐","二次元","音乐","科技","时尚","鬼畜","舞蹈"]
[feed.cmResource]
"iphone" = 1890
"android" = 1897
"ipad" = 1975
[feed.followMode]
title = "当前为首页推荐 - 关注模式(内测版)"
option = [
{title="通用模式",desc="开启后,推荐你可能感兴趣的内容",value=0},
{title="关注模式(内测版)",desc="开启后仅显示关注UP主更新的视频",value=1}
]
[feed.followMode.card]
title = "启用首页推荐 - 关注模式(内测版)"
desc = "我们根据你对bilibili推荐的反馈为你定制了关注模式。开启后仅为你显示关注UP主更新的视频哦。尝试体验一下"
button = ["暂不需要","立即开启"]
[showInfoc]
project = "app-feed"
name = "show"
proto = "tcp"
addr = "172.18.21.101:5403"
chanSize = 10240
[tagInfoc]
project = "app-feed"
name = "tag"
proto = "tcp"
addr = "172.18.21.101:5403"
chanSize = 10240
[redirectInfoc]
project = "app-feed"
name = "redirect"
proto = "tcp"
addr = "172.18.21.101:5403"
chanSize = 10240
[showInfoc2]
taskID = "000027"
proto = "tcp"
addr = "172.19.100.20:5401"
chanSize = 10240
[tagInfoc2]
taskID = "000028"
proto = "tcp"
addr = "172.19.100.20:5401"
chanSize = 10240
[redirectInfoc2]
taskID = "000029"
proto = "tcp"
addr = "172.19.100.20:5401"
chanSize = 10240
[host]
live = "http://live.bilibili.co"
liveApi = "http://api.live.bilibili.co"
bangumi = "http://bangumi.bilibili.co"
data = "http://data.bilibili.co"
hetongzi = "http://hetongzi.bilibili.co"
www = "http://www.bilibili.com"
apiCo = "http://api.bilibili.co"
api = "http://api.bilibili.com"
ad = "http://cm.bilibili.co"
activity = "http://matsuri.bilibili.co"
rank = ""
show = "http://show.bilibili.com"
dynamic = "http://api.vc.bilibili.com"
dynamicCo = "http://api.vc.bilibili.co"
bigData = "http://bigdata.bilibili.co"
search = "http://s.search.bilibili.co"
[xlog]
dir = "/data/log/app-feed"
[app]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
[httpClient]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
dial = "30ms"
timeout = "100ms"
keepAlive = "60s"
timer = 128
[httpClient.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[httpClientAsyn]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
dial = "1s"
timeout = "2s"
keepAlive = "60s"
timer = 10
[httpClientAsyn.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[httpData]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
dial = "30ms"
timeout = "200ms"
keepAlive = "60s"
timer = 1024
[httpData.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[httpTag]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
dial = "50ms"
timeout = "200ms"
keepAlive = "60s"
timer = 10
[httpTag.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[httpAd]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
dial = "50ms"
timeout = "100ms"
keepAlive = "60s"
timer = 128
[httpAd.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[httpActivity]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
dial = "50ms"
timeout = "150ms"
keepAlive = "60s"
timer = 128
[httpActivity.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[httpBangumi]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
dial = "50ms"
timeout = "150ms"
keepAlive = "60s"
timer = 128
[httpBangumi.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[httpDynamic]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
dial = "200ms"
timeout = "800ms"
keepAlive = "60s"
timer = 128
[httpDynamic.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[httpShow]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
dial = "50ms"
timeout = "150ms"
keepAlive = "60s"
timer = 128
[httpShow.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[httpSearch]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
dial = "50ms"
timeout = "150ms"
keepAlive = "60s"
timer = 128
[httpSearch.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[bm]
[bm.outer]
addr = "0.0.0.0:6221"
timeout = "1s"
[mysql]
[mysql.show]
addr = "172.18.33.49:3306"
dsn = "show:UJYgc9UkHIaGovEDUXpTU4U0rjBpZtwb@tcp(172.18.33.49:3306)/bilibili_show?timeout=1s&readTimeout=1s&writeTimeout=1s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 2
idle = 1
queryTimeout = "1s"
execTimeout = "1s"
tranTimeout = "1s"
[mysql.show.Breaker]
window = "1s"
sleep = "1s"
bucket = 10
ratio = 0.5
request = 100
[mysql.resource]
addr = "172.18.33.49:3306"
dsn = "resource:nMgVkY0JPgQr60nUVif5tEUbOTXlilXN@tcp(172.18.33.49:3306)/bilibili_resource?timeout=100ms&readTimeout=200ms&writeTimeout=200ms&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 2
idle = 1
queryTimeout = "1s"
execTimeout = "1s"
tranTimeout = "1s"
[mysql.resource.Breaker]
window = "1s"
sleep = "1s"
bucket = 10
ratio = 0.5
request = 100
[mysql.manager]
addr = "172.16.33.205:3308"
dsn = "test:test@tcp(172.16.33.205:3308)/bilibili_manager?timeout=100ms&readTimeout=200ms&writeTimeout=200ms&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 2
idle = 1
queryTimeout = "1s"
execTimeout = "1s"
tranTimeout = "1s"
[mysql.manager.Breaker]
window = "1s"
sleep = "1s"
bucket = 10
ratio = 0.5
request = 100
[redis]
[redis.feed]
name = "app-feed/feed"
proto = "unix"
addr = "/tmp/uat-app-redis.sock"
active = 5
idle = 1
dialTimeout = "30ms"
readTimeout = "80ms"
writeTimeout = "80ms"
idleTimeout = "80s"
expireRecommend = "1h"
expireBlack = "16h"
[redis.upper]
name = "app-feed/upper"
proto = "unix"
addr = "/tmp/uat-app-redis.sock"
active = 5
idle = 1
dialTimeout = "30ms"
readTimeout = "50ms"
writeTimeout = "50ms"
idleTimeout = "80s"
expireUpper = "96h"
[memcache]
[memcache.feed]
name = "app-feed/feed"
proto = "unix"
addr = "/tmp/uat-app-mc.sock"
active = 5
idle = 1
dialTimeout = "30ms"
readTimeout = "150ms"
writeTimeout = "150ms"
idleTimeout = "80s"
expireArchive = "24h"
expireCache = "480h"
[memcache.cache]
name = "app-feed/cache"
proto = "unix"
addr = "/tmp/uat-app-mc.sock"
active = 5
idle = 1
dialTimeout = "30ms"
readTimeout = "150ms"
writeTimeout = "150ms"
idleTimeout = "80s"
expireCache = "24h"
[dislikeDatabus]
key = "0QNB0ZgFozbKUCQhbTq8"
secret = "0QNB0ZgFozbKUCQhbTq9"
group= "TagDislike-SkyHorse-P"
topic= "Dislike-T"
action="pub"
name = "app-feed/dislike"
proto = "tcp"
addr = "172.18.33.50:6205"
active = 5
idle = 1
dialTimeout = "30ms"
readTimeout = "80ms"
writeTimeout = "80ms"
idleTimeout = "80s"
expire = "1h"
[bnj]
tabImg = "http://i1.hdslb.com/bfs/archive/e51ec36d654559de9d2d197f4d77ee60302fa754.png"
tabID = 10
[hbase]
master = ""
meta = ""
dialTimeout = "100ms"
readTimeout = "100ms"
readsTimeout = "200ms"
writeTimeout = "200ms"
writesTimeout = "200ms"
[hbase.zookeeper]
root = ""
addrs = ["172.18.33.131:2181", "172.18.33.168:2181", "172.18.33.169:2181"]
timeout = "30s"

View File

@@ -0,0 +1,50 @@
package main
import (
"flag"
"os"
"os/signal"
"syscall"
"go-common/app/interface/main/app-feed/conf"
"go-common/app/interface/main/app-feed/http"
ecode "go-common/library/ecode/tip"
"go-common/library/log"
"go-common/library/net/trace"
)
func main() {
flag.Parse()
if err := conf.Init(); err != nil {
log.Error("conf.Init() error(%v)", err)
panic(err)
}
// init log
log.Init(conf.Conf.XLog)
defer log.Close()
log.Info("app-feed start")
// init trace
trace.Init(conf.Conf.Tracer)
defer trace.Close()
// ecode init
ecode.Init(conf.Conf.Ecode)
// service init
http.Init(conf.Conf)
// init pprof conf.Conf.Perf
// init signal
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {
s := <-c
log.Info("app-feed get a signal %s", s.String())
switch s {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGSTOP, syscall.SIGINT:
log.Info("app-feed exit")
return
case syscall.SIGHUP:
// TODO reload
default:
return
}
}
}