Create & Init Project...
This commit is contained in:
44
app/admin/main/creative/cmd/BUILD
Normal file
44
app/admin/main/creative/cmd/BUILD
Normal 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 = ["creative-admin.toml"],
|
||||
importpath = "go-common/app/admin/main/creative/cmd",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//app/admin/main/creative/conf:go_default_library",
|
||||
"//app/admin/main/creative/http: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"],
|
||||
)
|
136
app/admin/main/creative/cmd/creative-admin.toml
Normal file
136
app/admin/main/creative/cmd/creative-admin.toml
Normal file
@ -0,0 +1,136 @@
|
||||
# This is a TOML document. Boom.
|
||||
|
||||
version = "1.0.0"
|
||||
user = "nobody"
|
||||
pid = "/tmp/creative-admin.pid"
|
||||
dir = "./"
|
||||
perf = "0.0.0.0:6343"
|
||||
checkFile = "/data/www/creative-admin.html"
|
||||
|
||||
[log]
|
||||
dir = "/data/log/creative-admin/"
|
||||
stdout = false
|
||||
[xlog.syslog]
|
||||
project = "creative-admin"
|
||||
chanSize = 10240
|
||||
|
||||
[app]
|
||||
key = "c1a1cb2d89c33794"
|
||||
secret = "dda47eeca111e03e6845017505baea13"
|
||||
[orm]
|
||||
dsn = "test:test@tcp(172.16.33.205:3308)/bilibili_creative?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
|
||||
active = 5
|
||||
idle = 5
|
||||
idleTimeout = "4h"
|
||||
|
||||
[ormArchive]
|
||||
dsn = "test:test@tcp(172.16.33.205:3308)/bilibili_archive?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
|
||||
active = 5
|
||||
idle = 2
|
||||
idleTimeout = "4h"
|
||||
|
||||
[bm]
|
||||
addr = "0.0.0.0:6344"
|
||||
maxListen = 10
|
||||
timeout = "1s"
|
||||
|
||||
[identify]
|
||||
whiteAccessKey = "a2a1eb0ac97d6ba08b85aa0151528f34"
|
||||
whiteMid = 23675773
|
||||
csrf = false
|
||||
[identify.app]
|
||||
key = "53e2fa226f5ad348"
|
||||
secret = "3cf6bd1b0ff671021da5f424fea4b04a"
|
||||
[identify.memcache]
|
||||
name = "go-business/identify"
|
||||
proto = "tcp"
|
||||
addr = "172.16.33.54:11211"
|
||||
active = 10
|
||||
idle = 5
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "80s"
|
||||
[identify.host]
|
||||
auth = "http://passport.bilibili.co"
|
||||
secret = "http://open.bilibili.co"
|
||||
[identify.httpClient]
|
||||
key = "53e2fa226f5ad348"
|
||||
secret = "3cf6bd1b0ff671021da5f424fea4b04a"
|
||||
dial = "1s"
|
||||
timeout = "1s"
|
||||
keepAlive = "60s"
|
||||
[identify.httpClient.breaker]
|
||||
window = "10s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
[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"}
|
||||
|
||||
|
||||
[auth]
|
||||
managerHost = "http://uat-manager.bilibili.co"
|
||||
dashboardHost = "http://dashboard-mng.bilibili.co"
|
||||
dashboardCaller = "manager-go"
|
||||
[auth.DsHTTPClient]
|
||||
key = "manager-go"
|
||||
secret = "949bbb2dd3178252638c2407578bc7ad"
|
||||
dial = "1s"
|
||||
timeout = "1s"
|
||||
keepAlive = "60s"
|
||||
[auth.DsHTTPClient.breaker]
|
||||
window = "3s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
[auth.MaHTTPClient]
|
||||
key = "f6433799dbd88751"
|
||||
secret = "36f8ddb1806207fe07013ab6a77a3935"
|
||||
dial = "1s"
|
||||
timeout = "1s"
|
||||
keepAlive = "60s"
|
||||
[auth.MaHTTPClient.breaker]
|
||||
window = "3s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
[auth.session]
|
||||
sessionIDLength = 32
|
||||
cookieLifeTime = 1800
|
||||
cookieName = "mng-go"
|
||||
domain = ".bilibili.co"
|
||||
[auth.session.Memcache]
|
||||
name = "go-business/auth"
|
||||
proto = "unix"
|
||||
addr = "/tmp/uat-manager-auth-mc.sock"
|
||||
active = 10
|
||||
idle = 5
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "80s"
|
||||
|
||||
|
||||
[bfs]
|
||||
key = "ef42d94858dd49b2"
|
||||
secret = "351c300573a330a5271226835be496"
|
||||
host = "http://uat-bfs.bilibili.co"
|
||||
timeout = 1000
|
||||
maxFileSize = 5242880
|
||||
|
||||
[httpClient]
|
||||
key = "b8f239ca38a53308"
|
||||
secret = "5460ef72fe13c10dfb53442b9111427e"
|
||||
dial = "500ms"
|
||||
timeout = "1s"
|
||||
keepAlive = "60s"
|
||||
timer = 10
|
||||
|
||||
[host]
|
||||
msg = "http://message.bilibili.co"
|
45
app/admin/main/creative/cmd/main.go
Normal file
45
app/admin/main/creative/cmd/main.go
Normal file
@ -0,0 +1,45 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"go-common/app/admin/main/creative/conf"
|
||||
"go-common/app/admin/main/creative/http"
|
||||
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 {
|
||||
panic(err)
|
||||
}
|
||||
log.Init(conf.Conf.Log)
|
||||
defer log.Close()
|
||||
trace.Init(conf.Conf.Tracer)
|
||||
defer trace.Close()
|
||||
http.Init(conf.Conf)
|
||||
report.InitManager(conf.Conf.ManagerReport)
|
||||
ecode.Init(conf.Conf.Ecode)
|
||||
log.Info("creative-admin start")
|
||||
// signal handler
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
|
||||
for {
|
||||
s := <-c
|
||||
log.Info("creative-admin get a signal %s", s.String())
|
||||
switch s {
|
||||
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGSTOP, syscall.SIGINT:
|
||||
log.Info("creative-admin exit")
|
||||
return
|
||||
case syscall.SIGHUP:
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
6
app/admin/main/creative/cmd/open_test_web_ui.sh
Normal file
6
app/admin/main/creative/cmd/open_test_web_ui.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/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 ../creative
|
||||
goconvey -excludedDirs "vendor,node_modules,rpc" -packages 1
|
Reference in New Issue
Block a user