matrix-synapse/homeserver.yaml.tmpl

279 lines
11 KiB
Cheetah
Raw Permalink Normal View History

2023-10-11 10:45:06 +00:00
# All configuration options are documented on the following link:
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html
2023-10-11 10:45:06 +00:00
{{ if eq (env "SHARED_SECRET_AUTH_ENABLED") "1" }}
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#modules-1
modules:
2022-09-22 14:01:19 +00:00
- module: shared_secret_authenticator.SharedSecretAuthProvider
config:
shared_secret: {{ secret "shared_secret_auth" }}
m_login_password_support_enabled: true
2023-10-11 10:45:06 +00:00
{{ end }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#server_name
2023-04-23 19:34:58 +00:00
server_name: {{ or (env "SERVER_NAME") (env "DOMAIN") }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#public_baseurl
2021-12-12 22:25:42 +00:00
public_baseurl: https://{{ env "DOMAIN" }}/
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#serve_server_wellknown
serve_server_wellknown: {{ env "SERVE_SERVER_WELLKNOWN" }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#allow_public_rooms_without_auth
allow_public_rooms_without_auth: false
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#allow_public_rooms_over_federation
2024-04-12 15:30:05 +00:00
allow_public_rooms_over_federation: {{ or (env "ALLOW_PUBLIC_ROOMS_FEDERATION") "true" }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#listeners
listeners:
- port: 8008
tls: false
type: http
x_forwarded: true
{{ if eq (env "DISABLE_FEDERATION") "1" }}
resources:
2021-12-13 14:00:04 +00:00
{{ if eq (env "KEYCLOAK_ENABLED") "1" }}
- names: [client, openid]
compress: true
{{ else }}
- names: [client]
2021-12-13 14:00:04 +00:00
compress: true
{{ end }}
{{ else }}
resources:
{{ if eq (env "KEYCLOAK_ENABLED") "1" }}
- names: [client, openid, federation]
2023-01-08 00:56:13 +00:00
compress: true
{{ else }}
- names: [client, federation]
2023-01-08 00:56:13 +00:00
compress: true
{{ end }}
{{ end }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#admin_contact
2021-12-12 22:25:42 +00:00
admin_contact: 'mailto:{{ env "ADMIN_EMAIL" }}'
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#limit_remote_rooms
limit_remote_rooms:
2022-09-05 23:03:28 +00:00
enabled: true
complexity: 200.0
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#max_avatar_size
2022-07-15 14:04:52 +00:00
max_avatar_size: 10M
2023-10-11 10:56:10 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#forgotten_room_retention_period
forgotten_room_retention_period: 3d
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#request_token_inhibit_3pid_errors
request_token_inhibit_3pid_errors: true
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#redaction_retention_period
redaction_retention_period: {{ env "REDACTION_RETENTION_PERIOD" }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#user_ips_max_age
user_ips_max_age: {{ env "USER_IPS_MAX_AGE" }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#retention
retention:
enabled: true
default_policy:
min_lifetime: 1d
max_lifetime: {{ env "RETENTION_MAX_LIFETIME" }}
2022-09-05 23:03:15 +00:00
allowed_lifetime_min: 1d
allowed_lifetime_max: {{ env "ALLOWED_LIFETIME_MAX" }}
purge_jobs:
- longest_max_lifetime: 3d
interval: 12h
- shortest_max_lifetime: 3d
interval: 1d
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#federation_domain_whitelist
{{ if eq (env "DISABLE_FEDERATION") "1" }}
federation_domain_whitelist: []
{{ else if eq (env "ENABLE_ALLOWLIST") "1" }}
federation_domain_whitelist: {{ env "FEDERATION_ALLOWLIST" }}
{{ end }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#database-1
database:
2021-12-12 22:25:42 +00:00
name: psycopg2
txn_limit: 10000
args:
2021-12-12 22:25:42 +00:00
user: synapse
2021-12-13 13:01:37 +00:00
password: "{{ secret "db_password" }}"
2021-12-12 22:25:42 +00:00
database: synapse
2021-12-13 13:01:37 +00:00
host: "{{ env "STACK_NAME" }}_db"
2021-12-12 22:25:42 +00:00
port: 5432
cp_min: 5
cp_max: 10
2021-12-13 12:10:23 +00:00
keepalives_idle: 10
keepalives_interval: 10
keepalives_count: 3
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#log_config
2021-12-13 11:39:19 +00:00
log_config: "/data/log.config"
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#media_store_path
media_store_path: "/data/media_store"
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#max_upload_size
max_upload_size: 50M
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#turn
{{ if eq (env "TURN_ENABLED") "1" }}
2021-12-13 09:37:03 +00:00
turn_uris: {{ env "TURN_URIS" }}
turn_shared_secret: "{{ secret "turn_shared_secret" }}"
turn_user_lifetime: 1h
turn_allow_guests: {{ env "TURN_ALLOW_GUESTS" }}
{{ end }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#enable_registration
enable_registration: {{ env "ENABLE_REGISTRATION" }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#enable_3pid_lookup
enable_3pid_lookup: {{ env "ENABLE_3PID_LOOKUP" }}
2023-10-11 10:56:10 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#allow_guest_access
allow_guest_access: false
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#registration_shared_secret
2023-10-19 13:33:29 +00:00
registration_shared_secret: {{ secret "registration" }}
2022-01-12 10:27:43 +00:00
{{ if eq (env "AUTO_JOIN_ROOM_ENABLED") "1" }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#auto_join_rooms
2022-01-12 10:27:43 +00:00
auto_join_rooms:
- "{{ env "AUTO_JOIN_ROOM" }}"
{{ end }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#report_stats
report_stats: false
{{ if eq (env "APP_SERVICES_ENABLED") "1" }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#app_service_config_files
app_service_config_files: {{ env "APP_SERVICE_CONFIGS" }}
{{ end }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#macaroon_secret_key
2023-10-19 13:33:29 +00:00
macaroon_secret_key: "{{ secret "macaroon" }}"
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#form_secret
2021-12-13 11:16:23 +00:00
form_secret: "{{ secret "form_secret" }}"
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#signing_key_path
2021-12-13 11:06:26 +00:00
signing_key_path: "/data/{{ env "DOMAIN" }}.signing.key"
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#trusted_key_servers
2023-04-08 21:09:16 +00:00
{{ if eq (env "ENABLE_ALLOWLIST") "1" }}
2023-10-11 10:45:06 +00:00
trusted_key_servers: [] # NOTE(d1): defaults to requesting server directly, which matches FEDERATION_ALLOWLIST
2023-04-08 21:09:16 +00:00
{{ else }}
trusted_key_servers:
- server_name: "matrix.org"
2023-04-08 21:09:16 +00:00
{{ end }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#oidc_providers
2023-10-11 11:23:54 +00:00
{{ if eq (env "KEYCLOAK_ENABLED") "1" }}
oidc_providers:
- idp_id: {{ env "KEYCLOAK_ID" }}
idp_name: {{ env "KEYCLOAK_NAME" }}
issuer: "{{ env "KEYCLOAK_URL" }}"
client_id: "{{ env "KEYCLOAK_CLIENT_ID" }}"
client_secret: "{{ secret "keycloak_client_secret" }}"
scopes: ["openid", "profile"]
allow_existing_users: {{ env "KEYCLOAK_ALLOW_EXISTING_USERS" }}
user_mapping_provider:
config:
2021-12-13 12:22:14 +00:00
localpart_template: "{{ "{{ user.preferred_username }}" }}"
display_name_template: "{{ "{{ user.name }}" }}"
2023-01-10 18:37:37 +00:00
{{ if eq (env "KEYCLOAK2_ENABLED") "1" }}
2023-05-31 13:50:55 +00:00
- idp_id: {{ env "KEYCLOAK2_ID" }}
2023-01-10 18:37:37 +00:00
idp_name: {{ env "KEYCLOAK2_NAME" }}
issuer: "{{ env "KEYCLOAK2_URL" }}"
client_id: "{{ env "KEYCLOAK2_CLIENT_ID" }}"
client_secret: "{{ secret "keycloak2_client_secret" }}"
scopes: ["openid", "profile"]
2023-05-31 13:50:55 +00:00
allow_existing_users: {{ env "KEYCLOAK2_ALLOW_EXISTING_USERS" }}
2023-01-10 18:37:37 +00:00
user_mapping_provider:
config:
localpart_template: "{{ "{{ user.preferred_username }}" }}"
display_name_template: "{{ "{{ user.name }}" }}"
{{ end }}
{{ if eq (env "KEYCLOAK3_ENABLED") "1" }}
2023-05-31 13:50:55 +00:00
- idp_id: {{ env "KEYCLOAK3_ID" }}
2023-01-10 18:37:37 +00:00
idp_name: {{ env "KEYCLOAK3_NAME" }}
issuer: "{{ env "KEYCLOAK3_URL" }}"
client_id: "{{ env "KEYCLOAK3_CLIENT_ID" }}"
client_secret: "{{ secret "keycloak3_client_secret" }}"
scopes: ["openid", "profile"]
2023-05-31 13:50:55 +00:00
allow_existing_users: {{ env "KEYCLOAK3_ALLOW_EXISTING_USERS" }}
2023-01-10 18:37:37 +00:00
user_mapping_provider:
config:
localpart_template: "{{ "{{ user.preferred_username }}" }}"
display_name_template: "{{ "{{ user.name }}" }}"
{{ end }}
2023-10-11 11:23:54 +00:00
{{ end }}
2023-01-10 18:37:37 +00:00
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#sso
2023-10-11 11:23:54 +00:00
{{ if eq (env "KEYCLOAK_ENABLED") "1" }}
sso:
2023-10-11 11:23:54 +00:00
client_whitelist:
- https://{{ env "KEYCLOAK_CLIENT_DOMAIN" }}
{{ end }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#password_config
password_config:
enabled: {{ env "PASSWORD_LOGIN_ENABLED" }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#email
2023-10-11 11:23:54 +00:00
{{ if eq (env "SMTP_ENABLED") "1" }}
email:
2021-12-13 16:21:07 +00:00
smtp_host: {{ env "SMTP_HOST" }}
smtp_port: {{ env "SMTP_PORT" }}
smtp_user: {{ env "SMTP_USER" }}
2023-03-05 11:05:26 +00:00
smtp_pass: "{{ secret "smtp_password" }}"
2021-12-13 16:21:07 +00:00
require_transport_security: true
notif_from: Your Friendly %(app)s homeserver <{{ env "SMTP_FROM" }}>
2021-12-13 16:21:07 +00:00
app_name: {{ env "SMTP_APP_NAME" }}
enable_notifs: true
client_base_url: https://{{ env "DOMAIN" }}
2023-10-11 11:23:54 +00:00
{{ end }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#encryption_enabled_by_default_for_room_type
encryption_enabled_by_default_for_room_type: {{ env "ENCRYPTED_BY_DEFAULT" }}
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#user_directory
user_directory:
2023-10-11 10:56:10 +00:00
enabled: true
2023-10-11 10:45:06 +00:00
search_all_users: true
2023-10-11 10:56:10 +00:00
prefer_local_users: true
2023-10-11 10:45:06 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#media_retention
2022-09-05 23:03:45 +00:00
media_retention:
local_media_lifetime: {{ env "MEDIA_RETENTION_LOCAL_LIFETIME" }}
remote_media_lifetime: {{ env "MEDIA_RETENTION_REMOTE_LIFETIME" }}
2023-10-11 10:56:10 +00:00
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#enable_metrics
enable_metrics: false
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#track_appservice_user_ips
track_appservice_user_ips: false
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#forget_rooms_on_leave
forget_rooms_on_leave: true
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#opentracing-1
opentracing:
enabled: false
2024-02-19 12:55:03 +00:00
# https://matrix-org.github.io/synapse/develop/usage/configuration/config_documentation.html#ratelimiting
rc_login:
address:
per_second: {{ env "LOGIN_LIMIT_IP_PER_SECOND" }}
burst_count: {{ env "LOGIN_LIMIT_IP_BURST" }}
account:
per_second: {{ env "LOGIN_LIMIT_ACCOUNT_PER_SECOND" }}
burst_count: {{ env "LOGIN_LIMIT_ACCOUNT_BURST" }}