3 Star 3 Fork 2

HuaweiCloudDeveloper / huaweicloud-solution-gameflexmatch

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

目录

1. huaweicloud-solution-gameflexmatch

ZH | EN

2. 简介

GameFlexMatch是一个服务托管解决方案,包含五个服务组件(Fleetmanager/AppGateway/AASS/AuxProxy/Console),可以实现应用的托管、托管应用所需资源的弹性伸缩、应用进程的资源调度管理、应用的灰度发布,多region部署时可以实现用户的就近接入,减少时延,以及服务资源的跨地域容灾。可以帮助开发者快速构建稳定、低延时的多人游戏的部署环境,并节省大量的运维成本,支持UnrealUnity引擎,C#C++以及gRPC支持的任何语言的server框架部署和运行,可以帮助你快速构建与管理游戏战斗服集群。

3. 逻辑架构

- 1. huaweicloud-solution-gameflexmatch

GameFlexMatch平台由五个服务组件组成:

  • FleetManager: 负责应用进程的全局化动态部署及管理,支持配置动态部署策略,基于成本或时延优化应用分布,负责弹性伸缩策略的配置和服务端会话、客户端会话与应用包的管理,服务端应用的灰度发布等
  • AppGateway: 负责应用进程、会话与客户端连接的管理,通过与AuxProxy通信获得应用进程信息,决策进程资源的调度
  • AASS: 负责弹性伸缩组和弹性伸缩策略的管理与执行,以及服务端应用资源的监控,实现资源的弹性伸缩,与关键事件的记录
  • AuxProxy: 在扩容出的实例中自动拉起,负责应用进程的创建、进程状态的上报以及应用进程的通信
  • Console: 运维平台,用于监控GameFlexMatch的运行状态,以及运维管理GameFlexMatchfleet、应用包与用户信息等

3.1. 仓库目录

huaweicloud-solution-gameflexmatch
   doc               -- 文档目录
   |-api             -- 管理面API文档
   |- deployment     -- 方案部署操作文档
   |- dev            -- 应用接入开发文档
   |- user-guide     -- 用户操作指南
   |- img            -- 图片相关
   |- version        -- 版本更新记录
   release           -- 部分脚本文件与配置文件
   sdk               -- 应用接入sdk和demo
   tools             -- 脚本工具目录

3.2. 资源规划

  • 部署资源
资源类型 单机部署 分布式集群部署 说明
云服务器ECS 1 7 用于部署GFM前后端服务,若为分布式部署,则3个服务组件“Fleetmanager/AppGateway/AASS”服务组件各2台,前端服务1台
云数据库RDS for Mysql 1 1 用于存储必要的运行数据
云数据库GeminiDB(for Influx) 1 1 用于存储战斗服集群的实时运行数据,以进行弹性伸缩
分布式缓存服务DCS(Redis) 1 1 用于存储缓存数据
弹性负载均衡ELB 0 3 集群部署时需要,实现流量的智能分发

3.3. 云账号资源

需要提前准备一个云账号资源,并服务该账号以下权限:

  1. 弹性云服务器所有权限:ECS FullAccess
  2. 云容器实例所有权限:CCI FullAccess
  3. 统一身份认证服务的只读权限:IAM ReadOnlyAccess
  4. 云监控服务只读权限:CES ReadOnlyAccess
  5. 云解析服务所有权限:DNS FullAccess
  6. 企业项目管理服务只读权限:EPS ReadOnlyAccess
  7. 云硬盘的只读权限:EVS ReadOnlyAccess
  8. 镜像服务所有权限:IMS FullAccess
  9. 对象存储服务管理员:OBS Administrator
  10. 容器镜像仓库所有权限:SWR FullAccess
  11. 虚拟私有云所有权限:VPC FullAccess
  12. EIP服务所有权限:EIP FullAccess
  13. 消息通知服务的所有权限:SMN FullAccess
  14. 云日志服务所有权限:LTS FullAccess

3.4. 涉及云服务

该解决方案与华为云深度耦合,在运行过程中涉及到的云服务与用途如下,为保证可以正常使用该解决方案,请保证使用租户包含下列云服务的必要权限

云服务名称 简称 用途
云服务器 ECS 用于创建管理战斗服集群
云容器实例 CCI 用于创建管理战斗服集群
统一身份认证服务 IAM 用于正常访问云服务的鉴权
云监控服务 CES 用于获取后端服务组件的相关监控信息
云解析服务 DNS 用于创建绑定域名的战斗服集群
企业管理 EPS 用于基于企业项目创建不同的战斗服资源
云硬盘 EVS 用于获取云硬盘信息,存储必要资源
镜像服务 IMS 用于打包应用镜像,快速拉起战斗服集群
对象存储服务 OBS 用于存储应用包信息与日志信息
容器镜像服务 SWR 打包容器镜像
虚拟私有云 VPC 包括安全组、子网等信息等,管理战斗服的网络资源
弹性公网IP EIP 为战斗服绑定公网IP地址
消息通知服务 SMN 当出现事件告警时,通知到运维人员
云日志服务 LTS 采集战斗服的日志信息
弹性伸缩服务 AS 用于弹性伸缩能力实现(已弃用)

3.5. 部署指南

3.5.1. 基于发布的应用包进行部署

应用包目录介绍

/home/gfm
   |- bin                -- 存放服务的二进制文件的目录
      |- fleetmanager   -- fleetmanager服务组件的二进制文件
      |- appgateway     -- appgateway服务组件的二进制文件
      |- aass           -- aass服务组件的启动二进制文件
      |- auxproxy.zip   -- auxproxy服务组件的压缩文件,需上传至OBS中
      |- dist           -- console控制台编译后的文件目录,用于与nginx一起部署前端
         |- assets      -- 前端代码目录
         |- favicon.png 
         |- index.html 
      |- image_env.sh   -- 用于应用自动打包镜像的脚本,需上传至OBS中
      |- docker_image_env.sh -- 用于应用自动打包容器镜像的脚本,需上传至OBS中
   |- conf
      |- init.yaml      -- 用于安装部署GFM的配置文件,基于该配置文件生成各服务组件的配置文件
      |- private.pem    -- RSA加密的私钥,已默认生成一份,在生产环境中使用建议重新生成  
      |- public.pem     -- RSA加密的公钥,已默认生成一份,在生产环境中使用建议重新生成
      |- tls.crt        -- HTTPS网络的签名证书  
      |- tls.csr        -- 同上
      |- tls.key        -- 同上
      |- workflow       -- 用于存放GFM异步创建的配置文件
         |- create_fleet_workflow.json                -- 基于ECS创建fleet
         |- delete_fleet_workflow.json                -- 基于ECS删除fleet
         |- create_fleet_cci_pod_workflow.json        -- 基于CCI创建fleet
         |- delete_fleet_cci_workflow.json            -- 基于CCI删除fleet
         |- create_build_image_workflow.json          -- 基于ECS创建应用镜像包
         |- create_build_docker_image_workflow.json   -- 基于CCI创建应用镜像包
   |- sac-gfm           -- 辅助快速部署的二进制文件

后端服务部署步骤

NOTE:部署过程基于sac-gfm脚本进行,脚本的说明请参考:ZH|EN

  1. 获取二进制应用包并解压
    • 下载并进入目录:wget -P /home --no-check-certificate https://gitee.com/HuaweiCloudDeveloper/huaweicloud-solution-gameflexmatch/releases/download/laster/game-flex-match_release.tar.gz; mkdir -p /home/gfm
    • 解压:tar -zxvf /home/game-flex-match_release.tar.gz -C /home/gfm
    • 进入目录:cd /home/gfm
  2. 修改配置文件
    • 在安装部署时,你可以先了解先各个配置文件的各个参数说明,并根据实际情况进行修改,可以参考:ZH|EN
    • 配置文件在二进制应用包中可以找到: ./conf/init.yaml,你可以根据实际情况修改,你也可以在init.yaml中查看
  3. 安装服务组件
    • FleetManager: 初始化安装:./sac-gfm install --service fleetmanager,该步骤将会自动生成fleetmanager-start.sh启动脚本 启动: ./sac-gfm start --service fleetmanager
    • AppGateway: 初始化安装: ./sac-gfm install --service appgateway,该步骤将会自动生成appgateway-start.sh启动脚本 启动: ./sac-gfm start --service appgateway
    • AASS: 初始化安装: ./sac-gfm install --service aass,该步骤将会自动生成aass-start.sh启动脚本 启动: ./sac-gfm start --service aass
  4. 若你想重启或停止该服务组件,以fleetmanager为例,你可以: ./sac-gfm stop --service fleetmanager ./sac-gfm restart --service fleetmanager

前端服务部署步骤

NOTE: 前端服务已通过npm基于已提供的./conf/public.pem公钥进行编译,若您的公钥有更新,需要重新编译 重新编译请参考编译指导: ZH | EN 以下所有命令基于Centos操作系统,

  1. 安装nginx: yum install -y nginx
  2. 安装前端应用:\cp -r -f /home/gfm/bin/dist/* /usr/share/nginx/html/
  3. 根据下面指导进行修改nginx配置文件: 打开nginx配置文件:vim /etc/nginx/nginx.conf 共有三个地方需要修改
    http {
     ...
     client_max_body_size 6g;   # 1.增加该字段,适配大应用包应用
     ...
     server {
         ... 
         # 2.修改以下IP为后端服务器IP,把 /api 路径下的请求转发给真正的后端服务器
         location /api/ {
             proxy_pass https://{fleetmanager-ip}:31002/;
         }
         # 3.修改该字段,避免刷新后页面不存在的问题
         location / {
             root html;
             try_files $uri /index.html;  # try_files:检查文件; $uri:监测的文件路径; /index.html:文件不存在重定向的新路径
             index index.html;
         }
         ...
     }
  4. 启动nginx,直接执行:nginx
  5. 浏览器输入网址: http://{前端服务器所在IP地址}:80

更新步骤

如果你想从源码进行编译,可以参考以下步骤: ZH|EN

3.6. 使用指南

  • console平台的快速入门详见: ZH|EN
  • console平台的用户指南详见: ZH|EN

3.7. 开发指南

  • 支持GRPC的方式将应用托管到GameFlexMatch,相关接口与接入流程参考ZH|EN
  • 应用托管接入示例可参考sdk目录

3.8. Reference

3.9. 联系我们

若你有任何疑问,请联系:hwcloudsolution@163.com

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

提供专用游戏的服务器托管服务,支持有状态的游戏服务部署和扩缩容,实现服务托管、高效灵活的服务器伸缩和就近调度的能力,帮助开发者快速构建稳定、低延时的多人游戏的部署环境,并节约大量的运维成本,提供gRPC支持的任何语言的服务框架部署与执行 展开 收起
Go 等 5 种语言
Apache-2.0
取消

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/HuaweiCloudDeveloper/huaweicloud-solution-gameflexmatch.git
git@gitee.com:HuaweiCloudDeveloper/huaweicloud-solution-gameflexmatch.git
HuaweiCloudDeveloper
huaweicloud-solution-gameflexmatch
huaweicloud-solution-gameflexmatch
master-dev

搜索帮助