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 = ["click-job-test.toml"],
importpath = "go-common/app/job/main/click/cmd",
tags = ["automanaged"],
deps = [
"//app/job/main/click/conf:go_default_library",
"//app/job/main/click/http:go_default_library",
"//app/job/main/click/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,142 @@
version = "1.0.0"
user = "nobody"
pid = "/tmp/click-job.pid"
dir = "./"
perf = "127.0.0.1:6440"
trace = false
debug = false
env = "uat"
chanNum = 50
hashNum = 500000
consumeNum = 10
needInit = false
lastChangeTime = 75
releaseTime = 600
[cacheConf]
ArcUpCacheTime = 600
PGCReplayTime = 1800
newAnonymousCacheTime = 60
NewAnonymousBvCacheTime = 300
[xlog]
dir = "/data/log/click-job/"
[infoc2]
taskID = "000025"
proto = "tcp"
addr = "172.16.113.149:15140"
chanSize = 10240
[multiHTTP]
[multiHTTP.inner]
addrs = ["0.0.0.0:6441"]
[multiHTTP.local]
addrs = ["0.0.0.0:6442"]
[db]
addr = "172.22.34.101:3306"
dsn = "test:test@tcp(172.16.33.205:3308)/archive_click?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8"
active = 100
idle = 50
idleTimeout ="4h"
queryTimeout = "300ms"
execTimeout = "300ms"
tranTimeout = "500ms"
[db.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[redis]
name = "click-job/redis"
proto = "unix"
addr = "/tmp/uat-archive-service-redis.sock"
active = 10
idle = 1
dialTimeout = "1s"
readTimeout = "2s"
writeTimeout = "2s"
idleTimeout = "80s"
[statPub]
key = "0QNB0ZgFozbKUCQhbTq8"
secret = "0QNB0ZgFozbKUCQhbTq9"
group = "Stat-UGC-P"
topic = "Stat-T"
action = "pub"
name = "stat-pub/stat-pub"
proto = "tcp"
addr = "172.18.33.50:6205"
active = 5
idle = 1
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
[StatViewPub]
key = "8e27ab7e39270b59"
secret = "477df6a068d7332a163f95abbad2079c"
group = "StatView-MainAppSvr-P"
topic = "StatView-T"
action = "pub"
name = "stat-pub/stat-pub"
proto = "tcp"
addr = "172.18.33.50:6205"
active = 5
idle = 1
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
[ReportDatabus]
key = "8e27ab7e39270b59"
secret = "477df6a068d7332a163f95abbad2079c"
group = "ArchiveClick-MainArchive-S"
topic = "ArchiveClick-T"
action = "sub"
name = "report-click/sub"
proto = "tcp"
addr = "172.18.33.50:6205"
active = 5
idle = 1
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
[HTTPClient]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
dial = "50ms"
timeout = "200ms"
keepAlive = "60s"
[HTTPClient.breaker]
window = "1s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[archiveRPC]
group = "uat"
pullInterval = "10s"
[archiveRPC.client]
token = "lY0h6KmXH7u9ftRIuhQTkOYqUg10gwHG"
timeout = "1s"
[archiveRPC.client.breaker]
window ="3s"
sleep ="100ms"
bucket = 10
ratio = 0.5
request = 100
[archiveRPC.zookeeper]
root = "/microservice/archive-service/"
addrs = ["172.18.33.50:2199","172.18.33.51:2199","172.18.33.52:2199"]
timeout = "30s"

View File

@@ -0,0 +1,55 @@
package main
import (
"flag"
"os"
"os/signal"
"syscall"
"time"
"go-common/app/job/main/click/conf"
"go-common/app/job/main/click/http"
"go-common/app/job/main/click/service"
"go-common/library/log"
)
var (
srv *service.Service
)
func main() {
flag.Parse()
if err := conf.Init(); err != nil {
log.Error("conf.Init() error(%v)", err)
panic(err)
}
log.Init(nil)
defer log.Close()
log.Info("click-job start")
srv = service.New(conf.Conf)
http.Init(conf.Conf, srv)
signalHandler()
}
func signalHandler() {
var (
err error
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())
if err = srv.Close(); err != nil {
log.Error("srv close consumer error(%v)", err)
}
time.Sleep(time.Second)
return
case syscall.SIGHUP:
default:
return
}
}
}