Create a discourse cookbook that can be wrapped

It makes it possible to serve multiple Discord instances to different
hosts from a single nginx load balancer

Right now we run one for Kosmos and one for remoteStorage
This commit is contained in:
Greg Karékinian
2022-10-11 17:58:22 +02:00
parent e90b265f7e
commit 378fee85ec
30 changed files with 537 additions and 84 deletions

View File

@@ -0,0 +1,36 @@
# Generated by Chef
upstream _<%= @upstream_name %> {
<% @upstream_ip_addresses.each do |upstream_ip_address| -%>
server <%= upstream_ip_address %>:<%= @upstream_port %>;
<% end -%>
}
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
server {
server_name <%= @server_name %>;
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate <%= @ssl_cert %>;
ssl_certificate_key <%= @ssl_key %>;
add_header Strict-Transport-Security "max-age=31536000";
# Send real IP to the Docker container
set_real_ip_from 127.0.0.1;
real_ip_header X-Forwarded-For;
client_max_body_size 20M;
location / {
# Increase number of buffers. Default is 8
proxy_buffers 1024 8k;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://_<%= @upstream_name %>;
proxy_http_version 1.1;
}
}
<% end -%>