Create & Init Project...
This commit is contained in:
45
app/interface/main/videoup/cmd/BUILD
Normal file
45
app/interface/main/videoup/cmd/BUILD
Normal file
@ -0,0 +1,45 @@
|
||||
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 = ["videoup.toml"],
|
||||
importpath = "go-common/app/interface/main/videoup/cmd",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//app/interface/main/videoup/conf:go_default_library",
|
||||
"//app/interface/main/videoup/http:go_default_library",
|
||||
"//app/interface/main/videoup/service:go_default_library",
|
||||
"//library/ecode/tip:go_default_library",
|
||||
"//library/log:go_default_library",
|
||||
"//library/net/trace:go_default_library",
|
||||
"//library/queue/databus/report: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"],
|
||||
)
|
53
app/interface/main/videoup/cmd/main.go
Normal file
53
app/interface/main/videoup/cmd/main.go
Normal file
@ -0,0 +1,53 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"go-common/app/interface/main/videoup/conf"
|
||||
"go-common/app/interface/main/videoup/http"
|
||||
"go-common/app/interface/main/videoup/service"
|
||||
ecode "go-common/library/ecode/tip"
|
||||
"go-common/library/log"
|
||||
"go-common/library/net/trace"
|
||||
"go-common/library/queue/databus/report"
|
||||
)
|
||||
|
||||
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()
|
||||
trace.Init(conf.Conf.Tracer)
|
||||
defer trace.Close()
|
||||
ecode.Init(conf.Conf.Ecode)
|
||||
log.Info("videoup start")
|
||||
// service init
|
||||
report.InitUser(nil)
|
||||
svr := service.New(conf.Conf)
|
||||
http.Init(conf.Conf, svr)
|
||||
// init signal
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
|
||||
for {
|
||||
s := <-c
|
||||
log.Info("videoup get a signal %s", s.String())
|
||||
switch s {
|
||||
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
|
||||
log.Info("videoup exit")
|
||||
svr.Close()
|
||||
time.Sleep(time.Second)
|
||||
return
|
||||
case syscall.SIGHUP:
|
||||
// TODO reload
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
11
app/interface/main/videoup/cmd/open_test_web_ui.sh
Normal file
11
app/interface/main/videoup/cmd/open_test_web_ui.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
command -v goconvey >/dev/null 2>&1 || {
|
||||
echo >&2 "required goconvey but it's not installed.";
|
||||
echo "Aborting.";
|
||||
echo "Please run commond: go get github.com/smartystreets/goconvey";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
cd ../videoup
|
||||
goconvey -excludedDirs "vendor,node_modules,rpc" -packages 1
|
171
app/interface/main/videoup/cmd/videoup.toml
Normal file
171
app/interface/main/videoup/cmd/videoup.toml
Normal file
@ -0,0 +1,171 @@
|
||||
# This is a TOML document. Boom.
|
||||
tick = "5m"
|
||||
MaxAllVsCnt = 4000
|
||||
MaxAddVsCnt = 100
|
||||
UgcPayAllowEditDays = 60
|
||||
|
||||
|
||||
[AppEditorInfoc]
|
||||
taskid = "001729"
|
||||
proto = "tcp"
|
||||
addr = "172.18.21.101:5403"
|
||||
chanSize = 10240
|
||||
|
||||
[host]
|
||||
archive = "http://archive.api.bilibili.co"
|
||||
www = "http://www.bilibili.com"
|
||||
member = "http://member.bilibili.com"
|
||||
apico = "http://api.bilibili.co"
|
||||
upMng = "http://cm.bilibili.co"
|
||||
tag = "http://api.bilibili.co"
|
||||
account = "http://account.bilibili.co"
|
||||
vdsvc = "http://archive.api.bilibili.co"
|
||||
elec = "http://elec.bilibili.com"
|
||||
dynamic = "http://api.vc.bilibili.co"
|
||||
mainsearch = "http://uat-manager.bilibili.co"
|
||||
chaodian = "http://chaodian.bilibili.co"
|
||||
|
||||
[game]
|
||||
OpenHost = "http://line1-game-open-api.biligame.net"
|
||||
[game.app]
|
||||
key = "EeOpM531WqQnBvu4"
|
||||
secret = "gHtKtXTHZJDqGP1tg9ORFs0YWV3kW12V"
|
||||
|
||||
|
||||
[app]
|
||||
key = "c05dd4e1638a8af0"
|
||||
secret = "7daa7f8c06cd33c5c3067063c746fdcb"
|
||||
|
||||
[httpClient]
|
||||
[httpClient.UpMng]
|
||||
key = "test"
|
||||
secret = "e6c4c252dc7e3d8a90805eecd7c73396"
|
||||
dial = "1s"
|
||||
timeout = "3s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
[httpClient.UpMng.breaker]
|
||||
window = "10s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
[httpClient.read]
|
||||
key = "c05dd4e1638a8af0"
|
||||
secret = "7daa7f8c06cd33c5c3067063c746fdcb"
|
||||
dial = "1s"
|
||||
timeout = "1s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
[httpClient.read.breaker]
|
||||
window = "10s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
[httpClient.write]
|
||||
key = "c05dd4e1638a8af0"
|
||||
secret = "7daa7f8c06cd33c5c3067063c746fdcb"
|
||||
dial = "1s"
|
||||
timeout = "3s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
[httpClient.write.breaker]
|
||||
window = "10s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
[httpClient.fastread]
|
||||
key = "c05dd4e1638a8af0"
|
||||
secret = "7daa7f8c06cd33c5c3067063c746fdcb"
|
||||
dial = "50ms"
|
||||
timeout = "100ms"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
[httpClient.fastread.breaker]
|
||||
window = "10s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
[httpClient.chaodian]
|
||||
key = "chaodian_20190117tangseng"
|
||||
secret = "chaodian_20190117tangseng"
|
||||
dial = "1s"
|
||||
timeout = "3s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
[httpClient.chaodian.breaker]
|
||||
window = "10s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
|
||||
[memcache]
|
||||
archiveExpire = "10s"
|
||||
[memcache.archive]
|
||||
name = "videoup/archive"
|
||||
proto = "tcp"
|
||||
addr = "172.16.33.54:11213"
|
||||
idle = 5
|
||||
active = 10
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "80s"
|
||||
[memcache.account]
|
||||
name = "videoup/account"
|
||||
proto = "tcp"
|
||||
addr = "172.16.33.54:11213"
|
||||
idle = 5
|
||||
active = 10
|
||||
dialTimeout = "80ms"
|
||||
readTimeout = "200ms"
|
||||
writeTimeout = "200ms"
|
||||
idleTimeout = "80s"
|
||||
submitExpire = "10m"
|
||||
|
||||
[redis]
|
||||
[redis.videoup]
|
||||
name = "videoup"
|
||||
proto = "tcp"
|
||||
addr = "172.16.33.54:6381"
|
||||
idle = 100
|
||||
active = 100
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "10s"
|
||||
expire = "10s"
|
||||
|
||||
[UpCoverAnti]
|
||||
on=true
|
||||
second=60
|
||||
n=15
|
||||
hour=12
|
||||
m=1000
|
||||
[UpCoverAnti.redis]
|
||||
name = "videoup/videoup"
|
||||
proto = "tcp"
|
||||
addr = "172.16.33.54:6379"
|
||||
idle = 100
|
||||
active = 100
|
||||
dialTimeout = "500ms"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "80s"
|
||||
expire = "10m"
|
||||
|
||||
[bfs]
|
||||
Timeout = "2s"
|
||||
MaxFileSize = 5242880
|
||||
|
||||
[bm]
|
||||
addr = "0.0.0.0:6321"
|
||||
maxListen = 1000
|
||||
timeout = "2s"
|
||||
|
||||
[limit]
|
||||
"AddBasicExp" = "30s"
|
Reference in New Issue
Block a user