From 28d021089753c05e1991301fb3c00680db0ac942 Mon Sep 17 00:00:00 2001 From: Tobias Manske Date: Tue, 28 Mar 2023 13:11:48 +0200 Subject: [PATCH] Matrix: Replace nginx with caddy --- .../compose_project/templates/matrix/Caddyfile | 12 ++++++++++++ .../templates/matrix/docker-compose.yaml | 9 ++++----- .../templates/matrix/nginx-well-known.conf | 15 --------------- 3 files changed, 16 insertions(+), 20 deletions(-) create mode 100644 coreos-config/roles/compose_project/templates/matrix/Caddyfile delete mode 100644 coreos-config/roles/compose_project/templates/matrix/nginx-well-known.conf diff --git a/coreos-config/roles/compose_project/templates/matrix/Caddyfile b/coreos-config/roles/compose_project/templates/matrix/Caddyfile new file mode 100644 index 0000000..60fea5a --- /dev/null +++ b/coreos-config/roles/compose_project/templates/matrix/Caddyfile @@ -0,0 +1,12 @@ +{ + auto_https off +} + +http://{{ matrix.baseurl }} { + header { + Content-Type application/json + Access-Control-Allow-Origin * + } + respond /.well-known/matrix/client "{\"m.homeserver\": {\"base_url\": \"https://synapse.{{ matrix.baseurl }}\"} }" 200 + respond /.well-known/matrix/server "{\"m.server\": \"synapse.{{ matrix.baseurl }}:443\"}" 200 +} diff --git a/coreos-config/roles/compose_project/templates/matrix/docker-compose.yaml b/coreos-config/roles/compose_project/templates/matrix/docker-compose.yaml index 93ff3d0..9224f1f 100644 --- a/coreos-config/roles/compose_project/templates/matrix/docker-compose.yaml +++ b/coreos-config/roles/compose_project/templates/matrix/docker-compose.yaml @@ -61,12 +61,11 @@ services: timeout: 5s retries: 5 - nginx: - # FIXME: This could be caddyv2 - image: nginx:stable - restart: unless-stopped + caddy: + image: caddy:2 volumes: - - ./nginx-well-known.conf:/etc/nginx/conf.d/matrix.conf:ro,Z + - ./Caddyfile:/etc/caddy/Caddyfile:ro,z + restart: unless-stopped labels: - "traefik.enable=true" - "traefik.http.routers.matrix-well-known.rule=Host(`{{ matrix.baseurl }}`) && PathPrefix(`/.well-known/matrix/`)" diff --git a/coreos-config/roles/compose_project/templates/matrix/nginx-well-known.conf b/coreos-config/roles/compose_project/templates/matrix/nginx-well-known.conf deleted file mode 100644 index 7e2d96c..0000000 --- a/coreos-config/roles/compose_project/templates/matrix/nginx-well-known.conf +++ /dev/null @@ -1,15 +0,0 @@ -server { - listen 80; - server_name {{ matrix.baseurl }}; - location /.well-known/matrix/client { - return 200 '{"m.homeserver": {"base_url": "https://synapse.{{ matrix.baseurl }}"} }'; - default_type application/json; - add_header Access-Control-Allow-Origin *; - } - location /.well-known/matrix/server { - return 200 '{"m.server": "synapse.{{ matrix.baseurl }}:443" }'; - default_type application/json; - add_header Access-Control-Allow-Origin *; - } -} -