diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..455f67f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +DemoUnity/ +web-server/ +node_modules \ No newline at end of file diff --git a/DemoUnity/Assets/Scripts/LoginGUI.cs b/DemoUnity/Assets/Scripts/LoginGUI.cs index e7036f8..8a351d5 100644 --- a/DemoUnity/Assets/Scripts/LoginGUI.cs +++ b/DemoUnity/Assets/Scripts/LoginGUI.cs @@ -124,7 +124,7 @@ public class LoginGUI : MonoBehaviour { public void Login() { - string host = "192.168.100.173"; + string host = "127.0.0.1"; int port = 3999; // if (pc != null) // { diff --git a/DemoUnity/UserSettings/Layouts/default-2021.dwlt b/DemoUnity/UserSettings/Layouts/default-2021.dwlt index effdc72..a7b667c 100644 --- a/DemoUnity/UserSettings/Layouts/default-2021.dwlt +++ b/DemoUnity/UserSettings/Layouts/default-2021.dwlt @@ -68,8 +68,8 @@ MonoBehaviour: y: 0 width: 340 height: 751 - m_MinSize: {x: 276, y: 71} - m_MaxSize: {x: 4001, y: 4021} + m_MinSize: {x: 275, y: 50} + m_MaxSize: {x: 4000, y: 4000} m_ActualView: {fileID: 13} m_Panes: - {fileID: 13} @@ -94,8 +94,8 @@ MonoBehaviour: y: 0 width: 272 height: 445.5 - m_MinSize: {x: 201, y: 221} - m_MaxSize: {x: 4001, y: 4021} + m_MinSize: {x: 200, y: 200} + m_MaxSize: {x: 4000, y: 4000} m_ActualView: {fileID: 14} m_Panes: - {fileID: 14} @@ -120,8 +120,8 @@ MonoBehaviour: y: 445.5 width: 1100 height: 305.5 - m_MinSize: {x: 101, y: 121} - m_MaxSize: {x: 4001, y: 4021} + m_MinSize: {x: 100, y: 100} + m_MaxSize: {x: 4000, y: 4000} m_ActualView: {fileID: 17} m_Panes: - {fileID: 12} @@ -268,8 +268,8 @@ MonoBehaviour: y: 0 width: 828 height: 445.5 - m_MinSize: {x: 202, y: 221} - m_MaxSize: {x: 4002, y: 4021} + m_MinSize: {x: 200, y: 200} + m_MaxSize: {x: 4000, y: 4000} m_ActualView: {fileID: 16} m_Panes: - {fileID: 15} @@ -292,7 +292,7 @@ MonoBehaviour: m_MaxSize: {x: 10000, y: 10000} m_TitleContent: m_Text: Project - m_Image: {fileID: -5467254957812901981, guid: 0000000000000000d000000000000000, + m_Image: {fileID: -5179483145760003458, guid: 0000000000000000d000000000000000, type: 0} m_Tooltip: m_Pos: @@ -333,7 +333,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 7} m_SelectedIDs: 38710000 m_LastClickedID: 28984 - m_ExpandedIDs: 0000000006710000ffffff7f + m_ExpandedIDs: 0000000006710000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -475,7 +475,7 @@ MonoBehaviour: m_MaxSize: {x: 4000, y: 4000} m_TitleContent: m_Text: Hierarchy - m_Image: {fileID: 7966133145522015247, guid: 0000000000000000d000000000000000, + m_Image: {fileID: -3734745235275155857, guid: 0000000000000000d000000000000000, type: 0} m_Tooltip: m_Pos: @@ -491,9 +491,9 @@ MonoBehaviour: m_SceneHierarchy: m_TreeViewState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: - m_LastClickedID: 0 - m_ExpandedIDs: 10fbfffff4ffffff + m_SelectedIDs: 6a6e0000 + m_LastClickedID: 28266 + m_ExpandedIDs: 0efbffff m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -533,7 +533,7 @@ MonoBehaviour: m_MaxSize: {x: 4000, y: 4000} m_TitleContent: m_Text: Scene - m_Image: {fileID: 2593428753322112591, guid: 0000000000000000d000000000000000, + m_Image: {fileID: 8634526014445323508, guid: 0000000000000000d000000000000000, type: 0} m_Tooltip: m_Pos: @@ -872,7 +872,7 @@ MonoBehaviour: m_MaxSize: {x: 4000, y: 4000} m_TitleContent: m_Text: Game - m_Image: {fileID: -6423792434712278376, guid: 0000000000000000d000000000000000, + m_Image: {fileID: 4621777727084837110, guid: 0000000000000000d000000000000000, type: 0} m_Tooltip: m_Pos: @@ -965,7 +965,7 @@ MonoBehaviour: m_MaxSize: {x: 4000, y: 4000} m_TitleContent: m_Text: Console - m_Image: {fileID: -4327648978806127646, guid: 0000000000000000d000000000000000, + m_Image: {fileID: -4950941429401207979, guid: 0000000000000000d000000000000000, type: 0} m_Tooltip: m_Pos: diff --git a/Dockerfile b/Dockerfile index 7e13b20..4e92596 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get update && apt-get install -y sysstat curl RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - RUN apt-get install -y nodejs RUN mkdir -p /works/jc/r2 -COPY . /works/jc/r2 -RUN npm install +COPY game-server /works/jc/r2/game-server +COPY shared /works/jc/r2/shared +# RUN npm install CMD npm run start diff --git a/deployment.yaml b/deployment.yaml index ef45dd9..dbf6329 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -13,16 +13,19 @@ spec: spec: containers: - name: r2server - image: localhost:5550/r2server:v1 + image: lsmbp.local:5550/r2server:v5 imagePullPolicy: IfNotPresent resources: limits: - memory: "256Mi" - cpu: "500m" + memory: "1024Mi" + cpu: "1000m" ports: - containerPort: 3999 + hostPort: 3999 - containerPort: 3010 + hostPort: 3010 - containerPort: 3011 + hostPort: 3011 --- apiVersion: v1 kind: Service @@ -34,6 +37,7 @@ spec: ports: - port: 3999 targetPort: 3999 + protocol: TCP --- apiVersion: v1 kind: Service @@ -45,6 +49,7 @@ spec: ports: - port: 3010 targetPort: 3010 + protocol: TCP --- apiVersion: v1 kind: Service @@ -56,4 +61,13 @@ spec: ports: - port: 3011 targetPort: 3011 + protocol: TCP +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: r2server-service-gate-config + namespace: default +data: + 3999: "r2server-service-gate:3999" \ No newline at end of file diff --git a/game-server/app/servers/connector/handler/entryHandler.js b/game-server/app/servers/connector/handler/entryHandler.js index ef7df6d..fadf839 100644 --- a/game-server/app/servers/connector/handler/entryHandler.js +++ b/game-server/app/servers/connector/handler/entryHandler.js @@ -21,7 +21,9 @@ Handler.prototype.entry = function(msg, session, next) { const uid = msg.uid; const sessionService = this.app.get('sessionService'); const serverId = this.app.serverId; + console.log(`-------entry ${session.id} : ${uid}`); + // 重复登录检查 // if( !! sessionService.getByUid(uid)) { // console.log(`-------kick ${session.id} : ${uid}`) @@ -43,6 +45,7 @@ Handler.prototype.entry = function(msg, session, next) { session.on('closed', onUserLeave.bind(null, this.app)); session.pushAll((err)=> { if (err) { + logger.error('error: %j', err.stack); next(null, { code: 500, error: true }); return; diff --git a/game-server/config/servers.json b/game-server/config/servers.json index 0fd1c26..8730701 100644 --- a/game-server/config/servers.json +++ b/game-server/config/servers.json @@ -1,8 +1,8 @@ { "development":{ "connector": [ - {"id": "connector-server-0", "host": "127.0.0.1", "port": 3150, "clientHost": "0.0.0.0", "clientPort": 3010, "frontend": true}, - {"id": "connector-server-1", "host": "127.0.0.1", "port": 3151, "clientHost": "0.0.0.0", "clientPort": 3011, "frontend": true} + {"id": "connector-server-0", "host": "127.0.0.1", "port": 3150, "clientHost": "0.0.0.0", "proxyHost": "localhost", "clientPort": 3010, "frontend": true}, + {"id": "connector-server-1", "host": "127.0.0.1", "port": 3151, "clientHost": "0.0.0.0", "proxyHost": "localhost", "clientPort": 3011, "frontend": true} ], "guild": [ {"id": "guild-server-0", "host": "127.0.0.1", "port": 3200},