1
头图

cover

foreword

Halo is a CMS blog system, it can be said to be a lightweight version of Wordpress, based on xxxx, Balabala, forget it yourself and see the official documents.

Official deployment

Officially supports deployment in a variety of situations, linux, docker, and Tencent cloud platform in three ways:

Why deploy with RailWay

I originally wanted to use Vercel to see if it could be deployed, but after the automatic name change of Vercel, it no longer supports docker deployment, so I switched to RailWay.

Knowing from the official documentation, RailWay supports a variety of deployment methods, such as Nodejs, Go, Docker, Java, etc. For details, see https://docs.railway.app/ , then since Docker is supported, Halo also supports docker deployment, then naturally RailWay It must support the deployment of Halo. I checked a lot on the Internet, but I did not find anyone deploying Halo using RailWay, so I wrote this article to summarize. Why deploy with RailWay? I have tried the following methods, but all have drawbacks;

  • Nas + Docker + DDNS
    I used Docker to deploy Halo on the Nas in my home, but the mobile broadband does not give the public network IP, so I can only do the intranet penetration myself, using frp and ddnsto, frp needs a VPS for transit, although there are It is a Tencent Cloud server, but it always feels a little troublesome. ddnsto bought a service from https://www.ddnsto.com/ , but after this binding, it needs to be verified and logged in after a period of time, because it needs to be provided by halo The interface of the applet obtains data in the applet. Once this time passes, the interface of the applet cannot be adjusted, so this method is passed;
  • Tencent Cloud Platform
    Halo also supports deployment on Tencent Cloud platform, the access speed is also good, the deployment is also very convenient, and the cost of the cloud platform is also ok, but! ! The custom domain name has been unable to be bound. I asked the customer service to submit a work order, and according to what they said, it still cannot be bound... So I can only use the domain name provided by the cloud platform itself. If anyone knows how to solve it, please let me know. .
  • VPS
    Because the domain name cannot be bound, I temporarily gave up the way of using the cloud platform, so I installed docker on the VPS, and I can access it normally, but after all, the VPS will expire, and subsequent renewals are more expensive, so I can only try , if there is a cheap VPS, this method is better;
  • RailWay
    RailWay deployment, one-click automatic deployment, support for custom domain names, free https, free quota of $5 per month, which is basically enough for individuals;

deploy

  • fork halo
    Fork the official halo project to its own github, Halo address: https://github.com/halo-dev/halo
  • Import the forked Halo project in RailWay, select Deploy from Github repo, find the fork project, and click to start deployment
    newProject
  • By default, the first deployment will not report an error, but it will not be opened after the deployment is completed, because no environment variables are set, and no dockerfile is configured, so it is inaccessible.
  • Set environment variables: Open the project and set two environment variables in Variables, one is the path of the Dockerfile, and the other is the port to be accessed, because the Dockerfile in halo is placed in the root directory, so just write the Dockerfile directly here, PORT must be is 8090, because the mirror in halo has specified the port
    setEnvVar
  • After setting, RailWay will automatically deploy, and you will find that the deployment fails again. By checking the log, it is found that the jar file under build/libs needs to be obtained in the Dockerfile, because the official said that it supports java direct deployment, but it is also directly deployed. jar package, so the jar package under lib here is actually the jar package to be deployed; by looking at the source code of the Halo project, I found that gitignore was added to the build folder in the project, so it must not be found here. My solution is in the warehouse Download the latest jar package in the , and put it under the build/libs folder, and then submit the jar file to github, and the deployment can be successful.
    deployErr
  • So another way of thinking, since only the Dockerfile and the jar package are needed, is it better to keep only these two files in my warehouse, as it turns out, it is ok;
  • Another way of thinking is that Halo supports java deployment, and RailWay also supports Java deployment. Is it possible to directly deploy the entire project of halo without uploading the jar package? In theory, it is also possible! But I don't know how to configure Java, so you can try it yourself!

access

After the deployment is complete, set a custom domain name in settings, configure CNAME, and you can access it! For example, my access address is: https://halo.wangboweb.site

other

  • Why use halo?
    Halo is similar to a lightweight version of wordpress. I always wanted to be a blog management backend myself, but I have only done half of it because of various things. The management system of halo can import the markdown files written on hexo before, and all the tags and categories will also be automatically generated, and the comment system is also well supported. The most important point is that it provides API access. Before, when you needed to use blog data in applet in hexo, you needed to use hexo-restful in hexo , and there is no authentication. The external API interface is provided in halo, and authentication can be set. It only needs to be enabled in the settings-advanced options.
    setApi

    In addition, combined with the open source project https://gitee.com/fuzui/GBlog-wx , you can quickly generate your own small program blog, which is extremely convenient.

    The configuration method on halo is also more convenient. Although there are not many themes, like Wordpress, you can also customize it yourself, which is actually not bad!

Summarize

At this point, the deployment of the halo blog system on RailWay is complete, and friends who have ideas can try it themselves! Combined with the above mentioned applet projects, I hope everyone can create their own blog system + blog applet!


恪晨
145 声望462 粉丝

前端程序猿