# LY-release ## 目錄 - [流程](#流程) - [異動介紹](#異動介紹) - [專案連結](#專案連結) - [相關排查](#相關排查) - [部署指令](#部署指令) - [後台網址](#後台網址) - [機器](#release機器) - [參考文件](#參考文件) ### 流程 release環境,我們目前的使用也可稱UAT環境,主要是用來作為客戶體驗環境,所以通常會盡量保持跟prod版本接近。 Step: 1. 開發時從package開新分支, 確認無誤後合回package_develop 2. 提測時,先和進個專案release分支, 再部署至release站供qa測試 3. 確認無誤後發MR,和進package分支 ### 異動介紹 * 目前工具區分dev以及release的方式: mysql => 分庫以尾綴加上release做區分 ![image](https://hackmd.io/_uploads/B1ov6MHAa.png) redis & mongo => 獨立啟在一台機器(redis為docker啟動) kafka => 以topic區分 ==數據中心因為報表需求,所以MQ|Redis|Mongo|Es 獨立服務== * 各專案release設定檔 | project | conf_path | | -------- | -------- | | leapy | src/portal/clientapi/settings_zh_release.py | | leapy-core | src/main/settings_zh_release.py | | komoku | biz/conf/server_release.py | | TurboTurtleIngetion | TurboTurtleIngetion/settings_zh_release.py | | TurboTurtleDigestion | TurboTurtleDigestion/settings_zh_release.py | | naming | src/_config/server_release.toml | | games | src/_config/server_release.toml | ### 相關設定排查 * 新增release db_sharding設定(有需要新增一個環境 要記得配置) ```shell= vim /home/ubuntu/apache-shardingsphere-4.1.0-sharding-proxy-bin/conf/config-sharding-lucky-release.yaml ``` * 有使用到ip2region的服務, 新增ip2xdb數據檔(檔案在artemis專案/ip/xdb_maker下) ```path= 機器內路徑 /opt/geodata/ip2region.xdb ``` * nginx設定(ssh 至proxy機器) ```shell= # 到目錄下找到要配置的conf進行配置 cd /etc/nginx/conf.d # 更改後重載nginx sudo nginx -s reload ``` * 遊戲部署或是機器人沒有錢, 生成機器人指令 ```shell= cd /opt/leapy/enabled/app; /home/ubuntu/.pyenv/versions/casino3.7/bin/python manage.py generate_robot --robot_idx={{game}} --robot_cnt=100 --low_credit=5000 --high_credit=24990 /home/ubuntu/.pyenv/versions/casino3.7/bin/python manage.py generate_robot --robot_idx={{game}} --robot_cnt=100 --low_credit=25000 --high_credit=49990 /home/ubuntu/.pyenv/versions/casino3.7/bin/python manage.py generate_robot --robot_idx={{game}} --robot_cnt=100 --low_credit=50000 --high_credit=99990 /home/ubuntu/.pyenv/versions/casino3.7/bin/python manage.py generate_robot --robot_idx={{game}} --robot_cnt=100 --low_credit=100000 --high_credit=1000000 ``` * 查看數據中心kafka是否收到filebeat來的消息 > /opt/kafka_2.13-2.5.0/bin/kafka-console-consumer.sh --bootstrap-server=localhost:9092 --topic blackgold :spiral_note_pad: filebeat來源為log各專案下的maestro ![image](https://hackmd.io/_uploads/S1fY8Je06.png) #### 導向圖 ``` mermaid graph TD; proxy_old-->leapy,leapy-core,komoku-->log proxy_new-->game_server,naming-->log log-->filebeat-->kafka-->data-center ``` ### 部署指令 **fab1為舊版本 僅支援 python2.5~2.7** ``` python 2.7 Fabric 1.15.0 api 0.0.7 arrow 0.17.0 ``` **fab2為新版本** ``` python 3.9 fabric 2.5.0 colorama 0.4.1 invoke 1.3.0 ``` **補充** fab3是基於fab1改的非官方版本,已經不再維護,不推薦使用 * game_server ```shell= fab1 -H {{TARGET_HOST}} deploy -u {{User}} --set stage={{stage}} ``` * leapy|leapy-core|komoku ```shell= fab -H {{TARGET_HOST}} deploy --env {{STAGE}} ``` * naming ```shell= fab1 deploy -u {{User}} --set docker=false,stage={{STAGE}} ``` * 數據平台 ```shell= fab --search-root ./deploy --hosts $(TARGET_HOST) deploy --setting {{STAGE}} ``` ### 相關網址 [商戶後台](http://mch-admin.test_web2.hjdz668.com/#/login) [運營後台](http://mch-manager.test_web2.hjdz668.com/#/dashboard) [數據平台](http://data-analysis.release_web.hjdz668.com/#/) [遊戲客戶端](https://cocos2.gou-love.com/h5/demo_33/?chn=h-test-release-def) [客戶端對接port](https://docs.google.com/document/d/1LM2PTGxx9t4zScXruq6MUbV7qoWQZxbGUBHVmNmy2sg/edit) [配置中心](http://3.1.171.240:9002/#/login) ### release機器 * nginx機器(dev和release共用, 以conf名稱做區分) ==目前規劃 => 遊戲統一使用新的proxy, 大廳等服務維持不變== | Host | HostName | Port | | -------- | -------- | -------- | | proxy_old | 13.251.70.125 | 22022 | | proxy_new | 13.214.32.157 | 22022 | * 大廳,遊戲等服務 | Host | HostName | Port | | -------- | -------- | -------- | | main_server | 16.163.127.186 | 22022 | | whisper | 43.198.205.221 | 22022 | * 數據平台 | Host | HostName | Port | | -------- | -------- | -------- | | data-center | 13.214.216.51 | | * redis & mongo & mysql | Host | HostName | Port | 備註 | | -------- | -------- | -------- |---------| | release-tools | 43.198.99.204 | |外部連線: 172.31.23.58| | db_sharding |18.162.52.248 | 22022 | 測試站db | * 商戶中心 | Host | HostName | Port | | -------- | -------- | -------- | | mch-center | 13.229.139.85 | 22202 | * JP & UA | Host | HostName | Port | | -------- | -------- | -------- | | jp-ua | 18.138.102.107 | 22202 | ### 專案連結 * 遊戲 :link:: [炸金花](http://code.xasxly.com/server/golden_flower/-/tree/leapy-release) [血拼牛牛](http://code.xasxly.com/server/blood/-/tree/leapy-release) [百人牛牛](http://code.xasxly.com/server/cube/-/tree/leapy-release) [二八槓](http://code.xasxly.com/server/fight/-/tree/leapy-release) [搶莊牛牛](http://code.xasxly.com/server/cattle/-/tree/leapy-release) [鬥地主](http://code.xasxly.com/server/lord/-/tree/leapy-release) * 包網 :link: [leapy](http://code.xasxly.com/server/leapy/-/tree/leapy-release) [leapy-core](http://code.xasxly.com/server/leapy-core/-/tree/package_develop) [komoku](http://code.xasxly.com/ELEVEN/komoku/-/tree/package_develop) [naming](http://code.xasxly.com/server/naming/-/tree/leapy_release) [數據平台ingest](http://code.xasxly.com/olap-server/TurboTurtleIngestion/-/tree/feat/add-release) [數據平台digest](http://code.xasxly.com/olap-server/TurboTurtleDigestion/-/tree/feat/add_release) ### 參考文件 [Apache ShardingSphere](https://shardingsphere.apache.org/document/current/cn/overview/) [python fabric](https://www.fabfile.org/installing.html) ### 後續 proxy整合