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,43 @@
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-live-test.toml"],
importpath = "go-common/app/interface/live/push-live/cmd",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/interface/live/push-live/conf:go_default_library",
"//app/interface/live/push-live/http:go_default_library",
"//app/interface/live/push-live/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,51 @@
package main
import (
"flag"
"os"
"os/signal"
"syscall"
"go-common/app/interface/live/push-live/conf"
"go-common/app/interface/live/push-live/http"
"go-common/app/interface/live/push-live/service"
"go-common/library/log"
"go-common/library/net/trace"
"time"
)
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)
// init trace
trace.Init(conf.Conf.Tracer)
defer trace.Close()
defer log.Close()
log.Info("push-live start")
// service init
srv := service.New(conf.Conf)
http.Init(conf.Conf, srv)
// 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("push-live get a signal %s", s.String())
switch s {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
srv.Close()
log.Info("push-live exit")
time.Sleep(time.Second)
return
case syscall.SIGHUP:
default:
return
}
}
}

View File

@@ -0,0 +1,143 @@
# This is a TOML document. Boom
version = "1.0.0"
user = "root"
pid = "/tmp/push-live.pid"
dir = "/data/dev/go/src/go-common/app/interface/live/push-live"
perf = "0.0.0.0:6420"
env = "dev"
[log]
dir = "/data/log/push-live"
family = "push-live"
[tracer]
family = "push-live"
proto = "udp"
addr = "172.16.33.46:5140"
[bm]
[bm.inner]
addr = "0.0.0.0:9901"
maxListen = 10
timeout = "1s"
[bm.local]
addr = "0.0.0.0:9902"
maxListen = 10
timeout = "1s"
[mysql]
addr = "172.22.34.101:3312"
dsn = "livetestuat:livetestuat20180711@tcp(172.22.34.101:3312)/app_switch?timeout=5s&readTimeout=30s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 5
idle = 10
idleTimeout ="4h"
queryTimeout = "2s"
execTimeout = "2s"
tranTimeout = "2s"
[mysql.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[hbase]
master = ""
meta = ""
dialTimeout = "1s"
readTimeout = "2s"
readsTimeout = "5s"
writeTimeout = "2s"
writesTimeout = "5s"
[hbase.zookeeper]
root = ""
addrs = ["172.18.33.131:2181","172.18.33.168:2181","172.18.33.169:2181"]
timeout = "30s"
[blackListHBase]
master = ""
meta = ""
dialTimeout = "1s"
readTimeout = "2s"
readsTimeout = "5s"
writeTimeout = "2s"
writesTimeout = "5s"
[blackListHBase.zookeeper]
root = ""
addrs = ["172.19.40.5:2181","172.19.40.6:2181","172.19.40.7:2181"]
timeout = "30s"
[liveRoomSub]
key = "ec4c0820d525d67b"
secret = "e20f8f664bf10722efeb6aac0cc16011"
group = "StartLiveNotify-LiveLive-S"
topic = "StartLiveNotify-T"
action ="sub"
name = "interface/push-live"
proto = "tcp"
addr = "172.18.33.50:6205"
idle = 10
active = 100
dialTimeout = "10s"
readTimeout = "40s"
writeTimeout = "10s"
idleTimeout = "60s"
[liveCommonSub]
key = "ec4c0820d525d67b"
secret = "e20f8f664bf10722efeb6aac0cc16011"
group = "LivePushCommon-LiveLive-S"
topic = "LivePushCommon-T"
action ="sub"
name = "interface/push-live"
proto = "tcp"
addr = "172.18.33.50:6205"
idle = 10
active = 100
dialTimeout = "10s"
readTimeout = "40s"
writeTimeout = "10s"
idleTimeout = "60s"
[push]
multiAPI = "http://uat-api.bilibili.co/x/internal/push-strategy/task/add"
appID = 1
businessID = 4
businessToken = "n00nso54h75t5irj8phmunvymh4cl3yt"
linkType = 3
pushRetryTimes = 3
pushOnceLimit = 500000
defaultCopyWriting = "你关注的【%s】正在直播~"
specialCopyWriting = "你特别关注的【%s】正在直播~"
consumerProcNum = 10
intervalLimit = 5000
[push.PushFilterIgnores]
smooth = [101]
limit = [111]
[HTTPClient]
dial = "1s"
timeout = "5s"
keepAlive = "60s"
key = "fb06a25c6338edbc"
secret = "fd10bd177559780c2e4a44f1fa47fa83"
[HTTPClient.breaker]
window ="1s"
sleep ="10ms"
bucket = 10
ratio = 0.5
request = 100
[redis]
[redis.pushInterval]
name = "push-live/pushInterval"
proto = "tcp"
addr = "172.18.33.82:6379"
active = 20
idle = 10
dialTimeout = "50ms"
readTimeout = "100ms"
writeTimeout = "100ms"
idleTimeout = "80s"
expire = "2h"