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,44 @@
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 = ["admin.toml"],
importpath = "go-common/app/admin/ep/marthe/cmd",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/admin/ep/marthe/conf:go_default_library",
"//app/admin/ep/marthe/server/http:go_default_library",
"//app/admin/ep/marthe/service: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,130 @@
[bm]
addr = "0.0.0.0:9001"
timeout = "10s"
[httpClient]
key = "c05dd4e1638a8af0"
secret = "7daa7f8c06cd33c5c3067063c746fdcb"
dial = "2s"
timeout = "100s"
keepAlive = "60s"
timer = 1000
[httpClient.breaker]
window = "10s"
sleep = "2000ms"
bucket = 10
ratio = 0.5
request = 100
[mail]
host = "smtp.exmail.qq.com"
port = 465
username = "merlin@bilibili.com"
password = ""
noticeOwner = ["fengyifeng@bilibili.com"]
[memcache]
name = "merlin"
proto = "tcp"
addr = "172.18.33.61:11232"
idle = 5
active = 10
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
expire = "12h"
[bugly]
#bugly URL
host = "https://bugly.qq.com"
#bugly请求尝试次数
urlRetryCount = 3
#cookie 使用上限次数
cookieUsageUpper = 300
#bugly 每页获取issue个数
issuePageSize = 50
#bugly 抓取issue上限个数
issueCountUpper = 100
#bugly 超级管理员
superOwner = ["fengyifeng","yuanmin"]
[tapd]
#tapd bug相关操作 是否认证tapd权限
bugOperateAuth = false
[Scheduler]
#每过30分钟 跑enable version 抓bugly数据
batchRunEnableVersion = "0 */30 * * * ?"
#每天晚上23点 定时更新tapd bug
batchRunUpdateTapdBug = "0 0 23 * * ?"
#每10分钟定时删除超过三小时为执行完毕的任务
disableBatchRunOverTime = "0 */10 * * * ?"
#过期时限
batchRunOverHourTime = 3
#每天晚上22点更新同步wechat contact
syncWechatContact = "0 0 22 * * ?"
#是否开启定时任务
active = false
[orm]
dsn = "root:123456@tcp(172.18.33.130:3306)/Marthe2?timeout=200ms&readTimeout=2000ms&writeTimeout=2000ms&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 5
idle = 5
idleTimeout = "4h"
[auth]
managerHost = "http://uat-manager.bilibili.co"
dashboardHost = "http://dashboard-mng.bilibili.co"
dashboardCaller = "marthe"
[auth.DsHTTPClient]
key = "marthe"
secret = "4344bea3587b383bc0b9de5de0efcc3f"
dial = "1s"
timeout = "1s"
keepAlive = "60s"
[auth.DsHTTPClient.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[auth.MaHTTPClient]
key = "f6433799dbd88751"
secret = "36f8ddb1806207fe07013ab6a77a3935"
dial = "1ms"
timeout = "1ms"
keepAlive = "60s"
[auth.MaHTTPClient.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[auth.session]
sessionIDLength = 32
cookieLifeTime = 1
cookieName = "mng-go"
domain = ".bilibili.co"
[auth.session.Memcache]
name = "go-business/auth"
proto = "tcp"
addr = "172.18.33.61:11232"
active = 10
idle = 10
dialTimeout = "1ms"
readTimeout = "1ms"
writeTimeout = "1ms"
idleTimeout = "80s"

View File

@@ -0,0 +1,106 @@
[bm]
addr = "0.0.0.0:9001"
timeout = "10s"
[httpClient]
key = "c05dd4e1638a8af0"
secret = "7daa7f8c06cd33c5c3067063c746fdcb"
dial = "2s"
timeout = "100s"
keepAlive = "60s"
timer = 1000
[httpClient.breaker]
window = "10s"
sleep = "2000ms"
bucket = 10
ratio = 0.5
request = 100
[mail]
host = "smtp.exmail.qq.com"
port = 465
username = "merlin@bilibili.com"
password = ""
noticeOwner = ["fengyifeng@bilibili.com"]
[memcache]
name = "merlin"
proto = "tcp"
addr = "172.18.33.61:11232"
idle = 5
active = 10
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
expire = "12h"
[bugly]
host = "https://bugly.qq.com"
urlRetryCount = 3
cookieUsageUpper = 300
issuePageSize = 50
issueCountUpper = 100
[Scheduler]
#每过10分钟 更新表
batchRunEnableVersion = "0 */10 * * * ?"
batchRunUpdateTapdBug = "0 */10 * * * ?"
disableBatchRunOverTime = "0 */10 * * * ?"
batchRunOverHourTime = 3
active = false
[orm]
dsn = "root:123456@tcp(172.18.33.130:3306)/Marthe2?timeout=200ms&readTimeout=2000ms&writeTimeout=2000ms&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 5
idle = 5
idleTimeout = "4h"
[auth]
managerHost = "http://uat-manager.bilibili.co"
dashboardHost = "http://dashboard-mng.bilibili.co"
dashboardCaller = "merlin"
[auth.DsHTTPClient]
key = "merlin"
secret = "4fb521f66dfd5efcf6e77d078ed2eb0a"
dial = "1s"
timeout = "1s"
keepAlive = "60s"
[auth.DsHTTPClient.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[auth.MaHTTPClient]
key = "f6433799dbd88751"
secret = "36f8ddb1806207fe07013ab6a77a3935"
dial = "1ms"
timeout = "1ms"
keepAlive = "60s"
[auth.MaHTTPClient.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[auth.session]
sessionIDLength = 32
cookieLifeTime = 1
cookieName = "mng-go"
domain = ".bilibili.co"
[auth.session.Memcache]
name = "go-business/auth"
proto = "tcp"
addr = "172.18.33.61:11232"
active = 10
idle = 10
dialTimeout = "1ms"
readTimeout = "1ms"
writeTimeout = "1ms"
idleTimeout = "80s"

View File

@@ -0,0 +1,46 @@
package main
import (
"flag"
"os"
"os/signal"
"syscall"
"go-common/app/admin/ep/marthe/conf"
"go-common/app/admin/ep/marthe/server/http"
"go-common/app/admin/ep/marthe/service"
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 {
panic(err)
}
log.Init(conf.Conf.Log)
defer log.Close()
log.Info("start")
defer trace.Close()
ecode.Init(conf.Conf.Ecode)
s := service.New(conf.Conf)
http.Init(conf.Conf, s)
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {
si := <-c
log.Info("get a signal %s", si.String())
switch si {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
log.Info("exit")
s.Close()
return
case syscall.SIGHUP:
default:
return
}
}
}