Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Cloud Development Deploy Egret games


May 27, 2021 Web Cloud Development and Web Hosting Learning Guide


Table of contents


Cloud development static hosting is the ability to host static websites provided by cloud development, and the distribution of static resources (HTML, CSS, JavaScript, fonts, etc.) is supported by Tencent Cloud Object Storage COS and Tencent Cloud CDN with multiple edge outlets.

Using cloud development static hosting can help the game easily carry the traffic peak, so that the business runs smoothly, at the same time, you can access the SDK of cloud development in Egret, database, function, storage and other links also moved to cloud development, so that the entire business does not collapse.

Initialize the project

First, you need to initialize a project with Egret Launcher, which is no longer covered by the installation of Egret Launcher.

Open Egret Launcher to create a new Egret game project

Cloud Development Deploy Egret games

Once the project is created, you can edit the project by clicking Egret Wing

Cloud Development Deploy Egret games

Here, we no longer edit, directly perform the publication

Click the publish button to go to the publishing page

Cloud Development Deploy Egret games

Select HTML5 and click OK to publish

Cloud Development Deploy Egret games

Once the publication is complete, click Open folder to see the build product

Cloud Development Deploy Egret games

Cloud Development Deploy Egret games

Next, we just need to upload these build products to a static hosting of cloud development to deploy Egret games to a static site hosting for cloud development.

Create a cloud development environment

After we've developed the game, let's create a cloud development environment for subsequent deployments. Visit the cloud development console, click New Environment, and create a new environment

Cloud Development Deploy Egret games

On the pop-up environment creation page, enter the name of the environment you want to create. In addition, the billing method here requires a pay-as-you-go option.

Cloud Development Deploy Egret games

Once set up, click Open Now to open a new cloud development environment.

Cloud Development Deploy Egret games

You'll see that your environment name becomes the character you enter plus a randomly generated string, and this is your environment ID, which you can record and use later. After a few moments of initialization of the cloud environment, click to go to the details page, click on the static site hosting on the left,

Cloud Development Deploy Egret games

You'll go to the static hosting details page, click Get Started, and open a static hosting service

Cloud Development Deploy Egret games

Wait for the static hosting service to open, wait a moment, it's ready to open. You can see your domain name information in your settings

Cloud Development Deploy Egret games

For example, my domain https://egret-14cdf2.tcloudbaseapp.com domain name is a test domain name assigned to me by cloud development, allowing me to complete product testing without migrating to production.

Install the Cloud Development Cli and Land

We can upload these files manually through the cloud development console or using the cloud development cli tool.

Cloud Development Deploy Egret games

Given that most of the scenes we do at work are uploaded using Cli, here we'll use Cli to upload.

Regarding the installation of CLi tools is not repeated here, you can go directly to the official documentation of http://docs.cloudbase.net/cli/intro.html be installed according to the official documentation.

After the installation of the cli tool is complete, perform the following command to log in

  1. tcb login

Once the login is complete, you can see the interface.

Cloud Development Deploy Egret games

Upload the file

Now that we've configured the cloud development Cli, we can upload files to the cloud development, use the command line, go into the project folder we just built, like I'm in this directory, and then execute commands in this directory for deployment

tcb hosting:deploy -e egret-14cdf2

After a moment, our file was uploaded.

Cloud Development Deploy Egret games

Visit the URL of the test environment we just got, you can see this interface, it shows that we successfully deployed the game to the cloud development static site hosting, and then we just need to bind the domain name, we can put the game online

Cloud Development Deploy Egret games