3
0
mirror of https://github.com/spantaleev/matrix-docker-ansible-deploy.git synced 2026-03-25 22:17:25 +00:00

allow synapse to use redis unix socket instead of tcp

This commit is contained in:
Aine
2026-03-08 07:24:33 +00:00
parent 86bb61aba0
commit 0c40a03efc
5 changed files with 22 additions and 2 deletions

View File

@@ -4844,6 +4844,10 @@ matrix_synapse_redis_enabled: "{{ valkey_enabled }}"
matrix_synapse_redis_host: "{{ valkey_identifier if valkey_enabled else '' }}"
matrix_synapse_redis_password: "{{ valkey_connection_password if valkey_enabled else '' }}"
matrix_synapse_redis_path_enabled: false # temporarily, then switch to true by default once properly tested
matrix_synapse_redis_path: "{{ '/tmp/redis.sock' if valkey_enabled else '' }}" # default value for Synapse
matrix_synapse_redis_path_host: "{{ valkey_run_path+'/valkey.sock' if valkey_enabled else '' }}" # path on the host
matrix_synapse_container_extra_arguments_auto: "{{ matrix_homeserver_container_extra_arguments_auto }}"
matrix_synapse_app_service_config_files_auto: "{{ matrix_homeserver_app_service_config_files_auto }}"

View File

@@ -1241,11 +1241,16 @@ matrix_synapse_instance_map: |
# Redis information
matrix_synapse_redis_enabled: false
matrix_synapse_redis_host: ""
matrix_synapse_redis_port: 6379
matrix_synapse_redis_password: ""
matrix_synapse_redis_dbid: 0
matrix_synapse_redis_use_tls: false
# Connection option 1: TCP
matrix_synapse_redis_host: ""
matrix_synapse_redis_port: 6379
# Connection option 2: Unix socket (takes precedence over TCP if `matrix_synapse_redis_path` is set)
matrix_synapse_redis_path_enabled: false
matrix_synapse_redis_path: "" # the path to the redis socket inside the container, e.g. "/var/run/redis.sock"
matrix_synapse_redis_path_host: "" # the path to the redis socket on the host, e.g. "/matrix/valkey/run/valkey.sock"
# Controls whether Synapse starts a replication listener necessary for workers.
#

View File

@@ -2932,6 +2932,11 @@ redis:
host: {{ matrix_synapse_redis_host | to_json }}
port: {{ matrix_synapse_redis_port | to_json }}
# The full path to a local Unix socket file. If this is used, host and port are ignored.
{% if matrix_synapse_redis_path_enabled %}
path: {{ matrix_synapse_redis_path | to_json }}
{% endif %}
# Optional database ID to connect to. Defaults to 0.
dbid: {{ matrix_synapse_redis_dbid | to_json }}

View File

@@ -67,6 +67,9 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
{% for volume in matrix_synapse_container_additional_volumes %}
--mount type={{ volume.type | default('bind' if '/' in volume.src else 'volume') }},src={{ volume.src }},dst={{ volume.dst }}{{ (',' + volume.options) if volume.options else '' }} \
{% endfor %}
{% if matrix_synapse_redis_path_enabled %}
--mount type=bind,src={{ matrix_synapse_redis_path_host }},dst={{ matrix_synapse_redis_path }} \
{% endif %}
--label-file={{ matrix_synapse_base_path }}/{{ matrix_synapse_worker_labels_file_name }} \
{% for arg in matrix_synapse_container_arguments %}
{{ arg }} \

View File

@@ -51,6 +51,9 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
{% endif %}
--mount type=bind,src={{ matrix_synapse_config_dir_path }},dst=/data,ro \
--mount type=bind,src={{ matrix_synapse_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \
{% if matrix_synapse_redis_path_enabled %}
--mount type=bind,src={{ matrix_synapse_redis_path_host }},dst={{ matrix_synapse_redis_path }} \
{% endif %}
--label-file={{ matrix_synapse_base_path }}/labels \
{% for volume in matrix_synapse_container_additional_volumes %}
--mount type={{ volume.type | default('bind' if '/' in volume.src else 'volume') }},src={{ volume.src }},dst={{ volume.dst }}{{ (',' + volume.options) if volume.options else '' }} \