Last updated on March 19, 2024 pm
To generate keys
1 2 3 4 5 6 7 8
| docker run --rm --entrypoint="" \ -v $(pwd):/mnt \ matrixdotorg/dendrite-monolith:latest \ /usr/bin/generate-keys \ -private-key /mnt/matrix_key.pem \ -tls-cert /mnt/server.crt \ -tls-key /mnt/server.key
|
1 2 3 4
| mkdir -p ~/Dendrite && cd ~/Dendrite nano generate-keys.sh chmod +x generate-keys.sh sudo ./generate-keys.sh
|
生成配置文件
1 2 3 4 5 6 7 8 9 10
| global: server_name: m.limour.top private_key: /mnt/matrix_key.pem database: connection_string: postgresql://dendrite:itsasecret@postgres:5432/dendrite?sslmode=disable jetstream: storage_path: /mnt/JetStream well_known_server_name: "m.limour.top:443" client_api: registration_shared_secret: "itsasecret"
|
部署
1 2 3 4 5
| nano docker-compose.yml
wget https://github.com/matrix-org/dendrite/raw/main/build/docker/postgres/create_db.sh chmod +x create_db.sh sudo docker-compose up -d
|
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
| version: "3.4" services: postgres: hostname: postgres image: postgres:14 restart: always volumes: - ./create_db.sh:/docker-entrypoint-initdb.d/20-create_db.sh - ./postgresql:/var/lib/postgresql/data environment: POSTGRES_PASSWORD: itsasecret POSTGRES_USER: dendrite healthcheck: test: ["CMD-SHELL", "pg_isready -U dendrite"] interval: 5s timeout: 5s retries: 5 networks: - internal monolith: hostname: monolith image: matrixdotorg/dendrite-monolith:latest command: [ "--tls-cert=/mnt/server.crt", "--tls-key=/mnt/server.key" ] ports: - 12008:8008 - 12448:8448 volumes: - ./:/etc/dendrite - ./media:/var/dendrite/media - ./:/mnt depends_on: - postgres networks: - internal restart: unless-stopped networks: internal: attachable: true
|
反向代理
- 域名解析 m.limour.top
- WAF 添加 m.limour.top 白名单
- NGPM反向代理 m.limour.top到12008
注册账号
sudo docker exec -it dendrite-monolith-1 /usr/bin/create-account -admin --config /etc/dendrite/dendrite.yaml --username limour
搭建自己的element-web
1 2 3 4
| mkdir -p ~/element && cd ~/element nano docker-compose.yml nano config.json sudo docker-compose up -d
|
1 2 3 4 5 6 7 8 9
| version: '3.3' services: element-web: ports: - '12280:80' volumes: - './config.json:/app/config.json' - './config.json:/app/config.e.limour.top.json' image: vectorim/element-web
|
1 2 3 4 5 6 7 8 9 10
| { "default_server_config": { "m.homeserver": { "base_url": "https://m.limour.top" }, "m.identity_server": { "base_url": "https://vector.im" } } }
|
【迁移】Docker部署Matrix-Dendrite
https://hexo.limour.top/Docker-bu-shu-Matrix-Dendrite