Skip to content

Commit 86bac4c

Browse files
committed
Support multiple domains in dev
1 parent be8e5ee commit 86bac4c

3 files changed

Lines changed: 101 additions & 11 deletions

File tree

bases/nginx/configmap.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,29 +91,31 @@ data:
9191
events {}
9292
9393
http {
94-
# --- SSL Configuration ---
95-
# These files are populated as volumes mounted to the pods from secrets drawn from an
96-
# external secret store.
97-
ssl_certificate /etc/nginx/tls.crt;
98-
ssl_certificate_key /etc/nginx/tls.key;
99-
ssl_session_cache shared:SSL:10m;
100-
ssl_session_timeout 10m;
101-
102-
# Enable gzip compression
103-
gzip on;
104-
10594
upstream stalwart-https {
10695
# The "stalwart-https" server is a Kubernetes Service exposing Stalwart's HTTPS port to
10796
# internal sources.
10897
server stalwart-https:443;
10998
}
11099
111100
server {
101+
# --- Domain setup
112102
server_name $TODO_KUSTOMIZE;
113103
listen 443 ssl;
114104
keepalive_timeout 60s;
115105
proxy_connect_timeout 1s;
116106
107+
# --- SSL Configuration ---
108+
# These files are populated as volumes mounted to the pods from secrets drawn from an
109+
# external secret store.
110+
ssl_certificate /etc/nginx/tls.crt;
111+
ssl_certificate_key /etc/nginx/tls.key;
112+
ssl_session_cache shared:SSL:10m;
113+
ssl_session_timeout 10m;
114+
115+
# Enable gzip compression
116+
gzip on;
117+
gzip_types text/html application/json;
118+
117119
# Specifically block access to these routes
118120
location ^~ /account { # Stalwart's user account settings system, superceded by thunderbird-accounts
119121
return 404;

overlays/tb-dev/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ images:
1414
patches:
1515
- path: nginx/aws/security-groups.yaml
1616
- path: nginx/configmap.yaml
17+
- path: nginx/deployment.yaml
1718
- path: stalwart-mail/aws/elasticache.yaml
1819
- path: stalwart-mail/aws/s3.yaml
1920
- path: stalwart-mail/aws/security-groups.yaml

overlays/tb-dev/nginx/configmap.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,93 @@ data:
7979
8080
events {}
8181
82+
http {
83+
upstream stalwart-https {
84+
# The "stalwart-https" server is a Kubernetes Service exposing Stalwart's HTTPS port to
85+
# internal sources.
86+
server stalwart-https:443;
87+
}
88+
89+
server {
90+
# --- Dev domain server ---
91+
server_name *.dev-thundermail.com;
92+
listen 443 ssl;
93+
keepalive_timeout 60s;
94+
proxy_connect_timeout 1s;
95+
96+
# --- SSL Configuration ---
97+
# These files are populated as volumes mounted to the pods from secrets drawn from an
98+
# external secret store.
99+
ssl_certificate /etc/nginx/dev-thundermail.crt;
100+
ssl_certificate_key /etc/nginx/dev-thundermail.key;
101+
ssl_session_cache shared:SSL:10m;
102+
ssl_session_timeout 10m;
103+
104+
# Enable gzip compression
105+
gzip on;
106+
gzip_types text/html application/json;
107+
108+
# Specifically block access to these routes
109+
location ^~ /account { # Stalwart's user account settings system, superceded by thunderbird-accounts
110+
return 404;
111+
}
112+
113+
location ^~ /admin { # Stalwart's web admin console, only accessible by private route
114+
return 404;
115+
}
116+
117+
location ^~ /api { # Stalwart's underlying API system, only accessible by private route
118+
return 404;
119+
}
120+
121+
# All other routes are acceptable, and should be proxied to the backend
122+
location ^~ / {
123+
proxy_pass https://stalwart-https;
124+
proxy_set_header Host mail.dev-thundermail.com;
125+
proxy_ssl_name mail.dev-thundermail.com;
126+
}
127+
}
128+
129+
server {
130+
# --- Stage domain server ---
131+
server_name *.stage-thundermail.com;
132+
listen 443 ssl;
133+
keepalive_timeout 60s;
134+
proxy_connect_timeout 1s;
135+
136+
# --- SSL Configuration ---
137+
# These files are populated as volumes mounted to the pods from secrets drawn from an
138+
# external secret store.
139+
ssl_certificate /etc/nginx/stage-thundermail.crt;
140+
ssl_certificate_key /etc/nginx/stage-thundermail.key;
141+
ssl_session_cache shared:SSL:10m;
142+
ssl_session_timeout 10m;
143+
144+
# Enable gzip compression
145+
gzip on;
146+
gzip_types text/html application/json;
147+
148+
# Specifically block access to these routes
149+
location ^~ /account { # Stalwart's user account settings system, superceded by thunderbird-accounts
150+
return 404;
151+
}
152+
153+
location ^~ /admin { # Stalwart's web admin console, only accessible by private route
154+
return 404;
155+
}
156+
157+
location ^~ /api { # Stalwart's underlying API system, only accessible by private route
158+
return 404;
159+
}
160+
161+
# All other routes are acceptable, and should be proxied to the backend
162+
location ^~ / {
163+
proxy_pass https://stalwart-https;
164+
proxy_set_header Host mail.stage-thundermail.com;
165+
proxy_ssl_name mail.stage-thundermail.com;
166+
}
167+
}
168+
82169
http {
83170
# --- SSL Configuration ---
84171
# These files are populated as volumes mounted to the pods from secrets drawn from an

0 commit comments

Comments
 (0)