Support Chinese! An open source project to build a wiki knowledge base in seconds and build a private knowledge network

Get into the habit of writing together! This is the 5th day of my participation in the "Nuggets Daily New Plan · April Update Challenge", click to view the details of the event .

I don’t know if there is anyone like me who thinks that self-built things are “private plots” and private spaces on the Internet, and there is a kind of joy in having one-third of one acre and one-third of one’s own land.

For example, a self-built blog can write whatever essays you want, and you can entertain yourself without pleasing the readers; another example is a self-built wiki, which can directly record the knowledge points that you don’t know, without worrying about being laughed at as low-level. Aside from co-construction, Wiki is different from the casual nature of blog. The recorded content pays more attention to knowledge points and classification, which can be used to build your own knowledge network.

If a blog is compared to a "diary", then a wiki is a "notebook". It is used to record knowledge points, which is convenient for viewing and updating. It has a clear directory and a knowledge point can also be related to other knowledge points, gradually expanding into "encyclopedia". Whole Book".

1. Introduction

Knowledge lies in accumulation, and we must not forget to comb.

Today, the open source project we are going to introduce is wiki.js, which is specially used to build a wiki platform and help you sort out knowledge points.

Address: github.com/requarks/wi…

It is a lightweight and powerful wiki open source project, with comments, Markdown editor, image upload, tags, global search, collaborative editing, editing history, user management, Google Analytics and other functions, and supports a high degree of customization.

The technology stack used is also different from the old wiki system, which uses technologies such as Node.js, PostgreSQL, Vue.js, and Docker. One-click deployment based on Docker is quite WordPress-like, don't be too cool!

The key point is to support Chinese, and the interface is simple and beautiful, which is enough to make it stand out from many similar projects.

Do you feel itchy when you see this? Come with me below to make it run!

2. Installation

One of the necessary factors for the success of an open source project is to have detailed and easy-to-understand documentation, and installation instructions are a top priority.

Wiki.js 官方文档提供了多种部署方法,包括:Linux、macOS、Windows、Docker、k8s 等,涵盖了几乎所有可能性,十分全面。

下面我就介绍其中最快捷和通用的一种,即基于 Docker 的 Docker Compose 部署。

Tips:如果你不懂 Docker 建议跟着这里逐步执行

下面我将主要介绍 Linux 下的安装步骤,其它系统有桌面版不再赘述。

如果你机器上有 Docker 仅需两步即可完成安装。

第一步,安装 docker-compose:

1、下载

curl -L https://get.daocloud.io/docker/compose/releases/download/v2.4.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
复制代码

2、加执行权限

$ sudo chmod +x /usr/local/bin/docker-compose
复制代码

3、创建快捷方式

$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
复制代码

至此,你就可以在任何地方使用 docker-compose 命令了。

第二步,运行 docker-compose:

1、创建配置文件 docker-compose.yml 内容如下:

整个项目分为 数据库项目代码 两部分,与之对应的是 pg 容器wiki 容器

version: "3"
services:

  db:
    container_name: pg
    image: postgres:11-alpine
    environment:
      POSTGRES_DB: wiki
      POSTGRES_PASSWORD: wikijsrocks
      POSTGRES_USER: wikijs
    logging:
      driver: "none"
    restart: unless-stopped
    volumes:
      - db-data:/var/lib/postgresql/data

  wiki:
    container_name: wiki
    image: ghcr.io/requarks/wiki:2
    depends_on:
      - db
    environment:
      DB_TYPE: postgres
      DB_HOST: db
      DB_PORT: 5432
      DB_USER: wikijs
      DB_PASS: wikijsrocks
      DB_NAME: wiki
    restart: unless-stopped
    ports:
      - "8001:3000"

volumes:
  db-data:
复制代码

2、在配置所在的目录下,执行命令:

  • 运行:docker-compose up -d
  • 查看容器:docker ps
  • 停止:docker-compose down

最后,如果你想开启 HTTPS 的话,我这里推荐用 Caddy 服务器。没用过没关系,我们写过介绍使用 Caddy 的文章特别简单。

Caddyfile 的配置内容如下:

8001 端口对应的是上面 wiki 容器的 ports 端口映射

域名 {
    reverse_proxy 127.0.0.1:8001
}
复制代码

执行 caddy start 启动 Caddy 服务器,浏览器中访问对应的域名,网站初始化的引导界面,就会出现在你的面前了。

So far, the above is the whole process of wiki.js installation, are you running?

Third, the flaws do not hide the beauty

Wiki.js isn't perfect, and although I'm just getting started, I found a few fly in the ointment:

  • Slow loading on first visit

  • While wiki.js is actively updated and commits are frequent, it currently does not support custom themes

  • It is not friendly to Chinese search, it does not support Chinese search by default, you need to use ES, but it is no longer lightweight, or use the pg plugin to make pg support Chinese word segmentation

  • The Chinese translation coverage is not as 100% as shown on the official website, and there are still untranslated places in the management background.

But it doesn't hide the flaws, it does basically everything I want for a wiki. And it's better than implementing a wiki system from scratch. Later, I will use wiki.js to make a new website:

cheatsheet.store/

When I get through the above problems, I will contribute PR to it, and look forward to a more powerful wiki.js!

Fourth, the last

Knowledge needs to be integrated.

Knowledge is inherently messy, and it is necessary to establish connections and become orderly through practical experience, so as to be handy and unleash powerful creativity.

Finally, use wiki.js to build your knowledge network, sort out the existing knowledge and constantly introduce new ones, so that it can help you on your way to seek higher breakthroughs!

More articles explaining open source projects can be found here: github.com/HelloGitHub…

Guess you like

Origin juejin.im/post/7086622696087224350