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_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_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_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_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_version | "v0.99.1.1" |
| matrix_synapse_log_days_keep | 30 | | matrix_synapse_log_days_keep | 30 |
| matrix_synapse_deployment_method | pip | Either pip or docker [¹](#footnote_1) | | 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_supervision_method: systemd
matrix_synapse_base_path: "/opt/synapse" matrix_synapse_base_path: "/opt/synapse"
matrix_synapse_secrets_path: "{{ matrix_synapse_base_path }}/secrets" 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_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_version: "v0.99.1.1"
matrix_synapse_log_days_keep: 30 matrix_synapse_log_days_keep: 30
matrix_synapse_skip_tls: false 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_ports: ["8008:8008", "8448:8448"]
matrix_synapse_docker_labels: {} 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 - name: create directory
file: file:
path: /opt/synapse path: "{{ matrix_synapse_base_path }}"
state: directory state: directory
owner: synapse owner: synapse
group: synapse group: synapse
@ -46,12 +46,12 @@
loop: loop:
- "{{ matrix_synapse_config.media_store_path }}" - "{{ matrix_synapse_config.media_store_path }}"
- "{{ matrix_synapse_config.uploads_path }}" - "{{ matrix_synapse_config.uploads_path }}"
- /opt/synapse/tls - "{{ matrix_synapse_base_path }}/tls"
- name: Deploy config - name: Deploy config
copy: copy:
content: "{{ matrix_synapse_config | to_nice_yaml }}" content: "{{ matrix_synapse_config | to_nice_yaml }}"
dest: "/opt/synapse/homeserver.yaml" dest: "{{ matrix_synapse_base_path }}/homeserver.yaml"
owner: synapse owner: synapse
group: synapse group: synapse
notify: notify:

View file

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

View file

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

View file

@ -1,7 +1,7 @@
--- ---
- name: Deploy service file - name: Deploy service file
copy: template:
src: "matrix-synapse.service" src: "matrix-synapse.service.j2"
dest: "/etc/systemd/system/matrix-synapse.service" dest: "/etc/systemd/system/matrix-synapse.service"
notify: notify:
- "reload systemd" - "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 }}" - name: "{{ dbuser }}"
password: "{{ dbpw }}" password: "{{ dbpw }}"
postgresql_global_config_options: postgresql_global_config_options:
- option: listen_address - option: listen_addresses
value: "*" value: "*"
- role: matrix-ansible-synapse - role: matrix-ansible-synapse
matrix_server_name: localhost 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_config: "{{ matrix_synapse_base_config | combine(matrix_synapse_extra_config, recursive=True) }}"
matrix_synapse_base_config: matrix_synapse_base_config:
server_name: "{{ matrix_server_name }}" server_name: "{{ matrix_server_name }}"
tls_certificate_path: "/opt/synapse/tls/{{ matrix_server_name }}.crt" tls_certificate_path: "{{ matrix_synapse_base_path }}/tls/{{ matrix_server_name }}.crt"
tls_private_key_path: "/opt/synapse/tls/{{ matrix_server_name }}.key" tls_private_key_path: "{{ matrix_synapse_base_path }}/tls/{{ matrix_server_name }}.key"
acme: acme:
enabled: false enabled: false
url: https://acme-v01.api.letsencrypt.org/directory url: https://acme-v01.api.letsencrypt.org/directory
@ -12,7 +12,7 @@ matrix_synapse_base_config:
reprovision_threshold: 30 reprovision_threshold: 30
no_tls: false no_tls: false
tls_fingerprints: [] tls_fingerprints: []
pid_file: "/opt/synapse/synapse.pid" pid_file: "{{ matrix_synapse_base_path }}/synapse.pid"
soft_file_limit: 0 soft_file_limit: 0
use_presence: true use_presence: true
listeners: listeners:
@ -57,8 +57,8 @@ matrix_synapse_base_config:
federation_rc_sleep_delay: 500 federation_rc_sleep_delay: 500
federation_rc_reject_limit: 50 federation_rc_reject_limit: 50
federation_rc_concurrent: 3 federation_rc_concurrent: 3
media_store_path: /opt/synapse/media_store media_store_path: "{{ matrix_synapse_base_path }}/media_store"
uploads_path: /opt/synapse/uploads uploads_path: "{{ matrix_synapse_base_path }}/uploads"
max_upload_size: "23M" max_upload_size: "23M"
max_image_pixels: "32M" max_image_pixels: "32M"
dynamic_thumbnails: false dynamic_thumbnails: false