The following content is from “Play Tencent Cloud” user original article, has been authorized.

01. What is Serverless?

1. Serverless Official definition

Serverless in the Server is the meaning of the Server, less is no meaning, as the name implies, that is, no Server;

Serverless Framework is a very popular Serverless application Framework in the industry. Developers can deploy a complete Serverless application Framework without caring about the underlying resources. Serverless Framework has the capabilities of resource orchestration, automatic scaling and event driving, covering the whole life cycle of coding, debugging, testing and deployment, helping developers to quickly build Serverless applications by linking cloud resources.

2. Relationship between Serverless and Tencent Cloud

Asked the big guy

Serverless Cloud Function (SCF) is a Serverless execution environment provided by Tencent Cloud for enterprises and developers. It helps you run code without purchasing and managing servers. It is an ideal computing platform for real-time file processing and data processing. You only need to use the language supported by SCF platform to write the core code and set the conditions for the code to run, so that the code can run flexibly and safely on Tencent cloud infrastructure.

Generally speaking, the relationship between SCF and Serverless is that Tencent Cloud SCF can help developers quickly get started with Serverless Framework application framework. When we deploy applications in the traditional way, we first need to buy cloud server, and then configure the environment on the server. Then we deploy our application code, and developers don’t need to buy servers when deploying applications with Serverless.

3. Explanation about no server

So how is it possible to develop applications without a server?

Serverless does not mean that there is no server, but that when we use Serverless, we do not need to care about the underlying resources, nor do we need to log in to the server and optimize the server. We only need to pay attention to the most core code fragments, so we can skip the complex and tedious basic work. The core code snippet is triggered entirely by events or requests, and the platform automatically adjusts service resources in parallel to the request. Serverless has almost unlimited capacity expansion. When idle, no resources are running. Code running stateless, can easily achieve rapid iteration, rapid deployment.

When deploying applications with Serverless, we don’t have to deploy the development environment every time, which means we don’t have to reinvent the wheel, saving developers a lot of time.

4. Comparison between Serverless and traditional Web application deployment schemes

You can see that Serverless has obvious advantages over traditional VIRTUAL machine servers.

Traditional VM deployment Serverless WordPress
Deployment steps Buy the machine -> set up the PHP environment -> configure the database -> install the application. Choose Template > Direct Deployment to automatically create all cloud service resources.
The cost of Pre-paid, need to purchase the machine in advance. Pay-as-you-go, pay-as-you-go, a personal blog site with 100 visits a day can cost less than 10 yuan a month to run.
performance The server and database are deployed on the same VM, and the DISASTER recovery data center (ACTIVE-passive mode) is unavailable. The deployment is based on underlying cloud resources. Databases and applications are separated, and services support Dr And backup.

Here I will show you in detail how to use Serverless to build a personal blog.

Serverless Function services used by WordPress

02. Build WordPress personal blog based on Serverless

2.1 Logging In to the Tencent Cloud Serverless Console

  1. Search the console for ** “Serverless Application Center” ** and click to enter
  • Tencent cloud Serverless console entry: console.cloud.tencent.com/sls

  1. The picture below shows the Serverless console. You can see that I have created two Serverless applications. If you are using them for the first time, the application bar should be empty

2.2 Creating a Serverless Application

  1. Click New App, select the Quick Deployment WordPress framework, click Next, set the basic application configuration, and then click Finish.
  • Serverless is currently in public beta in Tencent Cloud. Every month, it will give free resources and vouchers required for the establishment of the site. You can get coupons and then create new apps. Vouchers and free resources to receive address: cloud.tencent.com/act/pro/ser…

New users can enjoy 400,000 GBs of free resource usage and 1 million times of use of cloud functions, 1 million times of free call of gateway and 1GB of free outbound traffic per month

PS: Here I would like to say one more word about regional selection. The primary consideration for regional selection is the distance between the target user and the physical data center of the cloud server. The shorter the distance, the smaller the network delay.

  1. The deployment may take a short time, not too long, so be patient.

  1. After the deployment is complete, you can see the front entrance address and the administrator entrance address of WordPress.

  1. Before going to the WordPress home page, take a look at the deployment log

  1. As you can see from the image above, Serverless has helped us automate the environment configuration when we deploy the WordPress framework, saving a lot of time compared to traditional virtual machine server configuration.

2.3 Introduction to WordPress Blog framework

1. A brief introduction of WordPress

WordPress: official website address cn.wordpress.org/support/art…

WordPress is a free open source content management system (CMS) based on PHP and MySQL. It is the most widely used CMS software in the world, supporting more than 30% of the top 10 million websites as of May 2019, and holds an estimated 60% market share of all websites built using CMS. WordPress started in 2003 as a simple blogging system, but has grown into a full CMS with thousands of plugins, widgets, and themes. It is licensed under the Open source agreement General Public License (GPLv2 or later).

Generally speaking, WordPress is an open source content management system based on PHP and Mysql, and it is very mature and widely used.

2. WordPress administrator background configuration

  1. Click to enter the administrator background

  1. Follow the picture to initialize the configuration

  1. Click Login after the initialization is successful

  1. WordPress background interface dashboard, here we can set the site title, publish articles, manage themes, manage users and other functions;

3. WordPress Foreground interface

After the background initialization is complete, we enter the foreground screen

We can see in the front interface that the blog platform has been built, and it has the basic functions of article display, comment editing, classification, site search and so on. However, the interface is relatively simple, with only basic functions, but not very perfect. Let’s go to the dashboard to adjust the blog front.

4. Configure the WordPress foreground interface

  1. Go to the wordpress dashboard and click Customize site. Here you can configure some basic information about the site.

  1. If you want to change the theme of your site, you can choose to change the theme

  1. At present, WordPress comes with three default themes, but we can also download and install other WordPress themes, currently adapted WordPress themes are still many, you can install your favorite theme

  1. Of course, you can do other Settings in the dashboard, and I’m not going to list them all, but you can do it, it’s not complicated

  1. We can also install the plug-ins we need in the plug-in management interface.

  1. For example, the markdown format is not supported by the WordPress editor for editing articles. You can download a Markdown plug-in.

  1. Don’t forget to click Enable when the installation is complete;

2.4 WordPress edits and publishes articles

  1. Click to write an article

  1. Test article editing

  1. You can also set article properties on the right side

  1. Click on the post to see the preview

  1. That’s it for WordPress. Of course, we can also add ordinary users and administrator users in the user management interface, we can try.

03. Serverless Application domain name configuration

In section 2 of the WordPress application configuration process, we can see that our application domain name is a long string of alphanumeric combination, which is not beautiful, and is not suitable for the site domain name. The test use is ok, I will show you how to configure our own domain name to the Serverless application.

3.1 Preparations

  1. Buy a domain name

Domain name: purchase link dnspod.cloud.tencent.com/

  1. The domain name registration

The purchased domain name can only be used after filing. You can buy Tencent cloud Serverless record resource package for the record, only 22 yuan a year! buy.cloud.tencent.com/scf

PS: The filing time is about a week

For the record address: cloud.tencent.com/product/ba

  1. To apply for an SSl certificate, go to console.dnspod.cn/ssl

  1. Add a CNAME record to point the domain to the secondary domain of the service

  1. Add an API gateway mapping
  • In the Serverless consoleComponent information–>API gateway ID–>Immediately opened

  1. It should be able to send notifications via SMS, wechat and email.

  1. Click customize the domain name

  1. To complete the binding

  1. Domain name configuration complete

3.2 Changing the site address in the WordPress Dashboard

In the Settings, change the default site address and WordPress address to our custom domain name and click Save.

04. Serverless Application monitoring

  1. Since we did not purchase a real VIRTUAL machine server, monitoring application resources becomes a problem to be considered. Serverless provides developers with an application monitoring platform, and monitoring data can be visually analyzed.

  1. In the application monitoring, we can see the number of application requests, outbound traffic, application response time, the number of errors in the foreground, etc.

  1. In the overview we can see some basic information about the Serverless application;

  1. We can also see the Serverless application usage in detail in the deployment log;

conclusion

So much for deploying WordPress applications based on Serverles. Overall, the user experience is very good. For individual developers, there is no need to purchase servers in advance, which reduces capital expenditure. There is no need to configure the underlying environment, greatly saving development time.

Of course, in the use of the process will also encounter some large and small problems.

The official sister of Tencent Cloud Serverless summarized some common problems and gave solutions

  • Tencent Cloud Serverless FAQ solution: docs.qq.com/doc/DUlljSm…

If you have any questions about deploying WordPress applications on Serverles feel free to post them in the comments section and I will answer them.

Finally, let’s access the WordPress application by customizing the domain name.


Serverless construction station surprise welfare big delivery!

SCF, FILE storage CFS, cloud native database TDSQL-C, content distribution CDN, API gateway resources monthly delivery.

Click here to check out the surprise benefits!

One More Thing

Experience Tencent Cloud Serverless Demo immediately and receive Serverless new user package 👉 Tencent Cloud Serverless novice experience

Welcome to: Serverless Chinese!