diff --git a/.env b/.env index 5d73f95..96449e9 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ PROD_URL=matrix.gmoker.com -PUBLIC_URL=gmoker.com +SERVER_NAME=test.k8s.gmoker.com IMAGEAPP=ghcr.io/element-hq/synapse:v1.106.0 TURN_URL=turn.test.gmoker.com diff --git a/homeserver.yaml b/homeserver.yaml index cb525d5..823f329 100644 --- a/homeserver.yaml +++ b/homeserver.yaml @@ -1,5 +1,5 @@ -server_name: "$BASE_URL" -public_baseurl: "https://$PUBLIC_URL" +server_name: "$SERVER_NAME" +public_baseurl: "https://$BASE_URL" pid_file: /homeserver.pid web_client: false soft_file_limit: 0 @@ -91,5 +91,3 @@ password_config: enabled: true encryption_enabled_by_default_for_room_type: "all" - -serve_server_wellknown: true diff --git a/manifests/bin/deploy.sh b/manifests/bin/deploy.sh index dc78e44..31c4fac 100755 --- a/manifests/bin/deploy.sh +++ b/manifests/bin/deploy.sh @@ -51,6 +51,7 @@ kcreatecm synapse-config \ --from-file=homeserver.yaml=<(envsubst "$(env | xargs printf '$%s ')" < homeserver.yaml) \ --from-file=log.config=<(envsubst "$(env | xargs printf '$%s ')" < log.config) -kapply common/keys.yaml common/app.yaml +kapply common/keys.yaml common/app.yaml common/delegation.yaml +kubectl rollout restart deployment delegation kubectl rollout restart statefulset app diff --git a/manifests/bin/prod.sh b/manifests/bin/prod.sh index bbcd0b9..db50906 100755 --- a/manifests/bin/prod.sh +++ b/manifests/bin/prod.sh @@ -4,7 +4,3 @@ export NB_REPLICAS=1 . ./manifests/bin/deploy.sh - -kapply prod/delegation.yaml - -kubectl rollout restart deployment delegation diff --git a/manifests/prod/delegation.yaml b/manifests/common/delegation.yaml similarity index 84% rename from manifests/prod/delegation.yaml rename to manifests/common/delegation.yaml index 42308b7..79538ef 100644 --- a/manifests/prod/delegation.yaml +++ b/manifests/common/delegation.yaml @@ -10,9 +10,9 @@ spec: tls: - secretName: tls-delegation hosts: - - "$PUBLIC_URL" + - "$SERVER_NAME" rules: - - host: "$PUBLIC_URL" + - host: "$SERVER_NAME" http: paths: - path: /.well-known/matrix/server @@ -53,11 +53,17 @@ data: server { listen 80; + location /.well-known/matrix/server { + default_type application/json; + add_header Access-Control-Allow-Origin *; + + return 200 '{"m.server": "$BASE_URL:443"}' + } location /.well-known/matrix/client { default_type application/json; add_header Access-Control-Allow-Origin *; - return 200 '{"m.homeserver": { "base_url": "https://$BASE_URL" }}'; + return 200 '{"m.homeserver": {"base_url": "https://$BASE_URL"}}'; } } --- diff --git a/new_user.sh b/new_user.sh index 93e8ca0..5699151 100755 --- a/new_user.sh +++ b/new_user.sh @@ -1,3 +1,3 @@ #!/bin/bash -e -kubectl exec -it -n synapse svc/app -- register_new_matrix_user -c /config/homeserver.yaml +kubectl exec -it svc/app -- register_new_matrix_user -c /config/homeserver.yaml