banner
月落星河Tsukistar

月落星河Tsukistar

浩瀚中的伟大,孤独间的渺小
github
twitter
youtube
bilibili
email

Deploying the Waline commenting system using free resources on Tencent Cloud CloudBase.

Reference article: Waline Comment System - Deployment Logs | CC's Blog

Updated on September 5, 2023
Tencent Cloud changed the payment model of CloudBase a long time ago, and the minimum monthly payment is now 19.9, which is close to 20 times the cost of maintaining my blog. So I migrated my service to Alibaba Cloud's Function Compute, which is currently running stable.

Updated on August 10, 2021
Due to the delayed upgrade of Waline version, the HTML code of the emoji image was escaped.
Therefore, it is necessary to modify the version number in package.json of @waline/cloudbase, which is currently 1.0.25.
After the modification, it can be used normally.

Preface#

After migrating the blog to a static page, finding an embeddable third-party comment system became something I needed to consider, as Gitalk and Discuz were almost unusable due to network issues. After extensive use and experimentation, Sohu's Changyan did not work well on the blog, and Valine had been flooded with spam comments before, so I didn't dare to use it. Therefore, I finally settled on Waline, which is described as a Valine with a backend, so it has a series of features that can be used.

This article will not go into detail about the introduction of Waline, you can check the official documentation for that. This article also does not involve installation methods like Velcel+Leancloud, you can check the reference article above. This article briefly describes the deployment process, mainly focusing on the steps I took and the exploration of some features.

Deployment Process#

Claiming Free Resources#

According to the reference article, scroll down on this page and you will see the familiar "0 yuan" offer. After purchasing, enter the environment name.

Claim Free Environment

Setting Up Cloud Functions#

In the purchased environment details page, click "Cloud Functions - Create New Function" to create the required cloud functions, with the runtime environment and maximum memory as shown in the figure:

Create New Cloud Function

In the next step, replace part of the function code with the following:

Then move the app.js, cloudbaserc.json, and package.json files from this repository as they are, and click "Save and Install Dependencies" to complete the process, as shown in the following figure:

Move Files

HTTP Access#

If you want to access the application, it is recommended to bind your own domain name and enable HTTPS, as shown in the figure:

Configure Custom Domain

After the configuration is complete, it will look like the following figure:

Configuration Complete

After the domain name configuration is completed, set the secure domain in "Security Configuration", as shown in the figure:

Secure Domain

Environment Variables#

Unlike deploying to a pay-as-you-go environment in CloudBase, in manual deployment, the environment variables are set in "Cloud Functions", as shown in the figure:

Environment Variables

Click "Edit" in the upper right corner, add the corresponding environment variables and their values, and after saving, the application will have the corresponding functionality.

Configure Email Notifications#

Since ZOHO's SMTP service is only available to paid users, I moved the entire email service to Tencent Enterprise Mail, and also set up an email account for sending notifications.

Use the environment variables provided in the official documentation, as shown in the following figure:

Email Environment Variables

Where SMTP_USER and SMTP_PASS are the account and password of the email. For details on configuring enterprise mail, see this article, which is similar, or follow the instructions provided, which is also very simple.

After the configuration is complete, perform a test and the email will be sent successfully:

Email Sent Successfully

Summary#

Using Waline successfully solved the comment problem on the blog. I spent a long time struggling with the email notification part of the comments, from SendGrid to SendCloud and finally to Tencent Enterprise Mail, and finally implemented this functionality. From now on, I no longer have to worry about not replying to comments in a timely manner.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.