Add support for matrix-corporal

This commit is contained in:
Slavi Pantaleev
2018-08-21 13:34:34 +03:00
parent 76e904eb70
commit 5398d80f01
11 changed files with 236 additions and 5 deletions

View File

@ -0,0 +1,30 @@
{
"Matrix": {
"HomeserverDomainName": "{{ hostname_identity }}",
"HomeserverApiEndpoint": "http://matrix-synapse:8008",
"AuthSharedSecret": "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret }}",
"RegistrationSharedSecret": "{{ matrix_synapse_registration_shared_secret }}",
"TimeoutMilliseconds": {{ matrix_corporal_matrix_timeout_milliseconds }}
},
"Reconciliation": {
"UserId": "@{{ matrix_corporal_reconciliation_user_id_local_part }}:{{ hostname_identity }}",
"RetryIntervalMilliseconds": {{ matrix_corporal_reconciliation_retry_interval_milliseconds }}
},
"HttpGateway": {
"ListenAddress": "0.0.0.0:41080"
},
"HttpApi": {
"Enabled": {{ 'true' if matrix_corporal_http_api_enabled else 'false' }},
"ListenAddress": "0.0.0.0:41081",
"AuthorizationBearerToken": "{{ matrix_corporal_http_api_auth_token }}"
},
"PolicyProvider": {{ matrix_corporal_policy_provider_config }},
"Misc": {
"Debug": {{ 'true' if matrix_corporal_debug else 'false' }}
}
}

View File

@ -42,6 +42,20 @@ server {
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
{% if matrix_corporal_enabled and matrix_corporal_http_api_enabled %}
location /_matrix/corporal {
{% if matrix_nginx_proxy_enabled %}
{# Use the embedded DNS resolver in Docker containers to discover the service #}
resolver 127.0.0.11 valid=5s;
set $backend "matrix-corporal:41081";
proxy_pass http://$backend;
{% else %}
{# Generic configuration for use outside of our container setup #}
proxy_pass http://localhost:41081;
{% endif %}
}
{% endif %}
{% if matrix_mxisd_enabled %}
location /_matrix/identity {
{% if matrix_nginx_proxy_enabled %}
@ -60,11 +74,11 @@ server {
{% if matrix_nginx_proxy_enabled %}
{# Use the embedded DNS resolver in Docker containers to discover the service #}
resolver 127.0.0.11 valid=5s;
set $backend "matrix-synapse:8008";
set $backend "{{ matrix_nginx_proxy_matrix_client_api_addr_with_proxy_container }}";
proxy_pass http://$backend;
{% else %}
{# Generic configuration for use outside of our container setup #}
proxy_pass http://localhost:8008;
proxy_pass http://{{ matrix_nginx_proxy_matrix_client_api_addr_sans_proxy_container }};
{% endif %}
proxy_set_header X-Forwarded-For $remote_addr;

View File

@ -0,0 +1,30 @@
[Unit]
Description=Matrix Corporal
After=docker.service
Requires=docker.service
Requires=matrix-synapse.service
After=matrix-synapse.service
[Service]
Type=simple
ExecStartPre=-/usr/bin/docker kill matrix-corporal
ExecStartPre=-/usr/bin/docker rm matrix-corporal
ExecStart=/usr/bin/docker run --rm --name matrix-corporal \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--network={{ matrix_docker_network }} \
{% if not matrix_nginx_proxy_enabled %}
-p 127.0.0.1:41080:41080 \
-p 127.0.0.1:41081:41081 \
{% endif %}
-v {{ matrix_corporal_config_dir_path }}:/etc/matrix-corporal:ro \
-v {{ matrix_corporal_cache_dir_path }}:/var/cache/matrix-corporal:rw \
-v {{ matrix_corporal_var_dir_path }}:/var/matrix-corporal:rw \
{{ matrix_corporal_docker_image }} \
/matrix-corporal -config=/etc/matrix-corporal/config.json
ExecStop=-/usr/bin/docker kill matrix-corporal
ExecStop=-/usr/bin/docker rm matrix-corporal
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target

View File

@ -3,6 +3,9 @@ Description=Matrix nginx proxy server
After=docker.service
Requires=docker.service
Wants=matrix-synapse.service
{% if matrix_corporal_enabled %}
Wants=matrix-corporal.service
{% endif %}
{% if matrix_riot_web_enabled %}
Wants=matrix-riot-web.service
{% endif %}