Create & Init Project...
This commit is contained in:
52
app/interface/main/web/cmd/BUILD
Normal file
52
app/interface/main/web/cmd/BUILD
Normal file
@ -0,0 +1,52 @@
|
||||
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 = [
|
||||
"web-interface-example.toml",
|
||||
"web-interface-test.toml",
|
||||
],
|
||||
importpath = "go-common/app/interface/main/web/cmd",
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//app/interface/main/web/conf:go_default_library",
|
||||
"//app/interface/main/web/http:go_default_library",
|
||||
"//app/interface/main/web/service: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"],
|
||||
)
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_binary",
|
||||
"go_library",
|
||||
)
|
52
app/interface/main/web/cmd/main.go
Normal file
52
app/interface/main/web/cmd/main.go
Normal file
@ -0,0 +1,52 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"go-common/app/interface/main/web/conf"
|
||||
"go-common/app/interface/main/web/http"
|
||||
"go-common/app/interface/main/web/service"
|
||||
ecode "go-common/library/ecode/tip"
|
||||
"go-common/library/log"
|
||||
"go-common/library/net/trace"
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if err := conf.Init(); err != nil {
|
||||
log.Error("conf.Init() error(%v)", err)
|
||||
panic(err)
|
||||
}
|
||||
log.Init(conf.Conf.Log)
|
||||
trace.Init(conf.Conf.Tracer)
|
||||
defer trace.Close()
|
||||
defer log.Close()
|
||||
log.Info("web-interface start")
|
||||
// ecode
|
||||
ecode.Init(conf.Conf.Ecode)
|
||||
//server init
|
||||
svr := service.New(conf.Conf)
|
||||
http.Init(conf.Conf, svr)
|
||||
// signal handler
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
|
||||
for {
|
||||
s := <-c
|
||||
log.Info("web-interface get a signal %s", s.String())
|
||||
switch s {
|
||||
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
|
||||
log.Info("web-interface exit")
|
||||
svr.Close()
|
||||
time.Sleep(time.Second)
|
||||
return
|
||||
case syscall.SIGHUP:
|
||||
// TODO reload
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
104
app/interface/main/web/cmd/web-interface-example.toml
Normal file
104
app/interface/main/web/cmd/web-interface-example.toml
Normal file
@ -0,0 +1,104 @@
|
||||
# This is a TOML document. Boom.
|
||||
|
||||
version = "1.0.0"
|
||||
user = "nobody"
|
||||
pid = "/tmp/web-interface.pid"
|
||||
dir = "./"
|
||||
perf = "127.0.0.1:6260"
|
||||
checkFile = "/data/www/web-interface.html"
|
||||
family = "web-interface"
|
||||
address = "172.16.33.56"
|
||||
|
||||
env = "test"
|
||||
tick = "5m"
|
||||
|
||||
accountURI = "http://account.bilibili.com"
|
||||
|
||||
[matsuri]
|
||||
pastID = 5461206
|
||||
matID = 5461533
|
||||
matTime = "2016-12-15T16:57:03+08:00"
|
||||
tick = "10s"
|
||||
|
||||
[identify]
|
||||
whiteAccessKey = ""
|
||||
whiteMid = 0
|
||||
[identify.app]
|
||||
key = "c05dd4e1638a8af0"
|
||||
secret = "d3c5a85f5b895a03735b5d20a273bc57"
|
||||
[identify.memcache]
|
||||
name = "go-business/identify"
|
||||
proto = "tcp"
|
||||
addr = "172.16.33.54:11211"
|
||||
active = 5
|
||||
idle = 10
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "80s"
|
||||
[identify.host]
|
||||
auth = "http://passport.bilibili.com"
|
||||
secret = "http://open.bilibili.com"
|
||||
[identify.authHTTPClient]
|
||||
dial = "1s"
|
||||
timeout = "1s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
[identify.secretHTTPClient]
|
||||
dial = "1s"
|
||||
timeout = "1s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
|
||||
[web-interface]
|
||||
IPFile = "/data/conf/iprepo/iprepo.txt"
|
||||
|
||||
[host]
|
||||
apiCo = "http://api.bilibili.co"
|
||||
|
||||
[log]
|
||||
dir = "/data/log/web-interface/"
|
||||
|
||||
[app]
|
||||
key = "7c7ac0db1aa05587"
|
||||
secret = "9a6d62d93290c5f771ad381e9ca23f26"
|
||||
|
||||
[infoc2]
|
||||
taskID = "000078"
|
||||
proto = "tcp"
|
||||
addr = "172.19.100.20:5401"
|
||||
chanSize = 1024
|
||||
|
||||
[httpClient]
|
||||
[httpClient.read]
|
||||
dial = "1s"
|
||||
timeout = "1s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
[httpClient.write]
|
||||
dial = "1s"
|
||||
timeout = "3s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
|
||||
|
||||
[multiHttp]
|
||||
[multiHttp.inner]
|
||||
addrs = ["0.0.0.0:6281"]
|
||||
maxListen = 1000
|
||||
[multiHttp.local]
|
||||
addrs = ["0.0.0.0:6282"]
|
||||
maxListen = 1000
|
||||
|
||||
[bm]
|
||||
[bm.outer]
|
||||
addr = "0.0.0.0:6351"
|
||||
timeout = "1s"
|
||||
[bm.local]
|
||||
addr = "0.0.0.0:6352"
|
||||
timeout = "1s"
|
||||
|
||||
|
||||
[web]
|
||||
pullRegionInterval = "1m"
|
||||
|
228
app/interface/main/web/cmd/web-interface-test.toml
Normal file
228
app/interface/main/web/cmd/web-interface-test.toml
Normal file
@ -0,0 +1,228 @@
|
||||
[rule]
|
||||
minRankCount = 30
|
||||
minRankIndexCount = 7
|
||||
minRankRegionCount = 9
|
||||
minRankRecCount = 7
|
||||
minRankTagCount = 1
|
||||
minDyCount = 3
|
||||
minNewListCnt = 10
|
||||
authorRecCnt = 16
|
||||
relatedArcCnt = 10
|
||||
maxHelpPageSize = 15
|
||||
maxArcsPageSize = 20
|
||||
maxSecondCacheSize = 200
|
||||
maxFirstCacheSize = 20
|
||||
dynamicNumArcs = 5
|
||||
regionsCount = 10
|
||||
bangumiCount = 50
|
||||
maxArtPageSize = 50
|
||||
artUpListGetCnt = 50
|
||||
artUpListCnt = 5
|
||||
elecShowTypeIDs = [20, 154, 156, 31, 30, 59, 29, 28, 26, 22, 126, 127, 24, 25, 47, 27, 17, 18, 16, 65, 136, 19, 121, 171, 172, 173, 37, 124, 122, 39, 96, 95, 98, 71, 137, 131, 157, 158, 159, 164, 82, 128, 138, 21, 75, 76, 161, 162, 163, 174, 153, 168]
|
||||
rids = [1, 3, 4, 5, 11, 13, 23, 36, 119, 129, 155, 160, 165, 167, 177, 181]
|
||||
noRelAids = [28335367,28990666]
|
||||
|
||||
[identify]
|
||||
whiteAccessKey = ""
|
||||
whiteMid = 0
|
||||
[identify.app]
|
||||
key = "7c7ac0db1aa05587"
|
||||
secret = "9a6d62d93290c5f771ad381e9ca23f26"
|
||||
[identify.memcache]
|
||||
name = "go-business/identify"
|
||||
proto = "tcp"
|
||||
addr = "172.16.33.54:11211"
|
||||
active = 10
|
||||
idle = 10
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "80s"
|
||||
[identify.host]
|
||||
auth = "http://passport.bilibili.com"
|
||||
secret = "http://open.bilibili.com"
|
||||
[identify.httpClient]
|
||||
key = "7c7ac0db1aa05587"
|
||||
secret = "9a6d62d93290c5f771ad381e9ca23f26"
|
||||
dial = "30ms"
|
||||
timeout = "150ms"
|
||||
keepAlive = "60s"
|
||||
[identify.httpClient.url]
|
||||
"http://passport.bilibili.co/intranet/auth/tokenInfo" = {timeout = "100ms"}
|
||||
"http://passport.bilibili.co/intranet/auth/cookieInfo" = {timeout = "100ms"}
|
||||
"http://open.bilibili.co/api/getsecret" = {timeout = "500ms"}
|
||||
|
||||
[log]
|
||||
dir = "/data/log/web-interface/"
|
||||
#[log.syslog]
|
||||
# proto = "udp"
|
||||
# addr = "172.18.19.22:9999"
|
||||
# project = "web-interface"
|
||||
# chanSize = 10240
|
||||
|
||||
[app]
|
||||
key = "7c7ac0db1aa05587"
|
||||
secret = "9a6d62d93290c5f771ad381e9ca23f26"
|
||||
|
||||
[infoc2]
|
||||
taskID = "000078"
|
||||
proto = "tcp"
|
||||
addr = "172.19.100.20:5401"
|
||||
chanSize = 1024
|
||||
|
||||
[httpClient]
|
||||
[httpClient.read]
|
||||
key = "6aa4286456d16b97"
|
||||
secret = "351cf022e1ae8296109c3c524faafcc8"
|
||||
dial = "1s"
|
||||
timeout = "1s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
[httpClient.write]
|
||||
key = "7c7ac0db1aa05587"
|
||||
secret = "9a6d62d93290c5f771ad381e9ca23f26"
|
||||
dial = "1s"
|
||||
timeout = "3s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
[httpClient.bigData]
|
||||
key = "7c7ac0db1aa05587"
|
||||
secret = "9a6d62d93290c5f771ad381e9ca23f26"
|
||||
dial = "1s"
|
||||
timeout = "1s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
[httpClient.help]
|
||||
key = "7c7ac0db1aa05587"
|
||||
secret = "9a6d62d93290c5f771ad381e9ca23f26"
|
||||
dial = "1s"
|
||||
timeout = "1s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
[httpClient.search]
|
||||
key = "7c7ac0db1aa05587"
|
||||
secret = "9a6d62d93290c5f771ad381e9ca23f26"
|
||||
dial = "1s"
|
||||
timeout = "1s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
[httpClient.pay]
|
||||
key = "6aa4286456d16b97"
|
||||
secret = "351cf022e1ae8296109c3c524faafcc8"
|
||||
dial = "1s"
|
||||
timeout = "1s"
|
||||
keepAlive = "60s"
|
||||
timer = 1000
|
||||
|
||||
|
||||
[HTTPServer]
|
||||
addr = "0.0.0.0:6351"
|
||||
timeout = "1s"
|
||||
|
||||
[redis]
|
||||
[redis.localRedis]
|
||||
name = "web-interface/rank"
|
||||
proto = "tcp"
|
||||
addr = "172.16.33.54:6379"
|
||||
idle = 10
|
||||
active = 10
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "10s"
|
||||
rankingExpire = "10m"
|
||||
newlistExpire = "20s"
|
||||
rcExpire = "5m"
|
||||
indexIconExpire = "5m"
|
||||
[redis.bakRedis]
|
||||
name = "web-interface/rank-bak"
|
||||
proto = "tcp"
|
||||
addr = "172.16.33.54:6379"
|
||||
idle = 10
|
||||
active = 10
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "10s"
|
||||
rankingExpire = "24h"
|
||||
newlistExpire = "24h"
|
||||
regionExpire = "24h"
|
||||
archiveExpire = "24h"
|
||||
tagExpire = "24h"
|
||||
cardExpire = "24h"
|
||||
rcExpire = "24h"
|
||||
artUpExpire = "24h"
|
||||
indexIconExpire = "24h"
|
||||
helpExpire = "24h"
|
||||
OlListExpire = "24h"
|
||||
appealLimitExpire = "1h"
|
||||
|
||||
[host]
|
||||
rank = "http://172.18.7.101"
|
||||
rank2 = "http://data-test.bilibili.co"
|
||||
api = "http://api.bilibili.co"
|
||||
data = "http://data.bilibili.co"
|
||||
space = "http://space.bilibili.com"
|
||||
elec = "http://elec.bilibili.co"
|
||||
arcApi = "http://archive.api.bilibili.co"
|
||||
liveAPI = "http://api.live.bilibili.co"
|
||||
helpAPI = "http://service-pre.bilibili.com"
|
||||
show = "http://uat-show.bilibili.co"
|
||||
mall = "http://fat1-mall.bilibili.co"
|
||||
search = "http://s.search.bilibili.co"
|
||||
pay = "http://pay.bilibili.co"
|
||||
abServer = "http://10.23.58.27:6193"
|
||||
manager = "http://manager.bilibili.co"
|
||||
|
||||
[web]
|
||||
pullRegionInterval = "1m"
|
||||
pullOnlineInterval = "15m"
|
||||
pullIndexIconInterval = "5m"
|
||||
searchEggInterval = "10m"
|
||||
onlineCount = 20
|
||||
specailInterval = "1m"
|
||||
|
||||
[tag]
|
||||
pageSize = 200
|
||||
maxSize = 100
|
||||
|
||||
[defaultTop]
|
||||
sImg = "http://i0.hdslb.com/bfs/space/768cc4fd97618cf589d23c2711a1d1a729f42235.png"
|
||||
lImg = "http://i0.hdslb.com/bfs/space/cb1c3ef50e22b6096fde67febe863494caefebad.png"
|
||||
|
||||
[bfs]
|
||||
addr = "http://bfs.bilibili.co"
|
||||
bucket = "test"
|
||||
key = "221bce6492eba70f"
|
||||
secret = "6eb80603e85842542f9736eb13b7e3"
|
||||
maxFileSize = 1048576
|
||||
timeout = "400ms"
|
||||
|
||||
[degradeConfig]
|
||||
expire = 3600
|
||||
[degradeConfig.memcache]
|
||||
name = "web-interface"
|
||||
proto = "tcp"
|
||||
addr = "172.16.33.54:11211"
|
||||
idle = 10
|
||||
active = 10
|
||||
dialTimeout = "2s"
|
||||
readTimeout = "2s"
|
||||
writeTimeout = "2s"
|
||||
idleTimeout = "7h"
|
||||
|
||||
[bnj2019]
|
||||
bnjMainAid = 36324283
|
||||
bnjAdAv = 0
|
||||
bnjListAids = [36324368,36324414,36324551,36324580,36324656,36324841,36324894,36324961,36324997,36325803,36325869,36328477,36328523,36328583,36328676,36328706,36328952,36328993]
|
||||
bnjTick = "10s"
|
||||
[[bnj2019.timeline]]
|
||||
name = "1111"
|
||||
start = "2018-06-04T00:00:00+08:00"
|
||||
end = "2018-06-05T10:00:00+08:00"
|
||||
cover = "//activity.hdslb.com/blackboard/static/20180122/3f23658826b7a0a46f812d368533dc9f/images/j60y4n9j83.png"
|
||||
[[bnj2019.timeline]]
|
||||
name = "2222"
|
||||
start = "2018-06-04T00:00:00+08:00"
|
||||
end = "2018-06-05T10:00:00+08:00"
|
||||
cover = "//i0.hdslb.com/bfs/activity-plat/cover/20180209/m6pvmmnpxx.jpg"
|
Reference in New Issue
Block a user