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,45 @@
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 = ["reply-admin-test.toml"],
importpath = "go-common/app/admin/main/reply/cmd",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/admin/main/reply/conf:go_default_library",
"//app/admin/main/reply/http:go_default_library",
"//library/ecode/tip:go_default_library",
"//library/exp/feature:go_default_library",
"//library/log:go_default_library",
"//library/net/trace:go_default_library",
"//library/queue/databus/report: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,51 @@
package main
import (
"flag"
"os"
"os/signal"
"syscall"
"go-common/app/admin/main/reply/conf"
"go-common/app/admin/main/reply/http"
ecode "go-common/library/ecode/tip"
"go-common/library/exp/feature"
"go-common/library/log"
"go-common/library/net/trace"
"go-common/library/queue/databus/report"
)
func main() {
feature.DefaultGate.AddFlag(flag.CommandLine)
flag.Parse()
// init conf,log,trace,stat,perf
if err := conf.Init(); err != nil {
panic(err)
}
log.Init(conf.Conf.Log)
defer log.Close()
trace.Init(conf.Conf.Tracer)
defer trace.Close()
ecode.Init(conf.Conf.Ecode)
report.InitManager(conf.Conf.ManagerReport)
// service init
http.Init(conf.Conf)
// perf init
log.Info("reply-admin start")
// signal handler
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {
s := <-c
log.Info("reply-admin get a signal %s", s.String())
switch s {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
log.Info("reply-admin exit")
return
case syscall.SIGHUP:
// TODO reload
default:
return
}
}
}

View File

@@ -0,0 +1,270 @@
[log]
stdout=true
[httpServer]
addr = "0.0.0.0:10001"
timeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
[reply]
pageNum = 1
pageSize = 30
adminName = ["yangjiankun", "xuyiming"]
[identify]
whiteAccessKey = "a2a1eb0ac97d6ba08b85aa0151528f34"
whiteMid = 23675773
csrfOn = true
csrf = true
[identify.app]
key = "7c7ac0db1aa05587"
secret = "9a6d62d93290c5f771ad381e9ca23f26"
[identify.memcache]
name = "go-business/identify"
active = 1024
idle = 64
dialTimeout = "100ms"
readTimeout = "200ms"
writeTimeout = "200ms"
idleTimeout = "80s"
[identify.host]
auth = "http://passport.bilibili.co"
secret = "http://open.bilibili.co"
[identify.httpClient]
key = "7c7ac0db1aa05587"
secret = "9a6d62d93290c5f771ad381e9ca23f26"
dial = "30ms"
timeout = "100ms"
keepAlive = "60s"
[identify.httpClient.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[identify.httpClient.url]
"http://passport.bilibili.co/intranet/auth/tokenInfo" = {timeout = "1s"}
"http://passport.bilibili.co/intranet/auth/cookieInfo" = {timeout = "1s"}
"http://open.bilibili.co/api/getsecret" = {timeout = "1s"}
[db]
[db.reply]
addr = "172.22.34.101:3306"
dsn = "test_3306:UJPZaGKjpb2ylFx3HNhmLuwOYft4MCAi@tcp(172.22.34.101:3306)/bilibili_reply?timeout=1s&readTimeout=1s&writeTimeout=1s&parseTime=true&loc=Local&charset=utf8mb4,utf8"
active = 5
idle = 1
idleTimeout ="4h"
queryTimeout = "500ms"
execTimeout = "500ms"
tranTimeout = "500ms"
[db.reply.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[db.replySlave]
addr = "172.22.34.101:3306"
dsn = "test_3306:UJPZaGKjpb2ylFx3HNhmLuwOYft4MCAi@tcp(172.22.34.101:3306)/bilibili_reply?timeout=1s&readTimeout=1s&writeTimeout=1s&parseTime=true&loc=Local&charset=utf8mb4,utf8"
active = 5
idle = 1
idleTimeout ="4h"
queryTimeout = "500ms"
execTimeout = "500ms"
tranTimeout = "500ms"
[db.replySlave.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[httpClient]
key = "c1a1cb2d89c33794"
secret = "dda47eeca111e03e6845017505baea13"
dial = "3s"
timeout = "3s"
keepAlive = "60s"
timer = 1000
[httpClient.breaker]
window ="3s"
sleep ="100ms"
bucket = 10
ratio = 0.5
request = 100
[[stats]]
key = "0QNB0ZgFozbKUCQhbTq8"
secret = "0QNB0ZgFozbKUCQhbTq9"
group = "Stat-UGC-P"
topic = "Stat-T"
action ="pub"
name = "archive-service/stat"
proto = "tcp"
addr = "172.18.33.50:6205"
idle = 100
active = 100
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
type = 1
field = "aid"
[[stats]]
key = "0QNB0ZgFozbKUCQhbTq8"
secret = "0QNB0ZgFozbKUCQhbTq9"
group = "ArticleStat-Article-P"
topic = "ArticleStat-T"
action ="pub"
name = "archive-service/stat"
proto = "tcp"
addr = "172.18.33.50:6205"
idle = 100
active = 100
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
type = 12
field = "aid"
[[stats]]
key = "0QNB0ZgFozbKUCQhbTq8"
secret = "0QNB0ZgFozbKUCQhbTq9"
group= "PlaylistStat-Playlist-P"
topic= "PlaylistStat-T"
action="pub"
name = "playlist-service/stat"
proto = "tcp"
addr = "172.18.33.50:6205"
idle = 100
active = 100
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
expire = "1h"
type = 18
field = "pid"
[rpcClient2]
[rpcClient2.account]
timeout = "30s"
[rpcClient2.archive]
timeout = "30s"
[rpcClient2.assist]
timeout = "30s"
[rpcClient2.article]
timeout = "30s"
[rpcClient2.thumbup]
timeout = "30s"
[databus]
[databus.event]
key = "170e302355453683"
secret = "3d0e8db7bed0503949e545a469789279"
group = "Reply-MainCommunity-P"
topic = "Reply-T"
action ="pub"
name = "reply/event"
proto = "tcp"
addr = "172.18.33.50:6205"
idle = 2
active = 5
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
expire = "1h"
[databus.stats]
key = "170e302355453683"
secret = "3d0e8db7bed0503949e545a469789279"
group = "StatReply-MainCommunity-P"
topic = "StatReply-T"
action ="pub"
name = "reply/stats"
proto = "tcp"
addr = "172.18.33.50:6205"
idle = 2
active = 5
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
expire = "1h"
[host]
search = "http://uat-bili-search.bilibili.co"
[managerAuth]
managerHost = "http://uat-manager.bilibili.co"
dashboardHost = "http://dashboard-mng.bilibili.co"
dashboardCaller = "manager-go"
[managerAuth.dsHTTPClient]
key = "manager-go"
secret = "949bbb2dd3178252638c2407578bc7ad"
dial = "1s"
timeout = "3s"
keepAlive = "60s"
timer = 1000
[managerAuth.dsHTTPClient.breaker]
window ="3s"
sleep ="100ms"
bucket = 10
ratio = 0.5
request = 100
[managerAuth.maHTTPClient]
key = "f6433799dbd88751"
secret = "36f8ddb1806207fe07013ab6a77a3935"
dial = "1s"
timeout = "3s"
keepAlive = "60s"
timer = 1000
[managerAuth.maHTTPClient.breaker]
window ="3s"
sleep ="100ms"
bucket = 10
ratio = 0.5
request = 100
[managerAuth.session]
sessionIDLength = 32
cookieLifeTime = 1800
cookieName = "mng-go"
domain = ".bilibili.co"
[managerAuth.session.Memcache]
name = "bm/auth"
proto = "unix"
addr = "/tmp/uat-reply-mc.sock"
active = 5
idle = 2
dialTimeout = "10ms"
readTimeout = "200ms"
writeTimeout = "200ms"
idleTimeout = "80s"
[memcache]
proto = "tcp"
addr = "172.18.33.61:11213"
idle = 10
active = 10
dialTimeout = "2s"
readTimeout = "2s"
writeTimeout = "2s"
idleTimeout = "7h"
expire = "24h"
[redis]
proto = "tcp"
addr = "172.18.33.60:6889"
idle = 10
active = 10
dialTimeout = "500ms"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "80s"
indexExpire = "8h"
userActExpire="1h"
reportExpire = "24h"
userCntExpire = "30s"
notifyExpire = "24h"
expire = "24h"