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,40 @@
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 = ["live-wallet-test.toml"],
importpath = "go-common/app/job/live/wallet/cmd",
tags = ["automanaged"],
deps = [
"//app/job/live/wallet/conf:go_default_library",
"//app/job/live/wallet/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,59 @@
# This is a TOML document. Boom
version = "1.0.0"
user = "root"
pid = "/tmp/live-wallet-job.pid"
dir = "./"
family = "/live-wallet"
perf = "0.0.0.0:20202"
address = ""
env = "dev"
[log]
dir = "/data/log/live-wallet-job"
[db]
[db.wallet]
addr = "172.16.33.69:3306"
dsn = "live:oWni@ElNs0P0C(dphdj*F1y4@tcp(172.16.33.69:3306)/live_wallet?timeout=5s&readTimeout=30s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 5
idle = 5
queryTimeout = "1s"
execTimeout = "1s"
tranTimeout = "2s"
[db.wallet.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[memcache]
walletExpire = "3s"
[memcache.wallet]
name = "live-wallet-service/wallet"
proto = "tcp"
addr = "172.16.33.251:11211"
idle = 5
active = 10
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "80s"
[userSub]
key = "ec4c0820d525d67b"
secret = "2bdf3bd4ecab041b5d5640a1da4f7f81"
group = "LiveUserBinlog-LiveLive-S"
topic = "LiveUserBinlog-T"
action = "sub"
offset = "new"
name = "liveuser-wallet/user-sub"
proto = "tcp"
addr = "172.16.33.154:6205"
idle = 100
active = 100
dialTimeout = "1s"
readTimeout = "60s"
writeTimeout = "1s"
idleTimeout = "10s"

View File

@@ -0,0 +1,43 @@
package main
import (
"flag"
"os"
"os/signal"
"syscall"
"go-common/app/job/live/wallet/conf"
"go-common/app/job/live/wallet/service"
"go-common/library/log"
)
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.Log)
defer log.Close()
log.Info("/live-wallet start")
// service init
srv := Service.New(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("/live-wallet get a signal %s", s.String())
switch s {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
log.Info("/live-wallet exit")
srv.Close()
return
case syscall.SIGHUP:
default:
return
}
}
}