Matrix:
- Matrix 是一个开放的通信协议,用于实时通信,包括即时消息、音频和视频通话。
- 它是去中心化的,这意味着任何人都可以设置自己的 Matrix 服务器,并与其他 Matrix 服务器通信。
- Matrix 的目标是为所有不同的通信服务提供一个统一的标准,使得不同的服务可以互相通信。
Element:
- Element 是基于 Matrix 协议的一个客户端应用。
- 它允许用户通过 Matrix 协议进行即时消息、音频和视频通话。
- Element 有多个版本,包括 Web、桌面和移动应用。
- 它是 Matrix 生态系统中最流行的客户端之一。
创建安装目录
创建安装目录
sudo -i
mkdir -p /root/data/docker_data/matrix
cd /root/data/docker_data/matrix
然后运行:
sudo docker run -it --rm \
-v /root/data/docker_data/matrix/data:/data \
-e SYNAPSE_SERVER_NAME=matrix.gugu.ovh \
-e SYNAPSE_REPORT_STATS=yes \ matrixdotorg/synapse:latest generate
注意:matrix.gugu.ovh改成自己的域名
cd /root/data/docker_data/matrix/data
vim homeserver.yaml
改成下面的内容:
# Configuration file for Synapse. # This is a YAML file: see [1] for a quick introduction. Note in particular # that *indentation is important*: all the elements of a list or dictionary # should have the same indentation. # [1] https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html # For more information on how to configure Synapse, including a complete accounting of # each option, go to docs/usage/configuration/config_documentation.md or # https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html server_name: "matrix.gugu.ovh" pid_file: /data/homeserver.pid listeners: - port: 8008 tls: false type: http x_forwarded: true resources: - names: [client, federation] compress: false database: name: sqlite3 args: database: /data/homeserver.db log_config: "/data/matrix.gugu.ovh.log.config" media_store_path: /data/media_store registration_shared_secret: "wwaftxJ&3W3Xkx1y4gYoeoY0p6ywmkx96JZB7rCYg2+_bd~M,t" report_stats: true macaroon_secret_key: "+i6*ZU+ZgxnIjX98@F3F#Oxw*Un*40=58ESt=+HW=SVA@N6ITy" form_secret: "xMGG5P~DD-7Brm19jaYR9v0d.wG:abNxN9ikdWcgNE7Z3F;NmB" signing_key_path: "/data/matrix.gugu.ovh.signing.key" trusted_key_servers: - server_name: "matrix.org" enable_registration: true enable_registration_without_verification: true # vim:ft=yaml
在编辑docker-compose.yml
cd /root/data/docker_data/matrix
vim docker-compose.yml
修改一下内容:
version: "3.3" services: synapse: image: "matrixdotorg/synapse:latest" container_name: "matrix_synapse" restart: unless-stopped ports: - 8008:8008 volumes: - "./data:/data" # It will look at the current directory where you save the file and look for the data folder inside environment: VIRTUAL_HOST: "matrix.gugu.ovh" VIRTUAL_PORT: 8008 LETSENCRYPT_HOST: "matrix.gugu.ovh" SYNAPSE_SERVER_NAME: "matrix.gugu.ovh" SYNAPSE_REPORT_STATS: "yes" element-web: image: "vectorim/element-web" container_name: "element_web" restart: unless-stopped ports: - "8009:80" # Uncomment the following line to use a custom configuration # volumes: # - "/etc/element-web/config.json:/app/config.json"
更新 matrix
cd /root/data/docker_data/matrix
docker-compose pull
docker-compose up -d # 请不要使用 docker-compose stop 来停止容器,因为这么做需要额外的时间等待容器停止;
docker-compose up -d 直接升级容器时会自动停止并立刻重建新的容器,完全没有必要浪费那些时间。
docker image prune # prune 命令用来删除不再使用的 docker 对象。删除所有未被 tag 标记和未被容器使用的镜像;
提示:
WARNING! This will remove all dangling images.
Are you sure you want to continue? [y/N]
#输入y确认
卸载 matrix
进入安装页面,先停止所有容器。
cd /root/data/docker_data/matrix
docker-compose down
cd ..
rm -rf /root/data/docker_data/matrix # 完全删除