sync with previous repo
This commit is contained in:
CHANGELOG.mdLICENSEREADME.mdansible.cfgsetup.yml
docs
README.mdalternative-architectures.mdansible.mdconfiguring-awx-system.mdconfiguring-captcha.mdconfiguring-dns.mdconfiguring-playbook-base-domain-serving.mdconfiguring-playbook-bot-go-neb.mdconfiguring-playbook-bot-matrix-reminder-bot.mdconfiguring-playbook-bot-mjolnir.mdconfiguring-playbook-bridge-appservice-discord.mdconfiguring-playbook-bridge-appservice-irc.mdconfiguring-playbook-bridge-appservice-slack.mdconfiguring-playbook-bridge-appservice-webhooks.mdconfiguring-playbook-bridge-heisenbridge.mdconfiguring-playbook-bridge-matrix-bridge-sms.mdconfiguring-playbook-bridge-mautrix-facebook.mdconfiguring-playbook-bridge-mautrix-hangouts.mdconfiguring-playbook-bridge-mautrix-instagram.mdconfiguring-playbook-bridge-mautrix-signal.mdconfiguring-playbook-bridge-mautrix-telegram.mdconfiguring-playbook-bridge-mautrix-whatsapp.mdconfiguring-playbook-bridge-mx-puppet-discord.mdconfiguring-playbook-bridge-mx-puppet-groupme.mdconfiguring-playbook-bridge-mx-puppet-instagram.mdconfiguring-playbook-bridge-mx-puppet-skype.mdconfiguring-playbook-bridge-mx-puppet-slack.mdconfiguring-playbook-bridge-mx-puppet-steam.mdconfiguring-playbook-bridge-mx-puppet-twitter.mdconfiguring-playbook-client-element.mdconfiguring-playbook-client-hydrogen.mdconfiguring-playbook-dimension.mdconfiguring-playbook-dynamic-dns.mdconfiguring-playbook-email.mdconfiguring-playbook-email2matrix.mdconfiguring-playbook-etherpad.mdconfiguring-playbook-external-postgres.mdconfiguring-playbook-federation.mdconfiguring-playbook-jitsi.mdconfiguring-playbook-ldap-auth.mdconfiguring-playbook-ma1sd.mdconfiguring-playbook-matrix-corporal.mdconfiguring-playbook-matrix-registration.mdconfiguring-playbook-nginx.mdconfiguring-playbook-own-webserver.mdconfiguring-playbook-postgres-backup.mdconfiguring-playbook-prometheus-grafana.mdconfiguring-playbook-prometheus-postgres.mdconfiguring-playbook-rest-auth.mdconfiguring-playbook-riot-web.mdconfiguring-playbook-s3.mdconfiguring-playbook-shared-secret-auth.mdconfiguring-playbook-ssl-certificates.mdconfiguring-playbook-sygnal.mdconfiguring-playbook-synapse-admin.mdconfiguring-playbook-synapse-simple-antispam.mdconfiguring-playbook-synapse.mdconfiguring-playbook-telemetry.mdconfiguring-playbook-turn.mdconfiguring-playbook.mdconfiguring-well-known.mdcontainer-images.mdfaq.mdgetting-the-playbook.mdhowto-server-delegation.mdimporting-postgres.mdimporting-synapse-media-store.mdimporting-synapse-sqlite.mdinstalling.mdmaintenance-and-troubleshooting.mdmaintenance-checking-services.mdmaintenance-migrating.mdmaintenance-postgres.mdmaintenance-synapse.mdmaintenance-upgrading-services.mdprerequisites.mdregistering-users.mdself-building.mduninstalling.mdupdating-users-passwords.md
examples
group_vars
inventory
roles
matrix-aux
matrix-awx
defaults
scripts
surveys
access_export.json.j2backup_server.json.j2configure_corporal.json.j2configure_dimension.json.j2configure_element.json.j2configure_element_subdomain.json.j2configure_email_relay.json.j2configure_jitsi.json.j2configure_ma1sd.json.j2configure_synapse.json.j2configure_synapse_admin.json.j2configure_website_access_export.json.j2
tasks
backup_server.ymlcache_matrix_variables.ymlcreate_user.ymlcustomise_website_access_export.ymlexport_server.ymlimport_awx.ymlload_hosting_and_org_variables.ymlload_matrix_variables.ymlmain.ymlpurge_database_build_list.ymlpurge_database_events.ymlpurge_database_main.ymlpurge_database_no_local.ymlpurge_database_users.ymlpurge_media_local.ymlpurge_media_main.ymlpurge_media_remote.ymlrename_variables.ymlself_check.ymlset_variables_corporal.ymlset_variables_dimension.ymlset_variables_element.ymlset_variables_element_subdomain.ymlset_variables_jitsi.ymlset_variables_ma1sd.ymlset_variables_mailer.ymlset_variables_synapse.ymlset_variables_synapse_admin.yml
matrix-base
defaults
files
yum.repos.d
tasks
clean_up_old_files.ymlmain.ymlsanity_check.yml
server_base
setup_matrix_base.ymlsetup_matrix_user.ymlsetup_well_known.ymltemplates
vars
matrix-bot-go-neb
defaults
tasks
templates
matrix-bot-matrix-reminder-bot
defaults
tasks
templates
matrix-bot-mjolnir
defaults
tasks
templates
matrix-bridge-appservice-discord
defaults
tasks
templates
matrix-bridge-appservice-irc
defaults
tasks
templates
matrix-bridge-appservice-slack
defaults
tasks
templates
matrix-bridge-appservice-webhooks
defaults
tasks
templates
matrix-bridge-heisenbridge
defaults
tasks
templates
matrix-bridge-mautrix-facebook
defaults
tasks
templates
matrix-bridge-mautrix-hangouts
defaults
tasks
templates
matrix-bridge-mautrix-instagram
defaults
tasks
templates
matrix-bridge-mautrix-signal
defaults
tasks
templates
matrix-bridge-mautrix-telegram
defaults
tasks
templates
matrix-bridge-mautrix-whatsapp
defaults
tasks
templates
matrix-bridge-mx-puppet-discord
defaults
tasks
templates
matrix-bridge-mx-puppet-groupme
defaults
tasks
templates
matrix-bridge-mx-puppet-instagram
defaults
tasks
templates
matrix-bridge-mx-puppet-skype
defaults
tasks
templates
matrix-bridge-mx-puppet-slack
defaults
tasks
templates
matrix-bridge-mx-puppet-steam
defaults
tasks
templates
matrix-bridge-mx-puppet-twitter
defaults
tasks
templates
matrix-bridge-sms
defaults
tasks
templates
systemd
matrix-client-element
defaults
tasks
templates
vars
matrix-client-hydrogen
defaults
tasks
templates
matrix-common-after
defaults
tasks
matrix-corporal
defaults
tasks
templates
matrix-coturn
defaults
tasks
templates
matrix-dimension
defaults
tasks
templates
vars
matrix-dynamic-dns
defaults
tasks
templates
matrix-email2matrix
defaults
tasks
templates
matrix-etherpad
defaults
tasks
templates
matrix-grafana
defaults
tasks
templates
matrix-jitsi
defaults
tasks
init.ymlmain.ymlsetup_jitsi_base.ymlsetup_jitsi_jicofo.ymlsetup_jitsi_jvb.ymlsetup_jitsi_prosody.ymlsetup_jitsi_web.ymlvalidate_config.yml
templates
jicofo
jvb
prosody
web
matrix-ma1sd
defaults
tasks
init.ymlmain.ymlmigrate_mxisd.ymlself_check_ma1sd.ymlsetup_install.ymlsetup_uninstall.ymlvalidate_config.yml
templates
vars
matrix-mailer
defaults
tasks
templates
matrix-nginx-proxy
defaults
tasks
init.ymlmain.ymlself_check_well_known.ymlself_check_well_known_file.ymlsetup_nginx_proxy.ymlsetup_well_known.yml
ssl
main.ymlsetup_ssl_lets_encrypt.ymlsetup_ssl_lets_encrypt_obtain_for_domain.ymlsetup_ssl_manually_managed.ymlsetup_ssl_manually_managed_verify_for_domain.ymlsetup_ssl_self_signed.ymlsetup_ssl_self_signed_obtain_for_domain.yml
validate_config.ymltemplates
nginx
conf.d
matrix-base-domain.conf.j2matrix-bot-go-neb.conf.j2matrix-client-element.conf.j2matrix-client-hydrogen.conf.j2matrix-dimension.conf.j2matrix-domain.conf.j2matrix-grafana.conf.j2matrix-jitsi.conf.j2matrix-riot-web.conf.j2matrix-sygnal.conf.j2matrix-synapse.conf.j2nginx-http.conf.j2
matrix-synapse-metrics-htpasswd.j2nginx.conf.j2systemd
matrix-nginx-proxy.service.j2matrix-ssl-lets-encrypt-certificates-renew.service.j2matrix-ssl-lets-encrypt-certificates-renew.timer.j2matrix-ssl-nginx-proxy-reload.service.j2matrix-ssl-nginx-proxy-reload.timer.j2
usr-local-bin
vars
matrix-postgres-backup
matrix-postgres
defaults
tasks
import_generic_sqlite_db.ymlimport_postgres.ymlimport_synapse_sqlite_db.ymlinit.ymlmain.ymlmigrate_postgres_data_directory.ymlrun_vacuum.ymlsetup_postgres.ymlupgrade_postgres.yml
util
create_additional_database.ymlcreate_additional_databases.ymldetect_existing_postgres_version.ymlmigrate_db_to_postgres.yml
validate_config.ymltemplates
matrix-prometheus-node-exporter
defaults
tasks
templates
matrix-prometheus-postgres-exporter
defaults
tasks
templates
matrix-prometheus
defaults
tasks
templates
matrix-redis
defaults
tasks
templates
matrix-registration
defaults
tasks
generate_token.ymlinit.ymllist_tokens.ymlmain.ymlsetup_install.ymlsetup_uninstall.ymlvalidate_config.yml
templates
matrix-sygnal
defaults
tasks
templates
matrix-synapse-admin
defaults
tasks
templates
matrix-synapse
defaults
files
tasks
ext
goofys
import_media_store.ymlinit.ymlmain.ymlregister_user.ymlrust-synapse-compress-state
self_check_client_api.ymlself_check_federation_api.ymlsetup_synapse.ymlsynapse
update_user_password.ymlvalidate_config.ymltemplates
goofys
synapse
vars
12
examples/haproxy/Dockerfile
Normal file
12
examples/haproxy/Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
# Pull nginx base image
|
||||
FROM nginx:latest
|
||||
|
||||
# Expost port 80
|
||||
EXPOSE 80
|
||||
|
||||
# Copy custom configuration file from the current directory
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Start up nginx server
|
||||
CMD ["nginx"]
|
||||
|
26
examples/haproxy/README.md
Normal file
26
examples/haproxy/README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# HAproxy reverse-proxy
|
||||
|
||||
This directory contains sample files that show you how to do reverse-proxying using HAproxy.
|
||||
|
||||
This is for when you wish to have your own HAproxy instance sitting in front of Matrix services installed by this playbook.
|
||||
See the [Using your own webserver, instead of this playbook's nginx proxy](../../docs/configuring-playbook-own-webserver.md) documentation page.
|
||||
|
||||
To use your own HAproxy reverse-proxy, you first need to disable the integrated Nginx server.
|
||||
You do that with the following custom configuration (`inventory/host_vars/matrix.<your-domain>/vars.yml`):
|
||||
|
||||
```yaml
|
||||
matrix_nginx_proxy_enabled: false
|
||||
```
|
||||
|
||||
You can then use the configuration files from this directory as an example for how to configure your HAproxy reverse proxy.
|
||||
|
||||
**NOTE**: this is just an example and may not be entirely accurate. It may also not cover other use cases or performance needs.
|
||||
|
||||
### Configuration
|
||||
|
||||
HAproxy, unlike Apache, Nginx and others, does not provide you with a webserver to serve static files (i.e., `/.well-known/` directory). For this reason, in this folder you can find an example on how to use HAproxy together with a simple Nginx container whose only task is to serve those files.
|
||||
|
||||
* Build the Docker image. `docker build -t local/nginx .`
|
||||
* Start the container. `docker-compose up -d`. Note that if you want to run Nginx on a different port, you will have to change the port both in the `docker-compose.yml` and in `haproxy.cfg`.
|
||||
* If you don't want to use a wildcard certificate, you will need to modify the corresponding line in the HTTPS frontent and add the paths of all the specific certificates (as for the commented example in `haproxy.cfg`).
|
||||
* Start HAproxy with the proposed configuration.
|
8
examples/haproxy/docker-compose.yml
Normal file
8
examples/haproxy/docker-compose.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
version: '3'
|
||||
services:
|
||||
nginx:
|
||||
image: local/nginx
|
||||
ports:
|
||||
- 40888:80
|
||||
volumes:
|
||||
- /matrix/static-files:/var/www/:ro
|
97
examples/haproxy/haproxy.cfg
Normal file
97
examples/haproxy/haproxy.cfg
Normal file
@@ -0,0 +1,97 @@
|
||||
global
|
||||
log /dev/log local0
|
||||
log /dev/log local1 notice
|
||||
chroot /var/lib/haproxy
|
||||
stats socket /run/haproxy/admin.sock mode 660 level admin
|
||||
stats timeout 30s
|
||||
user haproxy
|
||||
group haproxy
|
||||
daemon
|
||||
# Default SSL material locations
|
||||
ca-base /etc/ssl/certs
|
||||
crt-base /etc/ssl/private
|
||||
# Default ciphers to use on SSL-enabled listening sockets.
|
||||
# For more information, see ciphers(1SSL). This list is from:
|
||||
# https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
|
||||
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
|
||||
ssl-default-bind-options no-sslv3
|
||||
|
||||
defaults
|
||||
log global
|
||||
mode http
|
||||
option httplog
|
||||
option dontlognull
|
||||
option forwardfor
|
||||
option redispatch
|
||||
timeout connect 5000
|
||||
timeout client 50000
|
||||
timeout server 50000
|
||||
errorfile 400 /etc/haproxy/errors/400.http
|
||||
errorfile 403 /etc/haproxy/errors/403.http
|
||||
errorfile 408 /etc/haproxy/errors/408.http
|
||||
errorfile 500 /etc/haproxy/errors/500.http
|
||||
errorfile 502 /etc/haproxy/errors/502.http
|
||||
errorfile 503 /etc/haproxy/errors/503.http
|
||||
errorfile 504 /etc/haproxy/errors/504.http
|
||||
|
||||
frontend https-frontend
|
||||
bind *:80
|
||||
# HAproxy wants the full chain and the private key in one file. For Letsencrypt manually generated certs (e.g., wildcard certs) you can use
|
||||
# cat /etc/letsencrypt/live/example.com/fullchain.pem /etc/letsencrypt/live/example.com/privkey.pem > /etc/haproxy/certs/star-example.com.pem
|
||||
bind *:443 ssl crt /etc/haproxy/certs/star-example.com.pem
|
||||
#bind *:443 ssl crt /etc/haproxy/certs/element.example.com.pem /etc/haproxy/certs/matrix.example.com.pem
|
||||
reqadd X-Forwarded-Proto:\ https
|
||||
option httplog
|
||||
option http-server-close
|
||||
#
|
||||
# Matrix
|
||||
#
|
||||
# matrix.example.com
|
||||
acl matrix_domain hdr_dom(host) -i matrix.example.com
|
||||
acl static_files path -i -m beg /.well-known/matrix
|
||||
use_backend nginx-static if static_files
|
||||
# /_matrix/identity and /_matrix/client/r0/user_directory/search
|
||||
acl matrix_identity path -i -m beg /_matrix/identity
|
||||
acl matrix_search path -i -m beg /_matrix/client/r0/user_directory/search
|
||||
# Send to :8090
|
||||
use_backend matrix-supporting if matrix_identity or matrix_search
|
||||
# /_matrix and /_synapse/admin
|
||||
acl matrix_path path -i -m beg /_matrix
|
||||
acl synapse_admin path -i -m beg /_synapse/admin
|
||||
# Send to :8008
|
||||
use_backend matrix-main if matrix_path or synapse_admin
|
||||
# element.example.com
|
||||
acl element_domain hdr_dom(host) -i element.example.com
|
||||
# Send to 8765
|
||||
use_backend element if element_domain
|
||||
# If nothing else match, just send to default matrix backend
|
||||
use_backend matrix-main if matrix_domain
|
||||
#default_backend matrix-main
|
||||
|
||||
frontend matrix-federation
|
||||
bind *:8448 ssl crt /etc/haproxy/certs/star-example.com.pem
|
||||
reqadd X-Forwarded-Proto:\ https
|
||||
option httplog
|
||||
option http-server-close
|
||||
default_backend synapse
|
||||
|
||||
backend matrix-supporting
|
||||
server matrix-supporting 127.0.0.1:8090 check
|
||||
|
||||
backend matrix-main
|
||||
server matrix-main 127.0.0.1:8008 check
|
||||
|
||||
backend synapse
|
||||
server synapse 127.0.0.1:8048 check
|
||||
|
||||
backend nginx-static
|
||||
capture request header origin len 128
|
||||
http-response add-header Access-Control-Allow-Origin *
|
||||
rspadd Access-Control-Allow-Methods:\ GET,\ HEAD,\ OPTIONS,\ POST,\ PUT if { capture.req.hdr(0) -m found }
|
||||
rspadd Access-Control-Allow-Credentials:\ true if { capture.req.hdr(0) -m found }
|
||||
rspadd Access-Control-Allow-Headers:\ Origin,\ Accept,\ X-Requested-With,\ Content-Type,\ Access-Control-Request-Method,\ Access-Control-Request-Headers,\ Authorization if { capture.req.hdr(0) -m found }
|
||||
server nginx 127.0.0.1:40888 check
|
||||
|
||||
backend element
|
||||
server element 127.0.0.1:8765 check
|
||||
|
15
examples/haproxy/nginx.conf
Normal file
15
examples/haproxy/nginx.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
worker_processes auto;
|
||||
daemon off;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
server_tokens off;
|
||||
server {
|
||||
listen 80;
|
||||
index index.html;
|
||||
root /var/www;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user