-
Notifications
You must be signed in to change notification settings - Fork 129
Home
(Working 20160304) ##CloudBread Project developer guide In this wiki, we will discuss about CloudBread project install and developer usage guide. This document include below chapters
###Getting Started Guide ####1. Register Azure CloudBread is developing on Microsoft Azure Cloud Platform especially, leveraging PaaS based services. To deploy CloudBread on cloud, register free Microsoft Azure subscription in this link - https://azure.microsoft.com/en-us/free/ There're more free options to use Azure - Visual Studio subscriber, Startup - BizSpark, Academic - DreamSpark.
####2. CloudBread ARM To deploy on Azure, CloudBread is using ARM - Azure Resource Manager, please, visit official CloudBread-ARM project and follow the deploy instructions. For more information about ARM, visit Azure Resource Manager link.
####3. Set up Database After ARM deploy task, you should set up SQL database. This task include creating database objects such as tables, constraints and stored procedures. To set up SQL database, visit official CloudBread-DB-Install-Script project and follow set up SQL database instructions. For more information about Azure SQL Database, visit Azure SQL Database link.
####4. CloudBread deploy from Github To deploy CloudBread project on Azure Mobile App service, we recommend to using Github deploy method.
- 4.1 In Github, Fork latest CloudBread project stable branch to you Github repository.
- 4.2 Logon to Microsoft Azure portal website
- 4.3 Go to your deployed Resource Group, open Mobile App(CloudBread frontend API service)
- 4.4 Go to Settings, Continuous deployment. Click Choose Source, then click Github Repository, and then click OK.
- 4.5 If you're first time to using Azure repository, might need to create repository login credential.
- 4.6 Choose your Github forked CloudBread repository.
- 4.7 It's automatically start deployment task.
For more information, please reference Deploy your app to Azure App Service and Continuous deployment using GIT in Azure App Service
####5. CloudBread configuration - web.config file configuration I CloudBread, all of service specific configuration values are located at web.config with default values. To connect on Azure SQL Database, Azure table storage and Redis cache, you should configure this web.config file. For the development purpose, I recommend to set the connectionString values in web.config. If you're using connectionString setting on Azure app service, the Azure app service will override connectionString values setting in production.
- 5.1 Logon to Microsoft Azure portal website
- 5.2 Choose your Resource Group, Azure SQL Database, Connection strings and copy the ADO.NET connection string.
- 5.3 Paste the connection string to web.config file CloudBreadDBConString section. The code must be looks like this.
<add name="CloudBreadDBConString" connectionString="Server=tcp:yourservername.database.windows.net,1433;Database=yourdatabasename;User ID=yourloginid@yourservername;Password=yourpassword;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />
- 5.4 In the Azure portal, in the Resource Group choose your Storage Account - setting - Access Keys and then copy Connection strings of KEY1.
- 5.5 Paste the storage account connection string to web.config file CloudBreadStorageConString section. The code must be looks like this.
<add name="CloudBreadStorageConString" connectionString="DefaultEndpointsProtocol=https;AccountName=yourstorageaccountname;AccountKey=youraccountkey;BlobEndpoint=https://yourstorageaccountname.blob.core.windows.net/;TableEndpoint=https://yourstorageaccountname.table.core.windows.net/;QueueEndpoint=https://yourstorageaccountname.queue.core.windows.net/;FileEndpoint=https://yourstorageaccountname.file.core.windows.net/" />
- 5.5 Adding Redis connection string Go to your depoyed redis cache and click Show Access Keys on Azure Management Portal and copy your "Primary connection string" and paste it on web.config file this section.
<add key="CloudBreadSocketRedisServer" value="yourserver.redis.cache.windows.net:6380,password=yourserverpassword,ssl=True,abortConnect=False"></add>
<add key="CloudBreadRankRedisServer" value="yourserver.redis.cache.windows.net:6380,password=yourserverpassword,ssl=True,abortConnect=False"></add>
<add key="CloudBreadGameLogRedisServer" value="yourserver.redis.cache.windows.net:6380,password=yourserverpassword,ssl=True,abortConnect=False"></add>
- 5.7 Download and install Postman app.
- 5.8 Download(or open cloned local repository) Postman collection file from your Github forked CloudBread repository Tools folder. Open the json file in editor and change all *"url": * to your CloudBread mobile app service URL. In Postman app, Import your edited collection file.
- 5.9 In Postman app, execute 00-ping GET request API. The response must be "Hello". To test the database connection, execute CBSelNotices POST request API.
###CloudBread - "Actor Behavior" ####What is Actor Behavior? CloudBread is using Behavior concept to implement game server engine. To build business logic list to implement game server engine, project team generalized game actor's behaviors and made the behaviors list. CloudBread Engine is implementation of these behaviors and easily add/modify behaviors as framework basis. ####CloudBread Behavior list and description To check out, visit the CloudBread behavior list wiki page, please.
###CloudBread API developer usage ####How to call CloudBread API in test or development environment? For the developer test, CloudBread is using Postman app, described this page 5.7 section. If you're already installed somestring-CloudBreadDB-testdata-insert.sql script as part of CloudBread-DB-Install-Script project, you can test on Postman app, right away. ####CloudBread Client developer project In client game development environment, you can maximize with CloudBread official developer test app.
- Unity3D - visit official CloudBread Client Unity and follow installation instructions.
- (TODO)iOS - visit official CloudBread Client iOS and follow installation instructions.
- (TODO)Android - visit official CloudBread Client Android and follow installation instructions.
- (TODO)UWP-Universal Windows Platform - visit official CloudBread Client UWP and follow installation instructions.
###Authentication provider login(Facebook, Twitter, Microsoft ID, Google ID, Azure Active Directory) ####How to set up Authentication provider login? Azure Mobile App is already set up the Authentication provider login environment. By default, you can set Facebook, Twitter, Microsoft ID and Google ID provider for your mobile game and mobile app. ####How to Register mobile game app on Authentication provider? Please, visit this link for Facebook, [Twitter](How to configure your App Service application to use Twitter login), Microsoft ID, Google ID and Azure Active Directory. After you set up the authentication on Azure Web App, all request should use Azure Mobile App Client SDK or call with x-zumo-auth in HTTP Request Header.
- For the developer test, CloudBread is using Postman app.
- To test the Authentication provider enabled API call in Postman, you must generate the x-zumo-auth request header value.
- You can generate this value by yourself.
- To generated the x-zumo-auth key you should use mobile device environment. Because, Azure Mobile App SDK is built for mobile device execution.
- After generated the x-zumo-auth key, replace all x-zumo-auth request header values in Postman collection file on API call dev & testing time.
- If you're using Microsoft Windows 8.x or Windows 10 for development system, visit official CloudBread-Dev-Authkey-Gen-win8.1 and follow installation instructions.
- If you're using Mac OS for development system, visit official CloudBread-Dev-Authkey-Gen-Android and follow install instructions.
For more information, visit Authentication and Authorization in Azure Mobile Apps link, please.
###CloudBread API reference
- Please, visit official API reference page - http://cloudbreadproject.github.io
###Cloud service architecture
- CloudBread is built on full PaaS architecture
###Database design
- Please, visit CloudBread database design page. - CloudBread database design
###CloudBread Socket - "Real-time Communication" ####What is CloudBread Socket project This project is designed for CloudBread mobile game & app server engine to implement real-time bidirectional communication.
- CloudBread Socket project Live Demo link This Live Demo is built on React web framework. In client game development environment, you can reference the source code with CloudBread official developer test app.
- Please, visit CloudBread Socket project implementation guide page
###CloudBread Admin website CloudBread is support built-in Admin website to manage your game server data in various way. To deploy CloudBread project on Azure Web App service, we recommend to using Github deploy method. This task is identically same with CloudBread not Azure Mobile App Service but Azure Azure Web App Service.
- In Github, Fork latest CloudBread-Admin-Web project stable branch to you Github repository.
- Logon to Microsoft Azure portal website
- Go to your deployed Resource Group, open Web App(CloudBread Admin website service)
- Go to Settings, Continuous deployment. Click Choose Source, then click Github Repository, and then click OK.
- If you're first time to using Azure repository, might need to create repository login credential.
- Choose your Github forked CloudBread-Admin-Web repository.
- It's automatically start deployment task.
For more information, please reference Deploy your app to Azure App Service and Continuous deployment using GIT in Azure App Service
(TODO)- Admin website usage
###Redis on CloudBread CloudBread is using Redis cahce service in leader board, in-game massive log queue storage, socket server authentication and (TODO) output Azure SQL Database data cache.
- Leader board(Ranking) service API does give you control basic rank module with GetMemberRankbyMeberID, GetRangeRankerInfo and GetTopXRanker API by default
- To store in-game masstive log queue storage, Azure Table Storage(CloudBread default setting) is not a best idea. In this project saveRedisLog function does it with logger object. (TODO) These redis log will be processed by scheduler services(Azure WebJobs).
- To implement socket server authentication, CloudBread issue token and save on Redis. Socket server validating this token for socket user.
- (TODO) Working on output Azure SQL Database data cache
###CloudBread scheduler In this project is built for scheduled batch process of game server task. To deploy on Azure, visit official CloudBread-Scheduler and follow the deploy instructions.
- CloudBread Scheduler service is built on Azure Webjobs.
- Implemented by Timer trigger of Azure Webjob extension - https://github.com/Azure/azure-webjobs-sdk-extensions
- The Timer Trigger put a message on Azure Queue Storage.
- Azure Webjob GetMessage from Azure Queue Storage by Queue Trigger and process the described batch task.
- By default, CloudBread produce DAU, HAU and DARPU statistics data.
- For more information, check this Azure Webjob Repo - https://github.com/Azure/azure-webjobs-sdk.
###CloudBread system monitoring ####General monitoring
- Monitor service metrics https://azure.microsoft.com/en-us/documentation/articles/insights-how-to-customize-monitoring/
- View events and audit logs https://azure.microsoft.com/en-us/documentation/articles/insights-debugging-with-events/
- Monitor availability and responsiveness of any web site https://azure.microsoft.com/en-us/documentation/articles/app-insights-monitor-web-app-availability/
- Receive alert notifications https://azure.microsoft.com/en-us/documentation/articles/insights-receive-alert-notifications/
####App Service
####SQL Database
- Troubleshoot, diagnose, and prevent SQL connection errors and transient errors for SQL Database
- Monitoring Azure SQL Database using dynamic management views
- TODO
###CloudBread system logging
- (TODO)
###CloudBread service performance scaling CloudBread is built on full PaaS base cloud environment and developed as stateless application. You can easily scale the CloudBread services with below articles.
- Azure App Service: Scaling App Service Applications
- Scale pricing tier in Azure App Service
- Scale instance count manually or automatically
- Azure SQL Database performance guidance for single databases
- Change the service tier and performance level (pricing tier) of a SQL database
- (TODO)Elastic Database with Azure SQL
- Monitor a storage account in the Azure Portal
- Enabling Azure Storage metrics and viewing metrics data
- Monitor, diagnose, and troubleshoot Microsoft Azure Storage
###CloudBread troubleshooting
- (TODO)
- Monitor, diagnose, and troubleshoot Microsoft Azure Storage
- End-to-End Troubleshooting using Azure Storage Metrics and Logging, AzCopy, and Message Analyzer
###Build CloudBread staging environment
###FAQ
-
What is extra column sCol1~10? This columns're room for extra data storage for more complex data handling game purpose and could be utilize as JSON text store. Do not store data as seek target column or SQL where condition.
-
Why all table column is string type - nvarchar? CloudBread v1 was developed in ASDB v11 which did not support SQL TDE(supported in V12) or CLR encryption. Only way to encrypt data as AES encryption was do it on application side. That's the reason why every column type is nvarchar. In CloudBread v2, will sustain the table architecture for the data maintenance, without any change. Planing CloudBread v3, team will consider table schema change.
-
Why can't use leader board(ranking) in data encrypt mode as SQL aggreate way When set the data encrypt mode, all application data saved as encrypted from application side. Game point, used for rank compare, also encrypted as string in table. It means, you can't manipulate with SQL aggrecate function or ordering for ranking function. You must decrypt all point data and then execute ordering or agregate function. In CloudBread v2 support both SQL aggreate way and redis way. in data encrypt mode, you should implement Redis way.
-
INSERT or UPDATE? CloudBread is using 1-to-many database logical design. For example, member : memberitem table is 1 : many style. It's piece of cake to implement UPSERT query. But, data encrypt mode could not check the count number of item in SQL Query. Because count number is also encrypted in table and CloudBread v1(no support CLR in ASDB V11. ASDB V12 support TDE). Planing CloudBread v3, team will consider table schema change.
-
Why all datetime is UTC datetime? In cloud based application, UTC is recommended. Please, review this article. Manage TimeZone for Applications