blog update

Original link: https://juemuren4449.com/archives/blog-update-to-161

The blog has been upgraded for more than half a month, and it is currently running stably. Let me record the upgrade process.

Upgrade reason

My blog uses ” Halo “. The deployment time is 2019. It has been four years now. The version deployed at that time was a version between 0.4.0-0.4.2. Then it was upgraded to 0.4.3, and it has been used until now.

After using it for so long, I found that this version still has some problems:

  • Management interface is not modern enough
  • The version is too old, there may be security holes
  • The database uses H2, which is inconvenient to access
  • The program and data are separated, and data backup and migration are inconvenient
  • Recent comments at the bottom may display abnormally if they contain special symbols

There was a malicious comment on the blog before, and a large number of comments flooded in in a short period of time. Although I turned on the review of comments, the continuous comments made the email notification crazy and reported errors. I had no choice but to stop the blog and check the IP address of the comment from the database. , It is solved by setting the server blacklist. To be honest, accessing the H2 database is quite troublesome, especially when the service is closed, and it is even more troublesome to access locally.

At the end of last year, I considered upgrading the blog. At that time, Halo had already started testing version 2.0, and the stable version was 1.6.0.

Then I tested the blog upgrade locally. Although the process is a bit cumbersome, the upgrade can go through.

upgrade plan

I have always wanted to find a suitable time to upgrade, but I dragged it until this year, until I saw the news that Mr. Ruan Yifeng’s blog was hacked from ” Technology Enthusiast Weekly (No. 242): An Embarrassing Server Hacked “. Accelerated the pace of upgrading my blog.

So, I found a time and started to upgrade the blog. At this time, the latest v1 version is already 1.6.1. Visually, there should be no updates, so I decided to upgrade to this version.

upgrade

upgrade plan

My upgrade plan is to upgrade in the local virtual machine first, and then migrate to the server after the data check is correct.

The specific steps are as follows:

  • virtual machine 1
    • Restore the 0.4.3 and data of the same version of the server
    • upgrade to 0.4.4
    • Check data integrity
    • export data
  • virtual machine 2
    • deploy 1.2.0
    • Import Data
    • Check data integrity
    • Upgrade to 1.6.1
    • export data
  • virtual machine 3
    • download configuration file
    • Set up to use the MySQL database
    • create database
    • docker compose maps local directory
    • docker compose deploy 1.6.1
    • Import Data
    • Modify configuration items
  • server
    • Copy the docker compose configuration file and mapping directory
    • deploy and start
    • Check data and configuration

plan description

  • Why do you need to perform the upgrade operation on the virtual machine?
    • Avoid data errors or loss caused by direct operations on the server.
  • Why upgrade to 0.4.4 first?
    • This is the last version before 1.0, you need to upgrade to this version to export data.
  • Why import to 1.2.0?
    • In my impression, this version does not support importing data of old versions.
  • Why use docker compose to deploy?
    • It is convenient for data backup and migration. You only need to back up the mapped directory and docker-compose.yml to perform data migration.

problems encountered

Some problems were also encountered during the migration, which are documented here.

The first is that the import of comments failed. Looking at the log, there is a comment that is too long, and it failed when importing data. At the same time, several subsequent comments also failed to import. Later, I tried to modify the field length of the target database and successfully imported it.

Secondly, the upgrade process takes a long time, and the virtual machine may be suspended, resulting in inaccurate virtual machine time and problems during access. The solution is also very simple, just calibrate the server time.

Also, you may not be able to access the blog if you use a port other than 80 during the upgrade process. I didn’t investigate the reason, but just changed the port to 80. Finally, it is no problem to migrate to the server to use a port other than 80.

configuration check

Regarding the configuration items that need to be checked, let me list them:

  • configuration file
    • Database: choose MySQL database, more stable and reliable
    • Cache: select level, no data will be lost even if the service is restarted
  • database
    • OPTIONS table: Modify birthday to display the number of days when the site was built
  • blog settings
    • SMTP service: post-configuration testing
    • comment settings
      • turn on all switches
      • Gravatar mirror sources: find alternative sources if unreachable
    • Accessory settings: Check storage location and configuration
    • Other settings: add statistics code
  • Advanced options (click “Switch to advanced options” in the upper right corner of the blog settings)
    • Custom page prefix: p
    • API service: open, fill in the previous Access key

Upgrade summary

Generally speaking, it is more reliable to upgrade on the local virtual machine first, and refer to this solution for similar upgrades in the future.

Up to now, it has been more than half a month since the upgrade, the blog is running stably, and no problems have been found yet.

In fact, the official version of Halo 2.0 was released when I upgraded, but I still chose 1.6.1, the main reason is to seek stability. After all, blogs are content-based, and the version of the blog itself is not particularly important, as long as the stability and security of the blog system can be guaranteed, and the ultimate goal is to produce content.

In addition, I am a proper upgrade madman personally, and all kinds of software are basically upgraded to the latest version at the first time. If it is upgraded to hao 2.0, then with the official update, I will not be able to help but update, On the one hand, it takes time, and on the other hand, it has little effect on content output, and even needs to spend time to solve the problems encountered in the upgrade.

Therefore, I chose Halo 1.6.1, which can not only ensure stability and security, but also avoid the anxiety caused by the continuous upgrade of the latest version.

Finally, a friendly reminder, the most important thing to upgrade is data backup , so be sure to remember. As long as there is a backup, plus the operation and upgrade in the virtual machine, you can do whatever you want, at worst, start over from scratch.

The above is the process of upgrading this blog, welcome to communicate and exchange.

This article is transferred from: https://juemuren4449.com/archives/blog-update-to-161
This site is only for collection, and the copyright belongs to the original author.