berth init
This commit is contained in:
32
berth/ctrl/render/nginx-proxy.tmpl
Normal file
32
berth/ctrl/render/nginx-proxy.tmpl
Normal file
@@ -0,0 +1,32 @@
|
||||
# ${NAME} — GENERATED by berth from estate/${ESTATE}.json. Do not edit.
|
||||
# Edit the estate file and re-run: make services render aws
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name ${FQDN};
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name ${FQDN};
|
||||
|
||||
ssl_certificate /etc/nginx/certs/live/${DOMAIN}/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/certs/live/${DOMAIN}/privkey.pem;
|
||||
|
||||
# Docker's embedded DNS. Naming the upstream in a VARIABLE forces runtime
|
||||
# resolution, so nginx STARTS even when the upstream container is absent.
|
||||
# With a literal proxy_pass, one stopped container takes the whole gateway
|
||||
# down at reload — which is what makes one nginx able to front a dozen
|
||||
# independent compose stacks.
|
||||
resolver 127.0.0.11 valid=30s;
|
||||
|
||||
location / {
|
||||
set $upstream_${NAME} ${UPSTREAM_HOST};
|
||||
proxy_pass http://$upstream_${NAME}:${UPSTREAM_PORT};
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
23
berth/ctrl/render/nginx-static.tmpl
Normal file
23
berth/ctrl/render/nginx-static.tmpl
Normal file
@@ -0,0 +1,23 @@
|
||||
# ${NAME} — GENERATED by berth from estate/${ESTATE}.json. Do not edit.
|
||||
# Edit the estate file and re-run: make services render aws
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name ${FQDN};
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name ${FQDN};
|
||||
|
||||
ssl_certificate /etc/nginx/certs/live/${DOMAIN}/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/certs/live/${DOMAIN}/privkey.pem;
|
||||
|
||||
root /usr/share/nginx/html/${NAME};
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
}
|
||||
32
berth/ctrl/render/nginx-upstream.tmpl
Normal file
32
berth/ctrl/render/nginx-upstream.tmpl
Normal file
@@ -0,0 +1,32 @@
|
||||
# ${NAME} — GENERATED by berth from estate/${ESTATE}.json. Do not edit.
|
||||
# Placement: ${PLACEMENT} (${PEER}) — reached over the overlay, not the docker network.
|
||||
|
||||
upstream ${NAME}_backend {
|
||||
server ${UPSTREAM_HOST}:${UPSTREAM_PORT};
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name ${FQDN};
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name ${FQDN};
|
||||
|
||||
ssl_certificate /etc/nginx/certs/live/${DOMAIN}/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/certs/live/${DOMAIN}/privkey.pem;
|
||||
|
||||
# No `resolver`, and no `set $var` indirection — deliberately. Those exist so
|
||||
# nginx starts when a CONTAINER is absent; this upstream is a literal address
|
||||
# on the overlay, which needs no DNS at all. The three properties are one
|
||||
# decision, and placement is what decides them.
|
||||
location / {
|
||||
proxy_pass http://${NAME}_backend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user