作者 yangfu
... ... @@ -3,6 +3,7 @@ ENV APP_DIR $GOPATH/src/project-20210826
RUN mkdir -p $APP_DIR
WORKDIR $APP_DIR/
COPY ./pkg pkg
COPY ./config config
COPY ./go.mod go.mod
COPY ./go.sum go.sum
COPY ./main.go main.go
... ...
2021/09/07 01:40:08.650 [D] [hook.go:130] CREATE TABLE IF NOT EXISTS "login_access" ("login_access_id" bigserial, "account" text, "platform" text, "company_id" bigint, "organization_id" bigint, "access_token" text, "refresh_token" text, "access_expired" bigint, "refresh_expired" bigint, "created_time" timestamptz, "updated_time" timestamptz, PRIMARY KEY ("login_access_id")) null
2021/09/07 01:40:09.439 [I] [hooks.go:101] generate router from comments
2021/09/07 01:40:09.440 [I] [???:0] http server Running on http://:8083
2021/09/07 01:40:12.667 [I] [filter.go:81] http请求 [
{
"framework": "beego",
"method": "GET",
"url": "/log"
}
]
2021/09/07 01:40:12.667 [D] [filter.go:81] http请求 [
{
"framework": "beego",
"method": "GET",
"url": "/log"
}
]
2021/09/07 01:40:12.669 [D] [filter.go:81] http响应 [
{
"framework": "beego",
"method": "GET",
"outputData": null,
"url": "/log"
}
]
2021/09/07 01:40:12.669 [D] [router.go:664] | ::1| 200 | 2.412278ms| match| GET  /log r:/log
2021/09/07 01:42:14.324 [D] [hook.go:130] CREATE TABLE IF NOT EXISTS "login_access" ("login_access_id" bigserial, "account" text, "platform" text, "company_id" bigint, "organization_id" bigint, "access_token" text, "refresh_token" text, "access_expired" bigint, "refresh_expired" bigint, "created_time" timestamptz, "updated_time" timestamptz, PRIMARY KEY ("login_access_id")) null
2021/09/07 01:42:15.705 [I] [hooks.go:101] generate router from comments
2021/09/07 01:42:15.706 [I] [???:0] http server Running on http://:8083
... ...
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAy0OxRf+NheQG9epxbrudwnrzqVgqK5zCuRAkLUgaSMATVXEA
iDzJN39om+Q49MmtEk4pXGzKUyzkFJG96PA8tJq0E+bSDtSK3n+2mjZb6pChm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M7PDmy14R3iJvm3WOnnL+5Nb+qh+cli3vA0p+
rvSNb3I8QzvAP+u431yqqcau8vzY7qN7Q/aGNnwU4M309z/+3ri0ivCRlv79Q2R+
/czSAaF9ffgZGclCKxO/WIu6pKJmBHaIkU4MiRTOok3JMrO66BQavHHxW/BBC5gA
CiIDEOUMsfnNkjcZ7Tvx5Dq2+UUTJnWvu6rvP3t3O9LEApE9GQDTF1w52z97GA1F
zZOFli9d31kWTz9RvdVFGD/tSo7oBmF0Ixa1DVBzJ0RHfxBdiSprhTEUxOipakyA
vGp4z7h/jnZymQyd/teRCBaho1+V
-----END CERTIFICATE-----
... ...
... ... @@ -91,14 +91,16 @@ spec:
value: ""
- name: LOG_LEVEL
value: "debug"
- name: LOG_FRAMEWORK
value: "beego"
- name: LOG_TYPE
value: file
value: "file"
- name: ERROR_BASE_CODE
value: "1"
- name: ERROR_BASE_CODE_MULTIPLE
value: "1000"
- name: ENABLE_KAFKA_LOG
value: "true"
value: "false"
- name: HTTP_PORT
value: "8082"
- name: ALLIED_CREATION_USER_HOST
... ...
apiVersion: v1
kind: Service
metadata:
name: allied-creation-gateway
namespace: mmm-suplus-test
labels:
k8s-app: allied-creation-gateway
spec:
ports:
- name: "http"
port: 80
targetPort: 8082
- name: "https"
port: 443
targetPort: 443
selector:
k8s-app: allied-creation-gateway
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: allied-creation-gateway
namespace: mmm-suplus-test
labels:
k8s-app: allied-creation-gateway
spec:
replicas: 1
template:
metadata:
labels:
k8s-app: allied-creation-gateway
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference: {}
weight: 100
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- cn-hangzhou.i-bp1djh1xn7taumbue1ze
- cn-hangzhou.i-bp1djh1xn7taumbue1zd
- cn-hangzhou.i-bp1euf5u1ph9kbhtndhb
- cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
containers:
- name: allied-creation-gateway
image: 192.168.0.243:5000/mmm/allied-creation-gateway:dev
imagePullPolicy: Always
ports:
- containerPort: 8082
- containerPort: 443
volumeMounts:
- mountPath: /opt/logs
name: accesslogs
env:
- name: POSTGRESQL_DB_NAME
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresqlalliedcreation.dbname
- name: POSTGRESQL_USER
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.user
- name: POSTGRESQL_PASSWORD
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.password
- name: POSTGRESQL_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.host
- name: POSTGRESQL_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.port
- name: REDIS_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.ip
- name: REDIS_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.port
- name: REDIS_AUTH
value: ""
- name: LOG_LEVEL
value: "debug"
- name: LOG_FRAMEWORK
value: "beego"
- name: LOG_TYPE
value: "file"
- name: ERROR_BASE_CODE
value: "1"
- name: ERROR_BASE_CODE_MULTIPLE
value: "1000"
- name: ENABLE_KAFKA_LOG
value: "false"
- name: HTTP_PORT
value: "8082"
- name: ALLIED_CREATION_USER_HOST
value: "https://allied-creation-user-test.fjmaimaimai.com"
- name: ALLIED_CREATION_COOPERATION_HOST
value: "https://allied-creation-cooperation-test.fjmaimaimai.com"
- name: ALLIED_CREATION_BASIC_HOST
value: "https://allied-creation-basic-test.fjmaimaimai.com"
- name: SMS_SERVE_HOST
value: "https://sms.fjmaimaimai.com:9897"
# - name: REDIS_HOST
# valueFrom:
# configMapKeyRef:
# name: suplus-config
# key: redis.ip
# - name: REDIS_PORT
# valueFrom:
# configMapKeyRef:
# name: suplus-config
# key: redis.port
volumes:
- name: accesslogs
emptyDir: {}
... ...
#!/bin/bash
export PATH=/root/local/bin:$PATH
kubectl -n mmm-suplus-test get pods | grep -q allied-creation-gateway
if [ "$?" == "1" ];then
kubectl create -f /tmp/test/allied-creation-gateway/allied-creation-gateway.yaml --record
kubectl -n mmm-suplus-test get svc | grep -q allied-creation-gateway
if [ "$?" == "0" ];then
echo "allied-creation-gateway service install success!"
else
echo "allied-creation-gateway service install fail!"
fi
kubectl -n mmm-suplus-test get pods | grep -q allied-creation-gateway
if [ "$?" == "0" ];then
echo "allied-creation-gateway deployment install success!"
else
echo "allied-creation-gateway deployment install fail!"
fi
else
kubectl delete -f /tmp/test/allied-creation-gateway/allied-creation-gateway.yaml
kubectl -n mmm-suplus-test get svc | grep -q allied-creation-gateway
while [ "$?" == "0" ]
do
kubectl -n mmm-suplus-test get svc | grep -q allied-creation-gateway
done
kubectl -n mmm-suplus-test get pods | grep -q allied-creation-gateway
while [ "$?" == "0" ]
do
kubectl -n mmm-suplus-test get pods | grep -q allied-creation-gateway
done
kubectl create -f /tmp/test/allied-creation-gateway/allied-creation-gateway.yaml --record
kubectl -n mmm-suplus-test get svc | grep -q allied-creation-gateway
if [ "$?" == "0" ];then
echo "allied-creation-gateway service update success!"
else
echo "allied-creation-gateway service update fail!"
fi
kubectl -n mmm-suplus-test get pods | grep -q allied-creation-gateway
if [ "$?" == "0" ];then
echo "allied-creation-gateway deployment update success!"
else
echo "allied-creation-gateway deployment update fail!"
fi
fi
\ No newline at end of file
... ...
... ... @@ -48,6 +48,7 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1
github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/elastic/go-elasticsearch/v6 v6.8.5 h1:U2HtkBseC1FNBmDr0TR2tKltL6FxoY+niDAlj5M8TK8=
github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
... ...
... ... @@ -27,6 +27,7 @@ func (srv UndertakerFeedbackService) SearchFeedback(cmd *command.SearchFeedbackC
result.Grid.List[i].ContractUndertaker.UserCode = v.ContractUndertaker.UserInfo.UserCode
result.Grid.List[i].ContractUndertaker.UserName = v.ContractUndertaker.UserInfo.UserName
result.Grid.List[i].ContractUndertaker.UserPhone = v.ContractUndertaker.UserInfo.UserPhone
result.Grid.List[i].CooperationMode.CooperationModeName = v.CooperationModeName
}
return result, nil
}
... ...
... ... @@ -8,8 +8,11 @@ import (
const SERVICE_NAME = "allied-creation-gateway"
var LOG_LEVEL = "debug"
var LOG_TYPE = "console"
var LOG_TYPE = "console"// file, console, es
var LOG_FRAMEWORK = "beego" // beego logrus
var LOG_FILE = "app.log"
var LOG_PREFIX = "[allied-creation-gateway]"
var HTTP_PORT int = 8083
//天联共创基础模块
... ...
... ... @@ -19,6 +19,10 @@ func init() {
// POSTGRESQL_PORT = os.Getenv("TOPIC_LOG_STASH")
//}
if os.Getenv("ENABLE_KAFKA_LOG") != "" {
ENABLE_KAFKA_LOG = true
if os.Getenv("ENABLE_KAFKA_LOG") == "true" {
ENABLE_KAFKA_LOG = true
} else if os.Getenv("ENABLE_KAFKA_LOG") == "false" {
ENABLE_KAFKA_LOG = false
}
}
}
... ...
... ... @@ -81,6 +81,9 @@ type (
CreatedAt jtime.TimeToUnixMsec `json:"createdAt"`
// 共创模式名称
CooperationModeName string `json:"cooperationModeName"`
CooperationMode struct {
CooperationModeName string `json:"cooperationModeName"`
} `json:"cooperationMode"`
} `json:"list"`
Total int `json:"total"`
} `json:"grid"`
... ...
... ... @@ -4,12 +4,11 @@ import (
"bytes"
"encoding/json"
"fmt"
"io"
"strconv"
"github.com/beego/beego/v2/core/logs"
"github.com/linmadan/egglib-go/log"
_ "github.com/beego/beego/v2/core/logs/es"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
"io"
"strconv"
)
type LoggerConfig struct {
... ... @@ -26,35 +25,7 @@ type BeegoLog struct {
beeLogger *logs.BeeLogger
}
var _ log.Logger = &BeegoLog{}
func NewBeegoLog(conf LoggerConfig) *BeegoLog {
logger := logs.GetBeeLogger()
logger.SetLevel(conf.Level)
if constant.LOG_TYPE == "file" { // 日志存储到文件
confByte, _ := json.Marshal(conf)
err := logger.SetLogger(logs.AdapterFile, string(confByte))
if err != nil {
fmt.Println(err.Error())
return nil
}
} else { // 日志输出到控制台
err := logger.SetLogger(logs.AdapterConsole, `{"level":7,"color":true}`)
if err != nil {
fmt.Println(err.Error())
return nil
}
}
logger.SetPrefix(constant.SERVICE_NAME)
logger.EnableFuncCallDepth(true)
logger.SetLogFuncCallDepth(5)
return &BeegoLog{
beeLogger: logger,
}
}
func (logger *BeegoLog) AddHook(write io.Writer) {
}
func (logger *BeegoLog) SetServiceName(serviceName string) {
... ... @@ -118,3 +89,35 @@ func (logger *BeegoLog) Fatal(msg string, appends ...map[string]interface{}) {
func (logger *BeegoLog) Panic(msg string, appends ...map[string]interface{}) {
logs.Error(msg, appends)
}
func NewBeegoLog(conf LoggerConfig) *BeegoLog {
logger := logs.GetBeeLogger()
logger.SetLevel(conf.Level)
if constant.LOG_TYPE == "file" { // 日志存储到文件
confByte, _ := json.Marshal(conf)
err := logger.SetLogger(logs.AdapterFile, string(confByte))
if err != nil {
fmt.Println(err.Error())
return nil
}
} else if constant.LOG_TYPE == "es" { // 日志存储到ES
err := logger.SetLogger(logs.AdapterEs, `{"dsn":"http://192.168.100.222:9200/","level":7}`)
if err != nil {
fmt.Println(err.Error())
return nil
}
} else { // 日志输出到控制台
err := logger.SetLogger(logs.AdapterConsole, `{"level":7,"color":true}`)
if err != nil {
fmt.Println(err.Error())
return nil
}
}
logger.SetPrefix(constant.LOG_PREFIX)
logger.EnableFuncCallDepth(true)
logger.SetLogFuncCallDepth(5)
logger.SetPrefix(constant.LOG_PREFIX)
return &BeegoLog{
beeLogger: logger,
}
}
... ...
package log
import (
"github.com/linmadan/egglib-go/log/logrus"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
"github.com/linmadan/egglib-go/log"
... ... @@ -9,13 +10,15 @@ import (
var Logger log.Logger
func init() {
// Logger = logrus.NewLogrusLogger()
// Logger.SetServiceName(constant.SERVICE_NAME)
// Logger.SetLevel(constant.LOG_LEVEL)
// //
Logger = NewBeegoLog(LoggerConfig{
Filename: constant.LOG_FILE,
Level: 7,
MaxSize: 1024 * 1024 * 2,
})
if constant.LOG_FRAMEWORK == "beego" {
Logger = NewBeegoLog(LoggerConfig{
Filename: constant.LOG_FILE,
Level: 7,
MaxSize: 1024 * 1024 * 2,
})
} else if constant.LOG_FRAMEWORK == "logrus" {
Logger = logrus.NewLogrusLogger()
Logger.SetServiceName(constant.SERVICE_NAME)
Logger.SetLevel(constant.LOG_LEVEL)
}
}
... ...
... ... @@ -33,10 +33,10 @@ func init() {
}
}
//https支持
web.BConfig.Listen.EnableHTTPS = false
web.BConfig.Listen.HTTPSPort = 80
web.BConfig.Listen.HTTPSCertFile = ""
web.BConfig.Listen.HTTPSKeyFile = ""
web.BConfig.Listen.EnableHTTPS = true
web.BConfig.Listen.HTTPSPort = 443
web.BConfig.Listen.HTTPSCertFile = "./config/fjmaimaimai.com_bundle.crt"
web.BConfig.Listen.HTTPSKeyFile = "./config/fjmaimaimai.com.key"
filters.SecureKeyMap["token"] = "x-mmm-accesstoken"
web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors())
... ...
package controllers
import "io/ioutil"
type LoggerController struct {
BaseController
}
func (controller LoggerController) Index() {
bytes, _ := ioutil.ReadFile("./app.log")
controller.Ctx.WriteString(string(bytes))
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers"
)
func init() {
web.Router("/log", &controllers.LoggerController{}, "Get:Index")
}
... ...