Matrix Synapse 的 PostgreSQL 数据库配置
以下配置用于在 homeserver.yaml 文件中为 Matrix Synapse 设置 PostgreSQL 数据库:
matrix_synapse_db.yaml
database:
name: psycopg2
txn_limit: 10000
args:
user: synapse
password: eetah1vahnesh2be0eeshuP5thoopa
database: synapse
host: synapse_db
port: 5432
cp_min: 5
cp_max: 10请记住将 password 替换为安全的密码,并确保 synapse_db 服务在 docker-compose.yml 中正确定义。
PostgreSQL 服务的相关 docker-compose.yml 片段可能如下所示:
synapse_db_compose.yml
services:
synapse_db:
image: docker.io/postgres:14-alpine
environment:
- POSTGRES_USER=synapse
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
volumes:
- ./synapse_db_data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U synapse"]
interval: 1s
start_period: 3s
timeout: 5s
retries: 60有关在 .env 文件中为 PostgreSQL 数据库生成随机密码的信息,请参阅如何在 .env 中为 docker-compose 生成随机 PostgreSQL 密码。
确保在 docker-compose.yml 和 homeserver.yaml 文件中设置相同的密码。
Check out similar posts by category:
Matrix
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow