May 27, 2021 Web Cloud Development and Web Hosting Learning Guide
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.
Open laya Air IDE, initialize a project, and here we name it cloudbase and put it on the desktop.
You can click the Run button, run the created game template, and see the effect.
Once it's up and running, we've configured a project.
Click the Publish button in the top menu bar to enter the publishing process
Select the publishing platform for the web, and click Publish, waiting for the game to be automatically published
When the publication is complete, you'll be prompted to view the publishing folder
When you open it, you can see what's compiled
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.
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
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.
Once set up, click Open Now to open a new cloud development environment.
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,
You'll go to the static hosting details page, click Get Started, and open a static hosting service
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
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.
We can upload these files manually through the cloud development console or using the cloud development cli tool.
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.
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.
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
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.