搭建synapse
- docker拉配置文件
docker pull matrixdotorg/synapse
# 跑一下
docker run -it --rm \\\\
--mount type=bind,source=/root/docker/synapse/data,target=/data \\\\
-e SYNAPSE_SERVER_NAME=my.matrix.host \\\\
-e SYNAPSE_REPORT_STATS=yes \\\\
matrixdotorg/synapse:latest generate
# 把配置文件挂在到这个位置
/root/docker/synapse/data
- 创建数据库
创建数据库点我
- 配置synapse
# 修改配置文件
nano /root/docker/synapse/data/homeserver.yaml
#
database:
name: psycopg2
args:
user: synapse
password: abc
database: synapse
host: 10.0.0.1
cp_min: 5
cp_max: 10
keepalives_idle: 30
keepalives_interval: 10
keepalives_count: 3
- 修改配置文件以后
docker run -d --name synapse \\\\
--mount type=bind,source=/root/docker/synapse/data,target=/data \\\\
-p 8008:8008 \\\\
matrixdotorg/synapse:latest
- 进入docker中创建一个账户
# 进入docker
docker exec -it synapse bash
# 创建账户
register_new_matrix_user -c /data/homeserver.yaml <http://localhost:8008>
- 开启注册,并且要求验证邮箱
# 开启邮箱验证
enable_registration: true
registrations_require_3pid:
- email
# smtp配置
email:
smtp_host: smtp.163.com
smtp_port: 465
smtp_user: "username@163.com"
smtp_pass: "usernamepass"
force_tls: true
require_transport_security: true
enable_tls: false
notif_from: "Your Friendly %(app)s homeserver <username@163.com>"
app_name: ur_matrix_server
enable_notifs: true
notif_for_new_users: false
client_base_url: "<https://xxxx>"
validation_token_lifetime: 15m
invite_client_location: <https://app.element.io>
subjects:
message_from_person_in_room: "[%(app)s] You have a message on %(app)s from %(person)s in the %(room)s room..."
message_from_person: "[%(app)s] You have a message on %(app)s from %(person)s..."
messages_from_person: "[%(app)s] You have messages on %(app)s from %(person)s..."
messages_in_room: "[%(app)s] You have messages on %(app)s in the %(room)s room..."
messages_in_room_and_others: "[%(app)s] You have messages on %(app)s in the %(room)s room and others..."
messages_from_person_and_others: "[%(app)s] You have messages on %(app)s from %(person)s and others..."
invite_from_person_to_room: "[%(app)s] %(person)s has invited you to join the %(room)s room on %(app)s..."
invite_from_person: "[%(app)s] %(person)s has invited you to chat on %(app)s..."
password_reset: "[%(server_name)s] Password reset"
email_validation: "[%(server_name)s] Validate your email"
连接tg
- 拉个配置文件,最好是跟上面那个放一个文件夹
# 拉config
docker run --rm -v `pwd`:/data:z dock.mau.dev/mautrix/telegram
# 创建数据库
su - postgres
# 创建用户
createuser --pwprompt mautrix
# 新建数据库
createdb --encoding=UTF8 --locale=C --template=template0 --owner=mautrix mautrix
- 编辑配置文件
# 找到config.yaml进行编辑
# 修改内容建议
homeserver.address
homeserver.domain
appservice.database: postgres://mautrix:1234@host:port/mautrix
# 很重要
bridge.permissions
# tgbot
# <https://my.telegram.org/apps> 获取
telegram.api_id
telegram.api_hash
- 先跑一下
# run
docker run --restart unless-stopped -v `pwd`:/data:z dock.mau.dev/mautrix/telegram:<version>
跑完以后会生成一个 registration.yaml , 这里很重要,去 homeserver.yaml 桥接一下;
# 桥接
nano homeserver.yaml
# 添加内容 具体路径根据情况
app_service_config_files:
- /data/registration.yaml
- 坑
# 两个docker分别跑的,ip不一样, registration.yaml 中的url地址需要改成bot docker的内部地址
# bot只能收到 / 开头的指令
# 找到 botfather
/setprivacy
# 找到自己的bot , privacy mode 设置成 Disable ;
element-web
拉库
docker pull vectorim/element-web
创建配置文件 config.json
{
"default_server_config": {
"m.homeserver": {
"base_url": "<https://m.xx.xx>",
"server_name": "m.xx.xx"
},
"m.identity_server": {
"base_url": "<https://vector.im>"
}
},
"disable_custom_urls": false,
"disable_guests": false,
"disable_login_language_selector": false,
"disable_3pid_login": false,
"brand": "Element",
"integrations_ui_url": "<https://scalar.vector.im/>",
"integrations_rest_url": "<https://scalar.vector.im/api>",
"integrations_widgets_urls": [
"<https://scalar.vector.im/_matrix/integrations/v1>",
"<https://scalar.vector.im/api>",
"<https://scalar-staging.vector.im/_matrix/integrations/v1>",
"<https://scalar-staging.vector.im/api>",
"<https://scalar-staging.riot.im/scalar/api>"
],
"bug_report_endpoint_url": "<https://element.io/bugreports/submit>",
"uisi_autorageshake_app": "element-auto-uisi",
"default_country_code": "GB",
"show_labs_settings": false,
"features": {},
"default_federate": true,
"default_theme": "light",
"room_directory": {
"servers": ["matrix.org"]
},
"enable_presence_by_hs_url": {
"<https://matrix.org>": false,
"<https://matrix-client.matrix.org>": false
},
"setting_defaults": {
"breadcrumbs": true,
"language": "zh-hans"
},
"jitsi": {
"preferred_domain": "meet.element.io"
},
"element_call": {
"url": "<https://call.element.io>",
"participant_limit": 8,
"brand": "Element Call"
},
"map_style_url": "<https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx>"
}
跑起来
docker run -d --name element -p 12345:80 -v /root/docker/element/config.json:/app/config.json vectorim/element-web
评论区