A. 最终效果
B. 配置文件
yml
version: "3"
services:
wiki:
image: ghcr.io/requarks/wiki:2
container_name: wikijs
ports:
- "3000:3000"
volumes:
- /home/lgk/Projects/WikiJS/config:/config
environment:
- DB_TYPE=postgres
- DB_HOST=database
- DB_PORT=5432
- DB_USER=wikijs
- DB_PASS=wikijsrocks
- DB_NAME=wiki
- SEARCH_TYPE=elasticsearch
- SEARCH_HOST=http://elasticsearch:9200
- SEARCH_INDEX_NAME=wiki
depends_on:
- database
- elasticsearch
database:
image: postgres:15-alpine
container_name: wikijs_postgres
environment:
POSTGRES_DB: wiki
POSTGRES_PASSWORD: wikijsrocks
POSTGRES_USER: wikijs
volumes:
- /home/lgk/Projects/WikiJS/data:/var/lib/postgresql/data
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.13
container_name: elasticsearch
# privileged: true
environment:
- discovery.type=single-node
- bootstrap.memory_lock=false
- ES_JAVA_OPTS=-Xms512m -Xmx512m
- xpack.security.enabled=false # 可选,禁用认证功能
# ulimits:
# memlock:
# soft: 262144
# hard: 262144
# 在 命令行中执行:sudo ulimit -l unlimited
# 修改docker配置:sudo vim /etc/docker/daemon.json
# {
# "registry-mirrors": ["https://register.liberx.info"],
# "data-root": "/home/docker",
# "default-ulimits": {
# "memlock": {
# "Name": "memlock",
# "Hard": -1,
# "Soft": -1
# }
# }
# }
# 设置临时虚拟内存:sudo sysctl -w vm.max_map_count=262144
volumes:
- /home/lgk/Projects/WikiJS/esdata:/usr/share/elasticsearch/data
ports:
- "9200:9200"
C. 中文搜索设置
bash
http://elasticsearch:9200