Merge pull request #6 from madonius/feature/make-synapse-basepath-configurable

Feature/make synapse basepath configurable
This commit is contained in:
Emmanouil Kampitakis 2019-02-22 00:17:26 +01:00 committed by GitHub
commit 8e8c371007
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 41 additions and 41 deletions

View file

@ -32,9 +32,9 @@ The following should be present on the target system
| matrix_synapse_base_path | "/opt/synapse" | _This is not yet consistently used. **DO NOT RELY ON IT**. Lookout for future releases_
| matrix_synapse_secrets_path | "{{ matrix_synapse_base_path }}/secrets"
| matrix_synapse_extra_config | _None_ | configuration parameters as given in the [synapse configuration file](https://github.com/matrix-org/synapse/tree/master/docs) |
| matrix_synapse_dh_path | "/opt/synapse/tls/{{ matrix_server_name }}.dh" |
| matrix_synapse_dh_path | "{{ matrix_synapse_base_path }}/tls/{{ matrix_server_name }}.dh" |
| matrix_synapse_baseurl | "https://{{ matrix_server_name }}" |
| matrix_synapse_signing_key_path | "/opt/synapse/ssl/{{ matrix_server_name }}.signing.key" |
| matrix_synapse_signing_key_path | "{{ matrix_synapse_base_path }}/ssl/{{ matrix_server_name }}.signing.key" |
| matrix_synapse_version | "v0.99.1.1" |
| matrix_synapse_log_days_keep | 30 |
| matrix_synapse_deployment_method | pip | Either pip or docker [¹](#footnote_1) |

View file

@ -1 +1 @@
* Make synapse base path configurable instead of hard coded to /opt/synapse

View file

@ -4,12 +4,12 @@ matrix_synapse_deployment_method: pip
matrix_synapse_supervision_method: systemd
matrix_synapse_base_path: "/opt/synapse"
matrix_synapse_secrets_path: "{{ matrix_synapse_base_path }}/secrets"
matrix_synapse_dh_path: "/opt/synapse/tls/{{ matrix_server_name }}.dh"
matrix_synapse_dh_path: "{{ matrix_synapse_base_path }}/tls/{{ matrix_server_name }}.dh"
matrix_synapse_baseurl: "https://{{ matrix_server_name }}"
matrix_synapse_signing_key_path: "/opt/synapse/tls/{{ matrix_server_name }}.signing.key"
matrix_synapse_signing_key_path: "{{ matrix_synapse_base_path }}/tls/{{ matrix_server_name }}.signing.key"
matrix_synapse_version: "v0.99.1.1"
matrix_synapse_log_days_keep: 30
matrix_synapse_skip_tls: false
matrix_synapse_pid_file: /opt/synapse/synapse.pid
matrix_synapse_pid_file: "{{ matrix_synapse_base_path }}/synapse.pid"
matrix_synapse_docker_ports: ["8008:8008", "8448:8448"]
matrix_synapse_docker_labels: {}

View file

@ -1,16 +0,0 @@
[Unit]
Description="Matrix Synapse Server (synapse)"
[Service]
Type=simple
WorkingDirectory=/opt/synapse
ExecStart=/opt/synapse/env/bin/python -m synapse.app.homeserver --config-path=/opt/synapse/homeserver.yaml --log-config=/opt/synapse/log.config
ExecStop=/opt/synapse/env/bin/synctl stop /opt/synapse/homeserver.yaml
User=synapse
Group=synapse
Restart=always
StandardOutput=syslog
SyslogIdentifier=matrix_synapse
[Install]
WantedBy=default.target

View file

@ -9,7 +9,7 @@
- name: create directory
file:
path: /opt/synapse
path: "{{ matrix_synapse_base_path }}"
state: directory
owner: synapse
group: synapse
@ -46,12 +46,12 @@
loop:
- "{{ matrix_synapse_config.media_store_path }}"
- "{{ matrix_synapse_config.uploads_path }}"
- /opt/synapse/tls
- "{{ matrix_synapse_base_path }}/tls"
- name: Deploy config
copy:
content: "{{ matrix_synapse_config | to_nice_yaml }}"
dest: "/opt/synapse/homeserver.yaml"
dest: "{{ matrix_synapse_base_path }}/homeserver.yaml"
owner: synapse
group: synapse
notify:

View file

@ -29,7 +29,7 @@
- lxml
- psycopg2-binary
- mock
virtualenv: /opt/synapse/env
virtualenv: "{{ matrix_synapse_base_path }}/env"
virtualenv_python: python2.7
extra_args: --upgrade
tags:
@ -38,7 +38,7 @@
- name: Clone synapse
git:
repo: https://github.com/matrix-org/synapse
dest: /opt/synapse/synapse
dest: "{{ matrix_synapse_base_path }}/synapse"
accept_hostkey: yes
version: "{{ matrix_synapse_version }}"
register: clone_synapse
@ -47,8 +47,8 @@
- name: Install Synapse
pip:
name: /opt/synapse/synapse
virtualenv: /opt/synapse/env
name: "{{ matrix_synapse_base_path }}/synapse"
virtualenv: "{{ matrix_synapse_base_path }}/env"
virtualenv_python: python2.7
when: clone_synapse.changed
tags:
@ -68,11 +68,11 @@
- "-m"
- "synapse.app.homeserver"
- "-c"
- "/opt/synapse/homeserver.yaml"
- "{{ matrix_synapse_base_path }}/homeserver.yaml"
user: "{{ synapse_user.uid }}:{{ synapse_user.group }}"
volumes:
- "{{ matrix_synapse_config.media_store_path }}:{{ matrix_synapse_config.media_store_path }}"
- "{{ matrix_synapse_config.uploads_path }}:{{ matrix_synapse_config.uploads_path }}"
- "/opt/synapse/homeserver.yaml:/opt/synapse/homeserver.yaml"
- "/opt/synapse/tls:/opt/synapse/tls"
- "{{ matrix_synapse_base_path }}/homeserver.yaml:{{ matrix_synapse_base_path }}/homeserver.yaml"
- "{{ matrix_synapse_base_path }}/tls:{{ matrix_synapse_base_path }}/tls"
when: matrix_synapse_deployment_method == "docker"

View file

@ -21,7 +21,7 @@
- name: Deploy log config
copy:
src: "log.config"
dest: "/opt/synapse/log.config"
dest: "{{ matrix_synapse_base_path }}/log.config"
owner: synapse
group: synapse
notify:

View file

@ -1,7 +1,7 @@
---
- name: Deploy service file
copy:
src: "matrix-synapse.service"
template:
src: "matrix-synapse.service.j2"
dest: "/etc/systemd/system/matrix-synapse.service"
notify:
- "reload systemd"

View file

@ -0,0 +1,16 @@
[Unit]
Description="Matrix Synapse Server (synapse)"
[Service]
Type=simple
WorkingDirectory={{ matrix_synapse_base_path }}
ExecStart={{ matrix_synapse_base_path }}/env/bin/python -m synapse.app.homeserver --config-path={{ matrix_synapse_base_path }}/homeserver.yaml --log-config={{ matrix_synapse_base_path }}/log.config
ExecStop={{ matrix_synapse_base_path }}/env/bin/synctl stop {{ matrix_synapse_base_path }}/homeserver.yaml
User=synapse
Group=synapse
Restart=always
StandardOutput=syslog
SyslogIdentifier=matrix_synapse
[Install]
WantedBy=default.target

View file

@ -14,7 +14,7 @@
- name: "{{ dbuser }}"
password: "{{ dbpw }}"
postgresql_global_config_options:
- option: listen_address
- option: listen_addresses
value: "*"
- role: matrix-ansible-synapse
matrix_server_name: localhost

View file

@ -2,8 +2,8 @@
matrix_synapse_config: "{{ matrix_synapse_base_config | combine(matrix_synapse_extra_config, recursive=True) }}"
matrix_synapse_base_config:
server_name: "{{ matrix_server_name }}"
tls_certificate_path: "/opt/synapse/tls/{{ matrix_server_name }}.crt"
tls_private_key_path: "/opt/synapse/tls/{{ matrix_server_name }}.key"
tls_certificate_path: "{{ matrix_synapse_base_path }}/tls/{{ matrix_server_name }}.crt"
tls_private_key_path: "{{ matrix_synapse_base_path }}/tls/{{ matrix_server_name }}.key"
acme:
enabled: false
url: https://acme-v01.api.letsencrypt.org/directory
@ -12,7 +12,7 @@ matrix_synapse_base_config:
reprovision_threshold: 30
no_tls: false
tls_fingerprints: []
pid_file: "/opt/synapse/synapse.pid"
pid_file: "{{ matrix_synapse_base_path }}/synapse.pid"
soft_file_limit: 0
use_presence: true
listeners:
@ -57,8 +57,8 @@ matrix_synapse_base_config:
federation_rc_sleep_delay: 500
federation_rc_reject_limit: 50
federation_rc_concurrent: 3
media_store_path: /opt/synapse/media_store
uploads_path: /opt/synapse/uploads
media_store_path: "{{ matrix_synapse_base_path }}/media_store"
uploads_path: "{{ matrix_synapse_base_path }}/uploads"
max_upload_size: "23M"
max_image_pixels: "32M"
dynamic_thumbnails: false