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

Cloud Development Deploy LayaBox Air 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.

The use of 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 cloud development SDK in LayaBox, database, functions, storage and other links also moved to cloud development, so that the entire business does not collapse.

Initialize the project

Open laya Air IDE, initialize a project, and here we name it cloudbase and put it on the desktop.

Cloud Development Deploy LayaBox Air games

You can click the Run button, run the created game template, and see the effect.

Cloud Development Deploy LayaBox Air games

Once it's up and running, we've configured a project.

Publish the project

Click the Publish button in the top menu bar to enter the publishing process

Cloud Development Deploy LayaBox Air games

Select the publishing platform for the web, and click Publish, waiting for the game to be automatically published

Cloud Development Deploy LayaBox Air games

When the publication is complete, you'll be prompted to view the publishing folder

Cloud Development Deploy LayaBox Air games

When you open it, you can see what's compiled

Cloud Development Deploy LayaBox Air games

These are all the files for Layabox games, and by uploading them to static storage developed in the cloud, we can enjoy high-performance web hosting for games developed with LayaBox.

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 LayaBox Air 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 LayaBox Air games

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

Cloud Development Deploy LayaBox Air 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 LayaBox Air games

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

Cloud Development Deploy LayaBox Air 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 LayaBox Air games

For example, my domain name https://layabox-15b541.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.

Cloud Development Deploy LayaBox Air games

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 LayaBox Air 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

tcb login

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

Cloud Development Deploy LayaBox Air 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, for example, I'm here to go to the directory of C:

tcb hosting:deploy -e layabox-15b541

After a moment, our file was uploaded.

Cloud Development Deploy LayaBox Air 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 LayaBox Air games

Summarize

Deploying Layabox-developed games to cloud development static site hosting is simple, and with a simple configuration of the cloud development cli, you can deploy LayaAir IDE-developed projects to cloud development static site hosting.

In the actual use of the process, because of the test domain name limited speed configuration, it is recommended that you bind their own domain name to see the effect.