Create & Init Project...
This commit is contained in:
46
app/interface/main/feedback/cmd/BUILD
Normal file
46
app/interface/main/feedback/cmd/BUILD
Normal file
@ -0,0 +1,46 @@
|
||||
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 = [
|
||||
"convey-test.toml",
|
||||
"feedback-test.toml",
|
||||
],
|
||||
importpath = "go-common/app/interface/main/feedback/cmd",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//app/interface/main/feedback/conf:go_default_library",
|
||||
"//app/interface/main/feedback/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"],
|
||||
)
|
144
app/interface/main/feedback/cmd/convey-test.toml
Normal file
144
app/interface/main/feedback/cmd/convey-test.toml
Normal file
@ -0,0 +1,144 @@
|
||||
# This is a TOML document. Boom.
|
||||
|
||||
version = "1.0.0"
|
||||
user = "nobody"
|
||||
pid = "/tmp/feedback.pid"
|
||||
dir = "./"
|
||||
perf = "0.0.0.0:6170"
|
||||
checkFile = "/data/www/feedback.html"
|
||||
family = "feedback"
|
||||
trace = true
|
||||
debug = false
|
||||
|
||||
env = "test"
|
||||
|
||||
[tracer]
|
||||
family = "feedback"
|
||||
proto = "unixgram"
|
||||
addr = "172.16.33.46:5140"
|
||||
|
||||
[xlog]
|
||||
dir = "/data/log/feedback/"
|
||||
[xlog.agent]
|
||||
family = "feedback"
|
||||
taskID ="000069"
|
||||
proto = "unixgram"
|
||||
addr = "/var/run/lancer/collector.sock"
|
||||
chan = 10240
|
||||
timeout = "500ms"
|
||||
|
||||
[app]
|
||||
key = "e7482d29be4a95b8"
|
||||
secret = "9e803791cdef756e75faee68e12b7442"
|
||||
|
||||
[multiHttp]
|
||||
[multiHttp.outer]
|
||||
addrs = ["0.0.0.0:6171"]
|
||||
maxListen = 1000
|
||||
[multiHttp.local]
|
||||
addrs = ["0.0.0.0:6172"]
|
||||
maxListen = 1000
|
||||
|
||||
[ecode]
|
||||
domain = "172.16.33.248:6401"
|
||||
all = "1h"
|
||||
diff = "10m"
|
||||
[ecode.clientconfig]
|
||||
key = "test"
|
||||
secret = "e6c4c252dc7e3d8a90805eecd7c73396"
|
||||
dial = "2s"
|
||||
timeout = "2s"
|
||||
keepAlive = "10s"
|
||||
[ecode.clientconfig.breaker]
|
||||
window ="3s"
|
||||
sleep ="100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
[ecode.app]
|
||||
key = "test"
|
||||
secret = "e6c4c252dc7e3d8a90805eecd7c73396"
|
||||
|
||||
[mysql]
|
||||
[mysql.master]
|
||||
addr = "172.16.33.205:3308"
|
||||
dsn = "test:test@tcp(172.16.33.205:3308)/bilibili_feedback?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8mb4,utf8"
|
||||
active = 5
|
||||
idle = 2
|
||||
idleTimeout ="4h"
|
||||
queryTimeout = "100ms"
|
||||
execTimeout = "100ms"
|
||||
tranTimeout = "200ms"
|
||||
[mysql.master.breaker]
|
||||
window = "3s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
|
||||
[identify]
|
||||
whiteAccessKey = ""
|
||||
whiteMid = 0
|
||||
[identify.app]
|
||||
key = "0dc647722719f2ea"
|
||||
secret = "a3769b553680da10b40994265fb48d20"
|
||||
[identify.memcache]
|
||||
name = "go-business/identify"
|
||||
proto = "tcp"
|
||||
addr = "172.16.33.54:11211"
|
||||
active = 5
|
||||
idle = 10
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "80s"
|
||||
[identify.host]
|
||||
auth = "http://passport.bilibili.com"
|
||||
secret = "http://open.bilibili.com"
|
||||
[identify.httpClient]
|
||||
key = "0dc647722719f2ea"
|
||||
secret = "a3769b553680da10b40994265fb48d20"
|
||||
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 = "100ms"}
|
||||
"http://passport.bilibili.co/intranet/auth/cookieInfo" = {timeout = "100ms"}
|
||||
"http://open.bilibili.co/api/getsecret" = {timeout = "500ms"}
|
||||
|
||||
[bfs]
|
||||
addr = "http://bfs.bilibili.co"
|
||||
bucket = "test"
|
||||
key = "221bce6492eba70f"
|
||||
secret = "6eb80603e85842542f9736eb13b7e3"
|
||||
# 上传文件大小限制为1M
|
||||
maxFileSize = 1048576
|
||||
|
||||
[feedback]
|
||||
# replys page size
|
||||
replysNum = 50
|
||||
# 发送内容长度限制为400字符
|
||||
maxContentSize = 400
|
||||
|
||||
[locationRPC]
|
||||
pullInterval = "10s"
|
||||
[locationRPC.client]
|
||||
timeout = "1s"
|
||||
timer = 10
|
||||
[locationRPC.client.breaker]
|
||||
window ="3s"
|
||||
sleep ="100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
[locationRPC.zookeeper]
|
||||
root = "/microservice/location-service/"
|
||||
addrs = ["172.18.33.172:2181"]
|
||||
timeout = "30s"
|
||||
|
48
app/interface/main/feedback/cmd/feedback-test.toml
Normal file
48
app/interface/main/feedback/cmd/feedback-test.toml
Normal file
@ -0,0 +1,48 @@
|
||||
env = "test"
|
||||
|
||||
[xlog]
|
||||
dir = "/data/log/feedback/"
|
||||
|
||||
[app]
|
||||
key = "e7482d29be4a95b8"
|
||||
secret = "9e803791cdef756e75faee68e12b7442"
|
||||
|
||||
[bm]
|
||||
[bm.outer]
|
||||
addr = "0.0.0.0:6171"
|
||||
timeout = "1s"
|
||||
[bm.local]
|
||||
addr = "0.0.0.0:6172"
|
||||
timeout = "1s"
|
||||
|
||||
[mysql]
|
||||
[mysql.master]
|
||||
addr = "172.16.33.205:3308"
|
||||
dsn = "test:test@tcp(172.16.33.205:3308)/bilibili_feedback?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8mb4,utf8"
|
||||
active = 5
|
||||
idle = 2
|
||||
idleTimeout ="4h"
|
||||
queryTimeout = "100ms"
|
||||
execTimeout = "100ms"
|
||||
tranTimeout = "200ms"
|
||||
[mysql.master.breaker]
|
||||
window = "3s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
|
||||
[bfs]
|
||||
addr = "http://bfs.bilibili.co"
|
||||
bucket = "test"
|
||||
key = "221bce6492eba70f"
|
||||
secret = "6eb80603e85842542f9736eb13b7e3"
|
||||
# 上传文件大小限制为1M
|
||||
maxFileSize = 1048576
|
||||
|
||||
[feedback]
|
||||
# replys page size
|
||||
replysNum = 50
|
||||
# 发送内容长度限制为400字符
|
||||
maxContentSize = 400
|
||||
imgLimit = 4
|
50
app/interface/main/feedback/cmd/main.go
Normal file
50
app/interface/main/feedback/cmd/main.go
Normal file
@ -0,0 +1,50 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"go-common/app/interface/main/feedback/conf"
|
||||
"go-common/app/interface/main/feedback/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("feedback 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("feedback get a signal %s", s.String())
|
||||
switch s {
|
||||
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
|
||||
log.Info("feedback exit")
|
||||
return
|
||||
case syscall.SIGHUP:
|
||||
// TODO reload
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user