Compare commits
1 Commits
2ea538995a
...
feat/instg
| Author | SHA1 | Date | |
|---|---|---|---|
| acef3423b3 |
@@ -22,7 +22,7 @@ func (p *Program) Init(_ svc.Environment) error {
|
||||
return err
|
||||
}
|
||||
p.moduleList = append(p.moduleList, base)
|
||||
p.moduleList = append(p.moduleList, (&module.DB{}).Bind(config.Get().DB, config.Get().App.Name))
|
||||
p.moduleList = append(p.moduleList, (&module.DB{}).Bind(config.Get().DB, common.KeyDiscoverServiceNameGateway))
|
||||
p.moduleList = append(p.moduleList, &ModuleWebServer{})
|
||||
p.moduleList = append(p.moduleList, &ModuleWebsocketServer{})
|
||||
p.moduleList = append(p.moduleList, &ModuleLoginQueue{})
|
||||
|
||||
@@ -13,19 +13,19 @@ metric:
|
||||
address: "0.0.0.0"
|
||||
port: 18504
|
||||
jaeger:
|
||||
endpoint: "127.0.0.1:4317"
|
||||
endpoint: "localhost:4317"
|
||||
|
||||
db:
|
||||
etcd:
|
||||
endpoints: [ "127.0.0.1:2379" ]
|
||||
endpoints: [ "localhost:2379" ]
|
||||
redis:
|
||||
addr: "127.0.0.1:6379"
|
||||
addr: "localhost:6379"
|
||||
password: "lQ7aM8oB6lK0iD5k"
|
||||
db: 0
|
||||
|
||||
serve:
|
||||
grpc:
|
||||
address: "127.0.0.1"
|
||||
address: "10.0.40.199"
|
||||
port: 18500
|
||||
ttl: 20
|
||||
socket:
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
FROM alpine:3.23.2
|
||||
|
||||
ENV ARMS_ENABLE=true
|
||||
ENV ARMS_APP_NAME=gateway
|
||||
ENV ARMS_REGION_ID=cn-chengdu
|
||||
ENV ARMS_LICENSE_KEY=gys9jv7jqe@144a6fd684976b3
|
||||
|
||||
RUN apk add --no-cache tzdata && \
|
||||
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
||||
echo "Asia/Shanghai" > /etc/timezone
|
||||
|
||||
9
deploy/Jenkinsfile
vendored
9
deploy/Jenkinsfile
vendored
@@ -19,6 +19,7 @@ pipeline {
|
||||
APP_NAME = 'service-gateway'
|
||||
GO_MOD_CACHE_DIR = '/home/pi/Desktop/docker/jenkins/caches/go-mod'
|
||||
GO_BUILD_CACHE_DIR = '/home/pi/Desktop/docker/jenkins/caches/go-build'
|
||||
INSTGO_CACHE_DIR = '/home/pi/Desktop/docker/jenkins/caches/instgo'
|
||||
}
|
||||
|
||||
options {
|
||||
@@ -53,7 +54,7 @@ pipeline {
|
||||
docker {
|
||||
image 'golang:1.24.0-alpine'
|
||||
reuseNode true
|
||||
args '-u root:root -v $GO_MOD_CACHE_DIR:/go/pkg/mod -v $GO_BUILD_CACHE_DIR:/root/.cache/go-build'
|
||||
args '-u root:root -v $GO_MOD_CACHE_DIR:/go/pkg/mod -v $GO_BUILD_CACHE_DIR:/root/.cache/go-build -v $INSTGO_CACHE_DIR:/root/instgo-caches'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
@@ -62,8 +63,12 @@ pipeline {
|
||||
export CGO_ENABLED=0
|
||||
export GOOS=linux
|
||||
export GOARCH=amd64
|
||||
export INSTGO_CACHE_DIR=/root/instgo-caches
|
||||
|
||||
go build -o ${env.APP_NAME} .
|
||||
wget "http://arms-apm-cn-chengdu.oss-cn-chengdu.aliyuncs.com/instgo/instgo-linux-arm64" -O instgo
|
||||
chmod +x instgo
|
||||
./instgo set --licenseKey=gys9jv7jqe@144a6fd684976b3
|
||||
./instgo go build -o ${env.APP_NAME} .
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
2
go.mod
2
go.mod
@@ -4,7 +4,7 @@ go 1.24.0
|
||||
|
||||
require (
|
||||
bou.ke/monkey v1.0.2
|
||||
git.hlsq.asia/mmorpg/service-common v0.0.0-20260127091405-a93b5fd1aa49
|
||||
git.hlsq.asia/mmorpg/service-common v0.0.0-20260123132258-4d661d08134e
|
||||
github.com/alicebob/miniredis/v2 v2.35.0
|
||||
github.com/gin-contrib/cors v1.7.6
|
||||
github.com/gin-gonic/gin v1.11.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -2,8 +2,8 @@ bou.ke/monkey v1.0.2 h1:kWcnsrCNUatbxncxR/ThdYqbytgOIArtYWqcQLQzKLI=
|
||||
bou.ke/monkey v1.0.2/go.mod h1:OqickVX3tNx6t33n1xvtTtu85YN5s6cKwVug+oHMaIA=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
git.hlsq.asia/mmorpg/service-common v0.0.0-20260127091405-a93b5fd1aa49 h1:neROxvB2bS8U8SchSJEERVk15rRobxPkwJ+krO46fV4=
|
||||
git.hlsq.asia/mmorpg/service-common v0.0.0-20260127091405-a93b5fd1aa49/go.mod h1:mMhZcumphj6gaVTppVYsMTkd+5HupmQgAc53Pd4MH9I=
|
||||
git.hlsq.asia/mmorpg/service-common v0.0.0-20260123132258-4d661d08134e h1:jcDwaL280D5BVGCfcIC3mQCjmwPz5fxX7NO1qf6nAIo=
|
||||
git.hlsq.asia/mmorpg/service-common v0.0.0-20260123132258-4d661d08134e/go.mod h1:mMhZcumphj6gaVTppVYsMTkd+5HupmQgAc53Pd4MH9I=
|
||||
github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
|
||||
github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||
github.com/IBM/sarama v1.46.3 h1:njRsX6jNlnR+ClJ8XmkO+CM4unbrNr/2vB5KK6UA+IE=
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
||||
"go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func InitServeMux() *runtime.ServeMux {
|
||||
@@ -50,13 +49,7 @@ func InitRouter() *gin.Engine {
|
||||
gin.Recovery(),
|
||||
ginLogger(log.GetLogger().Named("GIN")),
|
||||
cors.New(corsConfig()),
|
||||
otelgin.Middleware(
|
||||
common.KeyDiscoverServiceNameGateway,
|
||||
otelgin.WithSpanNameFormatter(func(c *gin.Context) string {
|
||||
method := strings.ToUpper(c.Request.Method)
|
||||
return method + " " + c.Request.URL.Path
|
||||
}),
|
||||
),
|
||||
otelgin.Middleware(common.KeyDiscoverServiceNameGateway),
|
||||
)
|
||||
|
||||
r.HandleMethodNotAllowed = true
|
||||
|
||||
Reference in New Issue
Block a user