Generating a configuration file
docker run -it --rm \
-v $HOME/Docker/matrix/synapse-data:/data \
-e SYNAPSE_SERVER_NAME=matrix.server.address \
-e SYNAPSE_REPORT_STATS=yes \
matrixdotorg/synapse:latest generate
The server_name
cannot be changed later so it is important to configure this correctly before you start Synapse. It should be all lowercase and may contain an explicit port.
Add common setting to homeserver.yaml
Documentation for all configuration options can be found in the Configuration Manual.
server_name: "matrix.server.address"
public_baseurl: https://matrix.server.address
presence:
enabled: true
email:
smtp_host: smtp.mail.server
smtp_port: 587
smtp_user: ""
smtp_pass: ""
force_tls: true
require_transport_security: true
enable_tls: true
notif_from: "%(app)s <[email protected]>"
app_name: MatrixServer
enable_notifs: true
notif_for_new_users: false
client_base_url: "https://element.server.address"
validation_token_lifetime: 15m
invite_client_location: https://element.server.address
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"
serve_server_wellknown: true
recaptcha_public_key: --your----pub----key--
recaptcha_private_key: --your---pem----key--
enable_registration_captcha: true
enable_registration: true
Get your key at Google's reCAPTCHA
Once you have a valid configuration file, you can start synapse as follows:
docker run -d --name synapse --restart=unless-stopped \
-v $HOME/Docker/matrix/synapse-data:/data \
-p 8008:8008 \
matrixdotorg/synapse:latest
(assuming 8008 is the port Synapse is configured to listen on for http traffic.)
You can then check that it has started correctly with:
docker logs synapse
After synapse is running, you may wish to create a user via register_new_matrix_user
.
This requires a registration_shared_secret
to be set in your config file. Synapse must be restarted to pick up this change.
You can then call the script:
docker exec -it synapse register_new_matrix_user http://localhost:8008 \
-c /data/homeserver.yaml --help
docker exec -it synapse register_new_matrix_user http://localhost:8008 \
-c /data/homeserver.yaml -a
Remember to remove the registration_shared_secret
and restart if you no-longer need it.
touch $HOME/Docker/matrix/element-web/config.json
Create element-web container
docker run -d --name element-web \
-p 8009:80 --restart=unless-stopped \
-v $HOME/Docker/matrix/element-web/config.json:/app/config.json \
vectorim/element-web
vi config.json
{
"default_server_config": {
"m.homeserver": {
"base_url": "https://matrix.server.address"
},
"m.identity_server": {
"base_url": "https://vector.im"
}
},
"branding": {
"welcome_background_url": "https://server.address/images/wallpaper.jpg",
"auth_header_logo_url": "https://server.address/images/logo.gif",
"auth_footer_links": [
{ "text": "FAQ", "url": "https://example.org/faq" },
{ "text": "Donate", "url": "https://example.org/donate" }
]
},
"default_theme": "light" ,
"settingDefaults": {"language": "zh-hant"}
}
Restart element-web container.
Visit http://localhost:8009 to login your Matrix server.
version: "3"
services:
synapse-admin:
container_name: synapse-admin
hostname: synapse-admin
build:
context: https://github.com/Awesome-Technologies/synapse-admin.git
# args:
# - NODE_OPTIONS="--max_old_space_size=1024"
# # see #266, PUBLIC_URL must be without surrounding quotation marks
# - PUBLIC_URL=/synapse-admin
# - REACT_APP_SERVER="https://matrix.example.com"
ports:
- "8010:80"
restart: unless-stopped
Visit http://localhost:8010 to manage your Synapse homeserver. This includes: