聊天平台Revolt的搭建

经网友 凌尘 提醒,Web-Check 最新的镜像版本,容器端口已经从 8888 改为了 3000,特此更正!


什么是 Revolt ?

Revolt 是一个开源的用户至上的聊天平台。是在不牺牲任何可用性的情况下与朋友和社区保持联系的最佳方式之一,可以确保您的对话是保密的。

安装

在群晖上以 Docker 方式安装。

官方提供了 self-hostedrepo,地址在:https://github.com/revoltchat/self-hosted,但要在群晖上部署,还需要做一些微调,涉及到下面三个文件

docker-compose.yml

采用 docker-compose 安装,将下面的内容保存为 docker-compose.yml 文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
version: "3.8"

services:
# MongoDB database
database:
image: mongo
container_name: revolt-database
restart: always
volumes:
- ./data:/data/db

# Redis server
redis:
image: eqalpha/keydb
container_name: revolt-redis
restart: always

# S3-compatible storage server
minio:
image: minio/minio
container_name: revolt-minio
command: server /data
env_file: env.txt
volumes:
- ./minio:/data
restart: always

# Caddy web server
caddy:
image: caddy
container_name: revolt-caddy
restart: always
env_file: env.txt
ports:
- "11080:80"
- "11443:443"
volumes:
- ./caddyfile.txt:/etc/caddy/Caddyfile
- ./caddy-data:/data
- ./caddy-config:/config

# API server (delta)
api:
image: ghcr.io/revoltchat/server
container_name: revolt-api
env_file: env.txt
depends_on:
- database
- redis
- caddy
restart: always

# Events service (quark)
events:
image: ghcr.io/revoltchat/bonfire
container_name: revolt-events
env_file: env.txt
depends_on:
- database
- redis
- caddy
restart: always

# Web App (revite)
web:
image: ghcr.io/revoltchat/client:master
container_name: revolt-web
env_file: env.txt
depends_on:
- caddy
restart: always

# File server (autumn)
autumn:
image: ghcr.io/revoltchat/autumn
container_name: revolt-autumn
env_file: env.txt
depends_on:
- database
- createbuckets
- caddy
environment:
- AUTUMN_MONGO_URI=mongodb://database
restart: always

# Metadata and image proxy (january)
january:
image: ghcr.io/revoltchat/january
container_name: revolt-january
depends_on:
- caddy
restart: always

# Create buckets for minio.
createbuckets:
image: minio/mc
container_name: revolt-mc
depends_on:
- minio
env_file: env.txt
entrypoint: >
/bin/sh -c "
while ! curl -s --output /dev/null --connect-timeout 1 http://minio:9000; do echo 'Waiting minio...' && sleep 0.1; done;
/usr/bin/mc alias set minio http://minio:9000 $MINIO_ROOT_USER $MINIO_ROOT_PASSWORD;
/usr/bin/mc mb minio/attachments;
/usr/bin/mc mb minio/avatars;
/usr/bin/mc mb minio/backgrounds;
/usr/bin/mc mb minio/icons;
/usr/bin/mc mb minio/banners;
/usr/bin/mc mb minio/emojis;
exit 0;
"

镜像下载

这里一共涉及到了 10 个镜像,其中一半发布在 hub.docker.com,另一半发布在 ghcr.io,老苏建议先用 docker pull 拉取镜像,然后再安装

ghcr.io可以试试 docker 代理网站,当然如果 hub.docker.com 下不动也是可以用代理网站的

代理网站的地址:https://dockerproxy.com/,会多几个步骤,但总比下不了强

镜像说明

  • mongoMongoDB数据库在某些不支持 AVX 指令集 的 CPU 上,会导致容器不断重启,如果你遇到,可以尝试改为 mongo:4.4
  • eqalpha/keydbRedis 服务主要将数据缓存到内存,提升性能;latest 对应的版本是 x86_64_v6.3.3
  • minio/minio:用于实现存储服务;latest 对应的版本是 RELEASE.2023-08-16T20-17-30Z
  • minio/mcMinIO Client 简称 mc,是 minio服务器的客户端;latest 对应的版本是 RELEASE.2023-08-15T23-03-09Z
  • caddy:提供Web 服务;latest 对应的版本是 2.7.4-alpine
  • ghcr.io/revoltchat/server:提供API 服务;latest 对应的版本是 20230810-3
  • ghcr.io/revoltchat/bonfire:提供事件服务;latest 对应的版本是 20230810-3
  • ghcr.io/revoltchat/autumn:提供文件服务;latest 对应的版本是 1.1.10
  • ghcr.io/revoltchat/january:提供代理服务;latest 对应的版本是 0.3.5
  • ghcr.io/revoltchat/client:master:提供 Web 应用;选择了 tagmatser 的版本,因为latest 的版本是一年前的;

整个文件中,只有访问的端口需要修改,和本地端口不冲突就行,不确定的话可以用命令查一下

1
2
# 查看端口占用
netstat -tunlp | grep 端口号

env.txt

为了便于在群晖的 File Station 中修改,老苏将 .env.example 重命名为了 env.txt 而不是 .env

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
##
## Quark configuration
##

# MongoDB
MONGODB=mongodb://database

# Redis
REDIS_URI=redis://redis/

# Hostname used for Caddy
# This should in most cases match REVOLT_APP_URL
#HOSTNAME=http://local.revolt.chat
HOSTNAME=:80

# URL to where the Revolt app is publicly accessible
REVOLT_APP_URL=http://192.168.0.197:11080

# URL to where the API is publicly accessible
REVOLT_PUBLIC_URL=http://192.168.0.197:11080/api
VITE_API_URL=http://192.168.0.197:11080/api

# URL to where the WebSocket server is publicly accessible
REVOLT_EXTERNAL_WS_URL=ws://192.168.0.197:11080/ws

# URL to where Autumn is publicly available
AUTUMN_PUBLIC_URL=http://192.168.0.197:11080/autumn

# URL to where January is publicly available
JANUARY_PUBLIC_URL=http://192.168.0.197:11080/january


##
## hCaptcha Settings
##

# If you are sure that you don't want to use hCaptcha, set to 1.
REVOLT_UNSAFE_NO_CAPTCHA=1

# hCaptcha API key (This is the "Secret key" from your User Settings page)
# REVOLT_HCAPTCHA_KEY=0x0000000000000000000000000000000000000000

# hCaptcha site key
# REVOLT_HCAPTCHA_SITEKEY=10000000-ffff-ffff-ffff-000000000001


##
## Email Settings
##

# If you are sure that you don't want to use email verification, set to 1.
REVOLT_UNSAFE_NO_EMAIL=1

# SMTP host
# REVOLT_SMTP_HOST=smtp.example.com

# SMTP username
# REVOLT_SMTP_USERNAME=noreply@example.com

# SMTP password
# REVOLT_SMTP_PASSWORD=CHANGEME

# SMTP From header
# REVOLT_SMTP_FROM=Revolt <noreply@example.com>


##
## Application Settings
##

# Whether to only allow users to sign up if they have an invite code
REVOLT_INVITE_ONLY=0

# Maximum number of people that can be in a group chat
REVOLT_MAX_GROUP_SIZE=150

# VAPID keys for push notifications
# Generate using this guide: https://gitlab.insrt.uk/revolt/delta/-/wikis/vapid
# --> Please replace these keys before going into production! <--
REVOLT_VAPID_PRIVATE_KEY=LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSUJSUWpyTWxLRnBiVWhsUHpUbERvcEliYk1yeVNrNXpKYzVYVzIxSjJDS3hvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFWnkrQkg2TGJQZ2hEa3pEempXOG0rUXVPM3pCajRXT1phdkR6ZU00c0pqbmFwd1psTFE0WAp1ZDh2TzVodU94QWhMQlU3WWRldVovWHlBdFpWZmNyQi9BPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=
REVOLT_VAPID_PUBLIC_KEY=BGcvgR-i2z4IQ5Mw841vJvkLjt8wY-FjmWrw83jOLCY52qcGZS0OF7nfLzuYbjsQISwVO2HXrmf18gLWVX3Kwfw=


##
## Autumn configuration
##

# S3 Region
AUTUMN_S3_REGION=minio

# S3 Endpoint
AUTUMN_S3_ENDPOINT=http://minio:9000

# MinIO Root User
MINIO_ROOT_USER=minioautumn

# MinIO Root Password
MINIO_ROOT_PASSWORD=minioautumn

# AWS Access Key ID
AWS_ACCESS_KEY_ID=minioautumn

# AWS Secret Key
AWS_SECRET_ACCESS_KEY=minioautumn
  • 第一处需要修改的地方是 HOSTNAME=http://local.revolt.chat,因为我们没有使用默认的 80 端口,而是 11080 ,所以按照官方的说法,要改为 HOSTNAME=:80

  • 其他的所有的 http://local.revolt.chat 都改为了 http://192.168.0.197:11080

老苏的群晖主机为 192.168.0.197,你需要按你自己 IP 进行修改;

更多环境变量的说明请参考官方文档:https://developers.revolt.chat/stack/env

caddyfile.txt

同样也是为了便于修改,没有用 Caddyfile,而是改为了 caddyfile.txt,看起来是不是有点像 Nginx?这个文件没有做任何改动,主要的原因是老苏没折腾过 Caddy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{$HOSTNAME} {
route /api* {
uri strip_prefix /api
reverse_proxy http://api:8000
}

route /ws {
@upgrade {
header Connection *Upgrade*
header Upgrade websocket
}

uri strip_prefix /ws
reverse_proxy @upgrade http://events:9000
}

route /autumn* {
uri strip_prefix /autumn
reverse_proxy http://autumn:3000
}

route /january* {
uri strip_prefix /january
reverse_proxy http://january:7000
}

reverse_proxy http://web:5000
}

一键启动

然后执行下面的命令

1
2
3
4
5
6
7
8
9
10
# 新建文件夹 revolt 和 子目录
mkdir -p /volume1/docker/revolt/{caddy-config,caddy-data,data,minio}

# 进入 revolt 目录
cd /volume1/docker/revolt

# 将 docker-compose.yml 、 env.txt caddyfile.txt 放入当前目录

# 一键启动
docker-compose up -d

如果不出意外的话,除了 revolt-mc,另外 9 个容器都是运行状态

运行

在浏览器中输入 http://群晖IP:11080 就能看到主界面

第一次需要注册账号

登录成功后的主界面

创建频道

完成之后,就等着好友加入聊天了

设置

黄色部分的大意是说

1
2
3
我们目前正在从头开始重建客户端和语音服务器。

在大多数情况下,旧声音应该有效,但在某些情况下,它可能莫名其妙地无法连接和/或表现出奇怪的行为。

老苏翻了一下,最早的语音服务器代码地址是:https://github.com/revoltchat/vortex,但是已经弃用,官方说在新的分支重写,不过看起来一直也没更新,以后再说吧

参考文档

Revolt
地址:https://github.com/revoltchat

revoltchat/self-hosted: Deploy Revolt using Docker.
地址:https://github.com/revoltchat/self-hosted

Revolt - Find Your Community
地址:https://revolt.chat/

Introduction | Revolt
地址:https://developers.revolt.chat/

Revolt 搭建指南 - 神代綺凛の随波逐流
地址:https://moe.best/tutorial/revolt.html