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,41 @@
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 = ["coin-job-test.toml"],
importpath = "go-common/app/job/main/coin/cmd",
tags = ["automanaged"],
deps = [
"//app/job/main/coin/conf:go_default_library",
"//app/job/main/coin/http:go_default_library",
"//app/job/main/coin/service:go_default_library",
"//library/log: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,167 @@
version = "0.1.0"
perf = "127.0.0.1:6078"
name = "127.0.0.1"
[xlog]
dir = "/data/log/coin-job/"
[bm]
addr = "0.0.0.0:6158"
timeout = "1s"
[databus]
key = "0Pub71WwEMKXu63qtztu"
secret = "0Pub71WwEMKXu63qtztv"
group = "CoinJob-UGC-S"
topic = "CoinJob-T"
action = "sub"
name = "coin-job/databus"
proto = "tcp"
addr = "172.16.33.158:6205"
idle = 100
active = 100
dialTimeout = "1s"
readTimeout = "60s"
writeTimeout = "1s"
idleTimeout = "10s"
[logindatabus]
key = "0QHEzXlXE9Ijewj8V4zu"
secret = "0QHEzXlXE9Ijewj8V4zv"
group = "PassportLog-T-Coin-S"
topic = "LogUserAction-T"
action = "sub"
offset = "new"
buffer = 2048
name = "secure-service/databus"
proto = "tcp"
addr = "172.16.33.158:6205"
idle = 100
active = 100
dialTimeout = "1s"
readTimeout = "60s"
writeTimeout = "1s"
idleTimeout = "10s"
[expDatabus]
key = "4ba46ba31f9a44ef"
secret = "99985eb4451cfb1b899ca0fbe3c4bdc8"
group = "AccountExp-MainAccount-Coin-S"
topic = "AccountExp-T"
action = "sub"
buffer = 2048
name = "coin-job/databus"
proto = "tcp"
addr = "172.16.33.158:6205"
idle = 100
active = 100
dialTimeout = "1s"
readTimeout = "60s"
writeTimeout = "1s"
idleTimeout = "10s"
[databusutil]
size = 100
chan = 1024
num = 4
ticker="30s"
[archiveRPC]
pullInterval = "10s"
group = "group2"
[archiveRPC.client]
timeout = "1s"
timer = 1000
[archiveRPC.client.breaker]
window ="3s"
sleep ="100ms"
bucket = 10
ratio = 0.5
request = 100
[archiveRPC.zookeeper]
root = "/microservice/archive-service/"
addrs = ["172.16.33.54:2181"]
timeout = "1s"
[coinRPC]
pullInterval = "10s"
group = "group2"
[coinRPC.client]
timeout = "1s"
timer = 1000
[coinRPC.client.breaker]
window ="3s"
sleep ="100ms"
bucket = 10
ratio = 0.5
request = 100
[coinRPC.zookeeper]
root = "/microservice/coin-service/"
addrs = ["172.16.33.54:2181"]
timeout = "1s"
[accountRPC]
timeout = "1s"
[memRPC]
timeout = "300ms"
[redis]
name = "coin-service/coin"
proto = "tcp"
addr = "172.16.0.204:6379"
idle = 100
active = 100
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
expire = "1h"
[db]
[db.coin]
addr = "172.16.33.205:3308"
dsn = "test:test@tcp(172.16.33.205:3308)/bilibili_coin?timeout=5s&readTimeout=30s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
#addr = "127.0.0.1:3306"
#dsn = "root@tcp(127.0.0.1:3306)/bilibili_coins?timeout=5s&readTimeout=30s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 5
idle = 5
queryTimeout = "1s"
execTimeout = "1s"
tranTimeout = "2s"
[db.coin.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[db.dede]
addr = "172.16.33.101:3306"
dsn = "account:wx2U1MwXRyWEuURw@tcp(172.16.33.101:3306)/account?timeout=5s&readTimeout=30s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 5
idle = 5
queryTimeout = "2s"
execTimeout = "1s"
tranTimeout = "2s"
[db.dede.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[memcache]
name = "member-service"
proto = "tcp"
addr = "172.16.33.22:21211"
idle = 5
active = 10
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
expire = "24h"
[coinJob]
start=false
loginExpire = "72h"

View File

@@ -0,0 +1,49 @@
package main
import (
"flag"
"os"
"os/signal"
"syscall"
"go-common/app/job/main/coin/conf"
"go-common/app/job/main/coin/http"
"go-common/app/job/main/coin/service"
"go-common/library/log"
)
var (
s *service.Service
)
func main() {
flag.Parse()
if err := conf.Init(); err != nil {
log.Error("conf.Init() error(%v)", err)
panic(err)
}
log.Init(conf.Conf.Xlog)
defer log.Close()
log.Info("archive-service_consumer start")
s = service.New(conf.Conf)
http.Init(conf.Conf, s)
signalHandler()
}
func signalHandler() {
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {
si := <-ch
switch si {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
log.Info("get a signal %s, stop the consume process", si.String())
s.Close()
s.Wait()
return
case syscall.SIGHUP:
default:
return
}
}
}