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,44 @@
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 = ["push-search-test.toml"],
importpath = "go-common/app/job/live/push-search/cmd",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/job/live/push-search/conf:go_default_library",
"//app/job/live/push-search/http:go_default_library",
"//app/job/live/push-search/service/migrate: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"],
)

View File

@@ -0,0 +1,67 @@
package main
import (
"flag"
"go-common/library/net/trace"
"os"
"os/signal"
"syscall"
"time"
"go-common/app/job/live/push-search/conf"
"go-common/app/job/live/push-search/http"
"go-common/app/job/live/push-search/service/migrate"
ecode "go-common/library/ecode/tip"
"go-common/library/log"
)
func main() {
flag.Parse()
if err := conf.Init(); err != nil {
panic(err)
}
log.Init(conf.Conf.Log)
defer log.Close()
log.Info("push-search-service start")
if len(os.Args[1:]) > 0 && os.Args[1:][0] == "migrate" {
roomId := os.Args[1:][1]
isTest := os.Args[1:][2]
ms := migrate.NewMigrateS(conf.Conf)
go ms.Migrate(roomId, isTest)
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {
m := <-c
switch m {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
ms.Close()
log.Info("push-search-service-migrate exit")
time.Sleep(time.Second)
return
case syscall.SIGHUP:
default:
return
}
}
}
trace.Init(conf.Conf.Tracer)
defer trace.Close()
ecode.Init(conf.Conf.Ecode)
http.Init(conf.Conf)
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {
s := <-c
log.Info("get a signal %s", s.String())
switch s {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
http.Srv.Close()
log.Info("push-search-service exit")
time.Sleep(time.Second)
return
case syscall.SIGHUP:
default:
return
}
}
}

View File

@@ -0,0 +1,97 @@
[log]
stdout=true
[group]
[group.RoomInfo]
num = 32
chan = 1024
[group.Attention]
num = 32
chan = 1024
[group.UserInfo]
num = 32
chan = 1024
[databus]
[databus.PushSearch]
key = "ec4c0820d525d67b"
secret= "e20f8f664bf10722efeb6aac0cc16011"
group= "RoomUpdateToSearch-LiveLive-P"
topic= "RoomUpdateToSearch-T"
action="pub"
name = "live-search"
proto = "tcp"
addr = "172.18.33.50:6205"
idle = 100
active = 100
dialTimeout = "10s"
readTimeout = "40s"
writeTimeout = "10s"
idleTimeout = "60s"
[databus.RoomInfo]
key = "ec4c0820d525d67b"
secret= "e20f8f664bf10722efeb6aac0cc16011"
group= "ApRoomBinlog-LiveLive-S"
topic= "ApRoomBinlog-T"
action="sub"
name = "live-roomInfo-change"
proto = "tcp"
addr = "172.18.33.50:6205"
idle = 100
active = 100
dialTimeout = "10s"
readTimeout = "40s"
writeTimeout = "10s"
idleTimeout = "60s"
[databus.Attention]
key = "ec4c0820d525d67b"
secret= "e20f8f664bf10722efeb6aac0cc16011"
group= "LiveRelationChanged-LiveLive-S"
topic= "LiveRelationChanged-T"
action="sub"
name = "live-attention-change"
proto = "tcp"
addr = "172.18.33.50:6205"
idle = 100
active = 100
dialTimeout = "10s"
readTimeout = "40s"
writeTimeout = "10s"
idleTimeout = "60s"
[databus.UserName]
key = "ec4c0820d525d67b"
secret= "e20f8f664bf10722efeb6aac0cc16011"
group= "BannedUserSyn-LiveLive-Search-S"
topic= "BannedUserSyn-T"
action="sub"
name = "live-userName-change"
proto = "tcp"
addr = "172.18.33.50:6205"
idle = 100
active = 100
dialTimeout = "10s"
readTimeout = "40s"
writeTimeout = "10s"
idleTimeout = "60s"
[SearchHBase]
master = ""
meta = ""
dialTimeout = "1s"
readTimeout = "2s"
readsTimeout = "5s"
writeTimeout = "2s"
writesTimeout = "5s"
[SearchHBase.zookeeper]
root = ""
addrs = ["172.18.33.131:2181","172.18.33.168:2181","172.18.33.169:2181"]
timeout = "30s"
[liverpc]
[liverpc.room]
AppID = "live.room"
ConnTimeout = "50ms"
[liverpc.relation]
AppID = "live.relation"
ConnTimeout = "50ms"
[liverpc.user]
AppID = "live.user"
ConnTimeout = "50ms"