infrastructure/roles/matrix_delegate/templates/docker-compose.yml

65 lines
2.6 KiB
YAML

---
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
# Copyright (C) 2019-2020 Alexander (w4tsn) Wellbrock
# Copyright (C) 2021 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
version: '2'
services:
delegate:
image: docker.io/library/nginx:{{ matrix_delegate_nginx_image_version }}
mem_limit: 256mb
memswap_limit: 512mb
read_only: true
tmpfs:
- "/var/cache/nginx:size=10M"
- "/run/nginx:size=512K"
- "/tmp:size=128K"
security_opt:
- no-new-privileges
volumes:
- "{{ matrix_delegate_install_location }}/server-delegation.json:/usr/share/nginx/html/.well-known/matrix/server:ro"
- "{{ matrix_delegate_install_location }}/client-delegation.json:/usr/share/nginx/html/.well-known/matrix/client:ro"
- "{{ matrix_delegate_install_location }}/nginx.conf:/etc/nginx/nginx.conf:ro"
labels:
- "traefik.enable=true"
- "traefik.http.routers.matrix-delegate.rule=Host(`{{ matrix_delegate_domain }}`) && PathPrefix(`/.well-known/matrix`)"
- "traefik.http.routers.matrix-delegate.entrypoints=websecure"
- "traefik.http.routers.matrix-delegate.tls.certresolver={{ matrix_delegate_traefik_certresolver }}"
- "traefik.http.routers.matrix-delegate.middlewares=matrix-delegate,compress"
- "traefik.http.middlewares.matrix-delegate.headers.sslredirect=true"
- "traefik.http.middlewares.matrix-delegate.headers.stsSeconds=63072000"
- "traefik.http.middlewares.matrix-delegate.headers.referrerPolicy=no-referrer"
{% if proxy_network is defined %}
- "traefik.docker.network={{ proxy_network }}"
{% endif %}
{% if proxy_hiddenservice is defined and proxy_hiddenservice.content is defined %}
- "traefik.http.middlewares.matrix-delegate.headers.customresponseheaders.alt-svc:h2={{ proxy_hiddenservice['content'] | b64decode | trim }}:443; ma=2592000"
{% endif %}
restart: always
{% if proxy_network is defined %}
networks:
{{ proxy_network }}:
{% endif %}
{% if proxy_network is defined %}
networks:
{{ proxy_network }}:
external: true
{% endif %}