feat user服部署
This commit is contained in:
@@ -8,7 +8,7 @@ set GOARCH=amd64
|
|||||||
echo [INFO] Build started...
|
echo [INFO] Build started...
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
for %%p in (gateway scene) do (
|
for %%p in (gateway scene user) do (
|
||||||
echo [BUILD] server-%%p...
|
echo [BUILD] server-%%p...
|
||||||
cd %%p
|
cd %%p
|
||||||
go build -o server-%%p
|
go build -o server-%%p
|
||||||
|
|||||||
@@ -15,5 +15,11 @@ xcopy ..\..\..\Server\scene\Dockerfile scene\ >nul
|
|||||||
move ..\..\..\Server\server-scene scene\ >nul
|
move ..\..\..\Server\server-scene scene\ >nul
|
||||||
echo [INFO] Copy scene finished.
|
echo [INFO] Copy scene finished.
|
||||||
|
|
||||||
|
rd /s /q user
|
||||||
|
xcopy ..\..\..\Server\user\config\config.prod.yaml user\config\ >nul
|
||||||
|
xcopy ..\..\..\Server\user\Dockerfile user\ >nul
|
||||||
|
move ..\..\..\Server\server-user user\ >nul
|
||||||
|
echo [INFO] Copy user finished.
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
pause
|
pause
|
||||||
7
Public/Publish/Server/run_user.sh
Normal file
7
Public/Publish/Server/run_user.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
docker stop server-user
|
||||||
|
docker rm server-user
|
||||||
|
docker rmi server-user:latest
|
||||||
|
|
||||||
|
docker build -f ./user/Dockerfile . -t server-user
|
||||||
|
docker run -d --name server-user -p 8602:8602 --privileged=true --env XH_G_ENV=prod -v /root/server/logs/user_log/:/app/logs server-user
|
||||||
11
Public/Publish/Server/user/Dockerfile
Normal file
11
Public/Publish/Server/user/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
RUN apk add --no-cache tzdata && \
|
||||||
|
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
||||||
|
echo "Asia/Shanghai" > /etc/timezone
|
||||||
|
|
||||||
|
COPY user/ /app/
|
||||||
|
RUN chmod 777 /app/server-user
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
CMD ["./server-user"]
|
||||||
27
Public/Publish/Server/user/config/config.prod.yaml
Normal file
27
Public/Publish/Server/user/config/config.prod.yaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
app:
|
||||||
|
name: "user-prod"
|
||||||
|
|
||||||
|
log:
|
||||||
|
debug: false
|
||||||
|
level: "debug"
|
||||||
|
maxSize: 10
|
||||||
|
maxBackups: 100
|
||||||
|
maxAge: 7
|
||||||
|
|
||||||
|
db:
|
||||||
|
etcd:
|
||||||
|
endpoints: [ "172.18.28.0:2379" ]
|
||||||
|
mysql:
|
||||||
|
user_db:
|
||||||
|
dsn: "root:gR9pV4tY7zR6qL3e@tcp(172.18.28.0:3306)/user_db?charset=utf8mb4&parseTime=True&loc=Local"
|
||||||
|
maxOpenConn: 50
|
||||||
|
maxIdleConn: 20
|
||||||
|
connMaxLifetimeSec: 600
|
||||||
|
connMaxIdleTimeSec: 180
|
||||||
|
logLevel: "warn"
|
||||||
|
|
||||||
|
serve:
|
||||||
|
grpc:
|
||||||
|
address: "172.18.28.0"
|
||||||
|
port: 8602
|
||||||
|
ttl: 20
|
||||||
@@ -3,4 +3,4 @@ docker compose -p tool -f docker-compose-tool.yml up -d
|
|||||||
|
|
||||||
chown -R 1000:1000 jenkins/
|
chown -R 1000:1000 jenkins/
|
||||||
|
|
||||||
ssh -L 2379:localhost:2379 root@47.108.184.184
|
ssh -L 2379:localhost:2379 root@47.108.184.184 yT1vU8fH5mP0rQ6h
|
||||||
@@ -29,3 +29,5 @@ services:
|
|||||||
- "2379:2379"
|
- "2379:2379"
|
||||||
environment:
|
environment:
|
||||||
ALLOW_NONE_AUTHENTICATION: "yes"
|
ALLOW_NONE_AUTHENTICATION: "yes"
|
||||||
|
ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"
|
||||||
|
ETCD_ADVERTISE_CLIENT_URLS: "http://0.0.0.0:2379"
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ type EtcdConfig struct {
|
|||||||
|
|
||||||
type MySQLConfig struct {
|
type MySQLConfig struct {
|
||||||
Dsn string `yaml:"dsn"`
|
Dsn string `yaml:"dsn"`
|
||||||
MaxOpenConn int32 `yaml:"max_open_conn"`
|
MaxOpenConn int32 `yaml:"maxOpenConn"`
|
||||||
MaxIdleConn int32 `yaml:"max_idle_conn"`
|
MaxIdleConn int32 `yaml:"maxIdleConn"`
|
||||||
ConnMaxLifetimeSec int32 `yaml:"conn_max_lifetime_sec"`
|
ConnMaxLifetimeSec int32 `yaml:"connMaxLifetimeSec"`
|
||||||
ConnMaxIdleTimeSec int32 `yaml:"conn_max_idle_time_sec"`
|
ConnMaxIdleTimeSec int32 `yaml:"connMaxIdleTimeSec"`
|
||||||
LogLevel string `yaml:"log_level"`
|
LogLevel string `yaml:"logLevel"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServeConfig struct {
|
type ServeConfig struct {
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ db:
|
|||||||
|
|
||||||
serve:
|
serve:
|
||||||
grpc:
|
grpc:
|
||||||
address: "127.0.0.1"
|
address: "10.0.40.199"
|
||||||
port: 8500
|
port: 8500
|
||||||
ttl: 20
|
ttl: 20
|
||||||
socket:
|
socket:
|
||||||
web:
|
web:
|
||||||
address: "127.0.0.1"
|
address: "0.0.0.0"
|
||||||
port: 8501
|
port: 8501
|
||||||
raw:
|
raw:
|
||||||
address: "127.0.0.1"
|
address: "0.0.0.0"
|
||||||
port: 8502
|
port: 8502
|
||||||
http:
|
http:
|
||||||
address: "127.0.0.1"
|
address: "0.0.0.0"
|
||||||
port: 8503
|
port: 8503
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ serve:
|
|||||||
ttl: 20
|
ttl: 20
|
||||||
socket:
|
socket:
|
||||||
web:
|
web:
|
||||||
address: "127.0.0.1"
|
address: "0.0.0.0"
|
||||||
port: 8501
|
port: 8501
|
||||||
raw:
|
raw:
|
||||||
address: "127.0.0.1"
|
address: "0.0.0.0"
|
||||||
port: 8502
|
port: 8502
|
||||||
http:
|
http:
|
||||||
address: "127.0.0.1"
|
address: "0.0.0.0"
|
||||||
port: 8503
|
port: 8503
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ func ErrorHandler(_ context.Context, _ *runtime.ServeMux, _ runtime.Marshaler, w
|
|||||||
code = http_resp.Failed.Code()
|
code = http_resp.Failed.Code()
|
||||||
msg = http_resp.Failed.Error()
|
msg = http_resp.Failed.Error()
|
||||||
}
|
}
|
||||||
if st.Code() == codes.Unknown {
|
if st.Code() == codes.Unknown || st.Code() == codes.Unimplemented {
|
||||||
msg = st.Message()
|
msg = st.Message()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,6 +47,8 @@ func grpcCodeToHTTPCode(c codes.Code) int {
|
|||||||
switch c {
|
switch c {
|
||||||
case codes.OK, codes.Unknown:
|
case codes.OK, codes.Unknown:
|
||||||
return http.StatusOK
|
return http.StatusOK
|
||||||
|
case codes.Unimplemented:
|
||||||
|
return http.StatusNotFound
|
||||||
default:
|
default:
|
||||||
return http.StatusInternalServerError
|
return http.StatusInternalServerError
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ db:
|
|||||||
|
|
||||||
serve:
|
serve:
|
||||||
grpc:
|
grpc:
|
||||||
address: "127.0.0.1"
|
address: "10.0.40.199"
|
||||||
port: 8601
|
port: 8601
|
||||||
ttl: 20
|
ttl: 20
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ db:
|
|||||||
mysql:
|
mysql:
|
||||||
user_db:
|
user_db:
|
||||||
dsn: "root:gR9pV4tY7zR6qL3e@tcp(47.108.184.184:3306)/user_db?charset=utf8mb4&parseTime=True&loc=Local"
|
dsn: "root:gR9pV4tY7zR6qL3e@tcp(47.108.184.184:3306)/user_db?charset=utf8mb4&parseTime=True&loc=Local"
|
||||||
max_open_conn: 50
|
maxOpenConn: 50
|
||||||
max_idle_conn: 20
|
maxIdleConn: 20
|
||||||
conn_max_lifetime_sec: 600
|
connMaxLifetimeSec: 600
|
||||||
conn_max_idle_time_sec: 180
|
connMaxIdleTimeSec: 180
|
||||||
log_level: "warn"
|
logLevel: "warn"
|
||||||
|
|
||||||
serve:
|
serve:
|
||||||
grpc:
|
grpc:
|
||||||
address: "127.0.0.1"
|
address: "10.0.40.199"
|
||||||
port: 8602
|
port: 8602
|
||||||
ttl: 20
|
ttl: 20
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ db:
|
|||||||
endpoints: [ "172.18.28.0:2379" ]
|
endpoints: [ "172.18.28.0:2379" ]
|
||||||
mysql:
|
mysql:
|
||||||
user_db:
|
user_db:
|
||||||
dsn: "root:gR9pV4tY7zR6qL3e@tcp(47.108.184.184:3306)/user_db?charset=utf8mb4&parseTime=True&loc=Local"
|
dsn: "root:gR9pV4tY7zR6qL3e@tcp(172.18.28.0:3306)/user_db?charset=utf8mb4&parseTime=True&loc=Local"
|
||||||
max_open_conn: 50
|
maxOpenConn: 50
|
||||||
max_idle_conn: 20
|
maxIdleConn: 20
|
||||||
conn_max_lifetime_sec: 600
|
connMaxLifetimeSec: 600
|
||||||
conn_max_idle_time_sec: 180
|
connMaxIdleTimeSec: 180
|
||||||
log_level: "warn"
|
logLevel: "warn"
|
||||||
|
|
||||||
serve:
|
serve:
|
||||||
grpc:
|
grpc:
|
||||||
|
|||||||
Reference in New Issue
Block a user