mirror of
https://github.com/Thumbscrew/matrix-homeserver-docker-compose.git
synced 2025-01-18 09:35:46 +00:00
example-worker-configs | ||
.env.example | ||
.gitignore | ||
docker-compose.yaml | ||
README.md |
Matrix Synapse (Docker Compose)
Prerequisites
- Docker
- Docker Compose
- A domain
Setup
Create a .env
file
- Create a copy of
.env.example
:
cp .env.example .env
-
Replace
VOLUME_PATH
variable if you wish to change where volume data is stored -
Replace
SERVER_NAME
variable with your Matrix server's domain name (e.g.matrix.example.com
) -
Replace
TZ
variable with your timezone -
Create the required PostgreSQL secret file
postgres_password.txt
and insert a secure password (you should consider restricting access to this file)
Generate homeserver.yaml
- Run the following command to use the
matrixdotorg/synapse
image to generate ahomeserver.yaml
file (replace$VOLUME_PATH
with the value you set in your .env file andexample.com
with your domain):
sudo docker run -it --rm \
--mount type=bind,src=$VOLUME_PATH/data,dst=/data \
-e SYNAPSE_SERVER_NAME=example.com \ `# Replace with your domain`
-e SYNAPSE_REPORT_STATS=no \ `# Change to yes if you wish to report stats to Matrix`
matrixdotorg/synapse:latest generate
The homeserver.yaml
file should now exist at $VOLUME_PATH/data/homeserver.yaml
-
Open the newly created
homeserver.yaml
in your favourite editor -
Locate the following lines in the config:
database:
name: sqlite3
args:
database: /data/homeserver.db
- Replace these lines with the following (replace
secretpassword
with the password you put into postgres_password.txt):
database:
name: psycopg2
txn_limit: 10000
args:
user: synapse_user
password: secretpassword
database: synapse
host: postgres
port: 5432
cp_min: 5
cp_max: 10
- Locate the
public_baseurl
setting inhomeserver.yaml
and set it to the URL of your Matrix server domain name (e.g.matrix.example.com
)
Configure Synapse Workers
The provided docker-compose.yaml contains 4 workers (2 generic and 2 federation senders). See Synapse Workers docs for the different types. See the Example worker configs README for more detail.
- Bring up the containers!
sudo docker-compose -p matrix-synapse up -d