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,47 @@
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",
"usersuit-service.toml",
],
importpath = "go-common/app/service/main/usersuit/cmd",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/usersuit/conf:go_default_library",
"//app/service/main/usersuit/http:go_default_library",
"//app/service/main/usersuit/rpc/server:go_default_library",
"//app/service/main/usersuit/service: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,126 @@
# This is a TOML document. Boom.
version = "1.0.0"
user = "nobody"
dir = "./"
family = "usersuit-service"
env = "qa"
vipURI = "http://vip.bilibili.co"
payURL = "http://pay.bilibili.com/api/add.pay.order"
notifyURL = "http://account.bilibili.co/api/communicate/purge_cache"
accountIntranetURI = "http://account.bilibili.co"
[host]
accountURI = "https://account.bilibili.com"
messageCo = "http://message.bilibili.co"
[xlog]
dir = "/data/log/usersuit-service"
[payinfo]
MerchantID="1"
MerchantProductID="1"
CallBackURL="http://account.bilibili.com/api/pendant/orderpendantcallback"
[bm]
addr = "0.0.0.0:7261"
maxListen = 1000
timeout = "1s"
[rpcServer]
proto = "tcp"
addr = "0.0.0.0:7269"
[gorpcclient]
[member]
timeout = "1s"
[coin]
timeout = "30s"
[point]
timeout = "30s"
[mysql]
addr = "172.16.33.205:3309"
dsn = "usersuit:cDXL6vncmCQanx4iMgGogu6gYz33NmA1@tcp(172.16.33.205:3309)/usersuit?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 100
idle = 10
queryTimeout = "2s"
execTimeout = "10s"
tranTimeout = "5s"
[mysql.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[redis]
name = "usersuit-service"
proto = "tcp"
addr = "172.18.33.61:6888"
idle = 10
active = 10
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
inviteExpire = "30s"
pendantExpire = "24h"
[memcache]
name = "usersuit-service"
proto = "tcp"
addr = "172.18.33.60:11214"
idle = 10
active = 10
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
medalexpire = "720h"
pointexpire = "168h"
[MedalCache]
size = 10000
expire = "3s"
[EquipCache]
size = 10000
expire = "3s"
[httpClient]
key = "837f620f5c0a8010"
secret = "2a9057021014b4b843b635664c69d5df"
dial = "500ms"
timeout = "1s"
keepAlive = "60s"
timer = 10
[httpClient.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[accountNotify]
key = "4ba46ba31f9a44ef"
secret = "e4c5a7fce28695209e6b4f0af8cf91c5"
group = "AccountNotify-MainAccount-P"
topic = "AccountNotify-T"
action = "pub"
offset = "old"
buffer = 128
name = "usersuit-service/databus"
proto = "tcp"
addr = "172.18.33.50:6205"
active = 1
idle = 1
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"

View File

@@ -0,0 +1,52 @@
package main
import (
"flag"
"os"
"os/signal"
"syscall"
"time"
"go-common/app/service/main/usersuit/conf"
"go-common/app/service/main/usersuit/http"
rpc "go-common/app/service/main/usersuit/rpc/server"
"go-common/app/service/main/usersuit/service"
"go-common/library/log"
"go-common/library/net/trace"
)
func main() {
flag.Parse()
// init conf,log,trace,stat,perf.
if err := conf.Init(); err != nil {
panic(err)
}
log.Init(conf.Conf.Xlog)
defer log.Close()
trace.Init(conf.Conf.Tracer)
defer trace.Close()
// service init
svr := service.New(conf.Conf)
rpcSvr := rpc.New(conf.Conf, svr)
http.Init(conf.Conf, svr)
// signal handler
log.Info("usersuit-service start")
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {
s := <-c
log.Info("usersuit-service get a signal %s", s.String())
switch s {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
rpcSvr.Close()
time.Sleep(time.Second * 2)
svr.Close()
log.Info("usersuit-service exit")
return
case syscall.SIGHUP:
// TODO reload
default:
return
}
}
}

View File

@@ -0,0 +1,129 @@
# This is a TOML document. Boom.
version = "1.0.0"
user = "nobody"
dir = "./"
family = "usersuit-service"
env = "qa"
accountIntranetURI = "http://account.bilibili.co"
accountURI = "https://account.bilibili.com"
vipURI = "http://vip.bilibili.co"
payURL = "http://pay.bilibili.com/api/add.pay.order"
NotifyURL = "http://account.bilibili.co/api/communicate/purge_cache"
[xlog]
dir = "/data/log/usersuit-service"
[payinfo]
MerchantID="1"
MerchantProductID="1"
CallBackURL="http://account.bilibili.com/api/pendant/orderpendantcallback"
[bm]
addr = "0.0.0.0:7261"
maxListen = 1000
timeout = "1s"
[rpcServer]
proto = "tcp"
addr = "0.0.0.0:7269"
[gorpcclient]
[member]
timeout = "1s"
[coin]
timeout = "30s"
[point]
timeout = "30s"
[mysql]
addr = "172.16.33.205:3309"
dsn = "usersuit:cDXL6vncmCQanx4iMgGogu6gYz33NmA1@tcp(172.16.33.205:3309)/usersuit?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 100
idle = 10
queryTimeout = "2s"
execTimeout = "10s"
tranTimeout = "5s"
[mysql.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[redis]
name = "usersuit-service"
proto = "tcp"
addr = "172.16.33.54:6379"
idle = 10
active = 10
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
inviteExpire = "30s"
pendantExpire = "24h"
[memcache]
name = "usersuit-service"
proto = "tcp"
# addr = "172.16.33.54:6379"
addr = "127.0.0.1:11211"
idle = 10
active = 10
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
medalexpire = "720h"
pointexpire = "168h"
[MedalCache]
size = 10000
expire = "3s"
[EquipCache]
size = 10000
expire = "3s"
[httpClient]
key = "837f620f5c0a8010"
secret = "2a9057021014b4b843b635664c69d5df"
dial = "500ms"
timeout = "1s"
keepAlive = "60s"
timer = 10
[httpClient.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[accountNotify]
key = "4ba46ba31f9a44ef"
secret = "99985eb4451cfb1b899ca0fbe3c4bdc8"
group = "AccountNotify-MainAccount-P"
topic = "AccountNotify-T"
action = "pub"
buffer = 128
name = "usersuit-admin/databus"
proto = "tcp"
addr = "172.16.33.158:6205"
active = 1
idle = 1
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
[host]
messageCo = "http://message.bilibili.co"
accountCoURI = "http://account.bilibili.co"
apiCoURI = "http://api.bilibili.co"
liveAPICo = "http://api.live.bilibili.co"