matrix-docker-ansible-deploy/examples/haproxy
2019-08-25 22:53:34 +03:00
..
docker-compose.yml Adds doc for HAproxy 2019-08-25 22:53:34 +03:00
Dockerfile Adds doc for HAproxy 2019-08-25 22:53:34 +03:00
haproxy.cfg Adds doc for HAproxy 2019-08-25 22:53:34 +03:00
nginx.conf Adds doc for HAproxy 2019-08-25 22:53:34 +03:00
README.md Adds doc for HAproxy 2019-08-25 22:53:34 +03:00

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 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):

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 files.
  • Start HAproxy with the proposed configuration.