summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Fennell <matthew@fennell.dev>2026-01-02 01:17:03 +0000
committerMatthew Fennell <matthew@fennell.dev>2026-01-02 01:17:03 +0000
commit4daadd054bcaddff2ac9260b6cebcd31edc95da4 (patch)
tree39f250b4ef89db3863a356e8d266c26b8997b9dd
parent9535fc83e22cc9624535c84c3e8ddfa52e44b6ab (diff)
Enforce chat delegate prefix across all hosts
I use the playbook to deploy to three different domains. Before this commit, some instances were deployed to the root domain (e.g. example.org) and others were deployed to a subdomain (e.g. chat.example.org), so that other services/hosts could easily live at the root. I would now like to enforce that all instances live under the chat. subdomain. There is no real benefit to having this difference in deployments, having more consistency will make reasoning about the different instances easier and allow me to delete some extra variables, and it will also allow me to deploy separate services to the root domains in the future if needed.
-rw-r--r--files/nginx_conf.j26
-rw-r--r--files/virtual_host.cfg.lua.j28
-rw-r--r--playbook.yaml34
3 files changed, 17 insertions, 31 deletions
diff --git a/files/nginx_conf.j2 b/files/nginx_conf.j2
index ccdc630..3630f78 100644
--- a/files/nginx_conf.j2
+++ b/files/nginx_conf.j2
@@ -9,11 +9,11 @@ server {
ssl_certificate /etc/prosody/certs/{{ virtual_host }}.crt;
ssl_certificate_key /etc/prosody/certs/{{ virtual_host }}.key;
- server_name {{ delegate_host }};
+ server_name chat.{{ virtual_host }};
location / {
proxy_pass https://localhost:5281;
- proxy_set_header Host "{{ delegate_host }}";
+ proxy_set_header Host "chat.{{ virtual_host }}";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
@@ -25,7 +25,7 @@ server {
listen 80;
listen [::]:80;
- server_name {{ delegate_host }};
+ server_name chat.{{ virtual_host }};
return 301 https://$host$request_uri;
}
diff --git a/files/virtual_host.cfg.lua.j2 b/files/virtual_host.cfg.lua.j2
index 470281c..c5700c2 100644
--- a/files/virtual_host.cfg.lua.j2
+++ b/files/virtual_host.cfg.lua.j2
@@ -40,7 +40,7 @@ site_apps_show = {
{% if not is_transport_server %}
allow_user_invites = true
-http_external_url = "https://{{ virtual_host }}/"
+http_external_url = "https://chat.{{ virtual_host }}/"
site_name = "{{ virtual_host }}"
{% endif %}
@@ -71,11 +71,7 @@ http_file_share_access = {
Component "proxy.{{ virtual_host }}" "proxy65"
-{% if delegate_prefix == "" %}
-proxy65_address = "{{ virtual_host }}"
-{% else %}
-proxy65_address = "{{ delegate_prefix }}.{{ virtual_host }}"
-{% endif %}
+proxy65_address = "chat.{{ virtual_host }}"
modules_disabled = {
"s2s";
diff --git a/playbook.yaml b/playbook.yaml
index 2a2912b..7084f60 100644
--- a/playbook.yaml
+++ b/playbook.yaml
@@ -146,24 +146,24 @@
- subname: "conference"
type: CNAME
ttl: 3600
- records: ["{{ delegate_host }}."]
+ records: ["chat.{{ virtual_host }}."]
- subname: "upload"
type: CNAME
ttl: 3600
- records: ["{{ delegate_host }}."]
+ records: ["chat.{{ virtual_host }}."]
- subname: "_xmpp-client._tcp"
type: SRV
ttl: 3600
- records: ["0 5 5222 {{ delegate_host }}."]
+ records: ["0 5 5222 chat.{{ virtual_host }}."]
- subname: "_xmpps-client._tcp"
type: SRV
ttl: 3600
- records: ["0 5 5223 {{ delegate_host }}."]
- - subname: '{{ "_5222._tcp" + tlsa_appended_subdomain }}'
+ records: ["0 5 5223 chat.{{ virtual_host }}."]
+ - subname: "_5222._tcp.chat"
type: TLSA
ttl: 3600
records: ["3 1 1 {{ dane_hash.stdout }}"]
- - subname: '{{ "_5223._tcp" + tlsa_appended_subdomain }}'
+ - subname: "_5223._tcp.chat"
type: TLSA
ttl: 3600
records: ["3 1 1 {{ dane_hash.stdout }}"]
@@ -180,24 +180,24 @@
- subname: "_xmpp-server._tcp"
type: SRV
ttl: 3600
- records: ["0 5 5269 {{ delegate_host }}."]
+ records: ["0 5 5269 chat.{{ virtual_host }}."]
- subname: "_xmpps-server._tcp"
type: SRV
ttl: 3600
- records: ["0 5 5270 {{ delegate_host }}."]
+ records: ["0 5 5270 chat.{{ virtual_host }}."]
- subname: "_xmpps-server._tcp.upload"
type: SRV
ttl: 3600
- records: ["0 5 5270 {{ delegate_host }}."]
+ records: ["0 5 5270 chat.{{ virtual_host }}."]
- subname: "_xmpps-server._tcp.conference"
type: SRV
ttl: 3600
- records: ["0 5 5270 {{ delegate_host }}."]
- - subname: '{{ "_5269._tcp" + tlsa_appended_subdomain }}'
+ records: ["0 5 5270 chat.{{ virtual_host }}."]
+ - subname: "_5269._tcp.chat"
type: TLSA
ttl: 3600
records: ["3 1 1 {{ dane_hash.stdout }}"]
- - subname: '{{ "_5270._tcp" + tlsa_appended_subdomain }}'
+ - subname: "_5270._tcp.chat"
type: TLSA
ttl: 3600
records: ["3 1 1 {{ dane_hash.stdout }}"]
@@ -547,13 +547,3 @@
# If virtual_host is "continuous.nonprod.example.org", then ds_subname is
# "continuous.nonprod".
ds_subname: "{{ virtual_host | regex_replace('.' + domain_with_ds, '') }}"
-
- delegate_host: >-
- {{- virtual_host
- if delegate_prefix == ""
- else delegate_prefix + "." + virtual_host -}}
-
- tlsa_appended_subdomain: >-
- {{- ""
- if delegate_prefix == ""
- else "." + delegate_prefix -}}