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 *; - } -} -