Prefix outlets with a priority

This commit is contained in:
Bianca Nenciu 2025-05-06 23:27:15 +03:00
parent 900902f9e2
commit ed762bd3d8
No known key found for this signature in database
GPG Key ID: 07E83B117A6B844D
6 changed files with 15 additions and 15 deletions

View File

@ -8,7 +8,7 @@ params:
run: run:
- file: - file:
path: "/etc/nginx/conf.d/outlets/server/offline-page.conf" path: "/etc/nginx/conf.d/outlets/server/30-offline-page.conf"
contents: | contents: |
error_page 502 /error_page.html; error_page 502 /error_page.html;
location /error_page.html { location /error_page.html {

View File

@ -113,14 +113,14 @@ hooks:
ACCOUNT_EMAIL=$$ENV_LETSENCRYPT_ACCOUNT_EMAIL ACCOUNT_EMAIL=$$ENV_LETSENCRYPT_ACCOUNT_EMAIL
- replace: - replace:
filename: "/etc/nginx/conf.d/outlets/server/https.conf" filename: "/etc/nginx/conf.d/outlets/server/20-https.conf"
from: /ssl_certificate.+/ from: /ssl_certificate.+/
to: | to: |
ssl_certificate /shared/ssl/$$ENV_DISCOURSE_HOSTNAME.cer; ssl_certificate /shared/ssl/$$ENV_DISCOURSE_HOSTNAME.cer;
ssl_certificate /shared/ssl/$$ENV_DISCOURSE_HOSTNAME_ecc.cer; ssl_certificate /shared/ssl/$$ENV_DISCOURSE_HOSTNAME_ecc.cer;
- replace: - replace:
filename: "/etc/nginx/conf.d/outlets/server/https.conf" filename: "/etc/nginx/conf.d/outlets/server/20-https.conf"
from: /ssl_certificate_key.+/ from: /ssl_certificate_key.+/
to: | to: |
ssl_certificate_key /shared/ssl/$$ENV_DISCOURSE_HOSTNAME.key; ssl_certificate_key /shared/ssl/$$ENV_DISCOURSE_HOSTNAME.key;

View File

@ -7,7 +7,7 @@ params:
run: run:
- file: - file:
path: "/etc/nginx/conf.d/outlets/before-server/ratelimited.conf" path: "/etc/nginx/conf.d/outlets/before-server/30-ratelimited.conf"
contents: | contents: |
limit_req_zone $binary_remote_addr zone=flood:10m rate=$reqs_per_secondr/s; limit_req_zone $binary_remote_addr zone=flood:10m rate=$reqs_per_secondr/s;
limit_req_zone $binary_remote_addr zone=bot:10m rate=$reqs_per_minuter/m; limit_req_zone $binary_remote_addr zone=bot:10m rate=$reqs_per_minuter/m;
@ -16,7 +16,7 @@ run:
limit_conn_status 429; limit_conn_status 429;
- file: - file:
path: "/etc/nginx/conf.d/outlets/discourse/ratelimited.conf" path: "/etc/nginx/conf.d/outlets/discourse/30-ratelimited.conf"
contents: | contents: |
limit_conn connperip $conn_per_ip; limit_conn connperip $conn_per_ip;
limit_req zone=flood burst=$burst_per_second nodelay; limit_req zone=flood burst=$burst_per_second nodelay;

View File

@ -12,13 +12,13 @@ run:
#!/bin/bash #!/bin/bash
rm -rf /shared/nginx.http*.sock rm -rf /shared/nginx.http*.sock
- replace: - replace:
filename: "/etc/nginx/conf.d/outlets/server/http.conf" filename: "/etc/nginx/conf.d/outlets/server/10-http.conf"
from: /listen 80;(\nlisten \[::\]:80;)?/ from: /listen 80;(\nlisten \[::\]:80;)?/
to: | to: |
listen unix:/shared/nginx.http.sock; listen unix:/shared/nginx.http.sock;
set_real_ip_from unix:; set_real_ip_from unix:;
- replace: - replace:
filename: "/etc/nginx/conf.d/outlets/server/https.conf" filename: "/etc/nginx/conf.d/outlets/server/20-https.conf"
from: /listen 443 ssl;(\nlisten \[::\]:443 ssl;)?/ from: /listen 443 ssl;(\nlisten \[::\]:443 ssl;)?/
to: | to: |
listen unix:/shared/nginx.https.sock ssl; listen unix:/shared/nginx.https.sock ssl;

View File

@ -3,16 +3,16 @@ run:
cmd: cmd:
- "mkdir -p /shared/ssl/" - "mkdir -p /shared/ssl/"
- file: - file:
path: "/etc/nginx/conf.d/outlets/before-server/redirect-http-to-https.conf" path: "/etc/nginx/conf.d/outlets/before-server/10-redirect-http-to-https.conf"
contents: | contents: |
server { server {
listen 80; listen 80;
return 301 https://$$ENV_DISCOURSE_HOSTNAME$request_uri; return 301 https://$$ENV_DISCOURSE_HOSTNAME$request_uri;
} }
- exec: rm /etc/nginx/conf.d/outlets/server/http.conf - exec: rm /etc/nginx/conf.d/outlets/server/10-http.conf
- file: - file:
hook: ssl hook: ssl
path: "/etc/nginx/conf.d/outlets/server/https.conf" path: "/etc/nginx/conf.d/outlets/server/20-https.conf"
contents: | contents: |
listen 443 ssl; listen 443 ssl;
http2 on; http2 on;
@ -34,13 +34,13 @@ run:
rewrite (.*) https://$$ENV_DISCOURSE_HOSTNAME$1 permanent; rewrite (.*) https://$$ENV_DISCOURSE_HOSTNAME$1 permanent;
} }
- file: - file:
path: "/etc/nginx/conf.d/outlets/discourse/https.conf" path: "/etc/nginx/conf.d/outlets/discourse/20-https.conf"
contents: | contents: |
add_header Strict-Transport-Security 'max-age=31536000'; add_header Strict-Transport-Security 'max-age=31536000';
- exec: - exec:
cmd: cmd:
- |- - |-
if [ -f "/proc/net/if_inet6" ] ; then if [ -f "/proc/net/if_inet6" ] ; then
sed -i 's/listen 80;/listen 80;\nlisten [::]:80;/g' /etc/nginx/conf.d/outlets/before-server/redirect-http-to-https.conf sed -i 's/listen 80;/listen 80;\nlisten [::]:80;/g' /etc/nginx/conf.d/outlets/before-server/10-redirect-http-to-https.conf
sed -i 's/listen 443 ssl;/listen 443 ssl;\nlisten [::]:443 ssl;/g' /etc/nginx/conf.d/outlets/server/https.conf sed -i 's/listen 443 ssl;/listen 443 ssl;\nlisten [::]:443 ssl;/g' /etc/nginx/conf.d/outlets/server/20-https.conf
fi fi

View File

@ -165,9 +165,9 @@ run:
- sed -i 's#listen 80;##g' /etc/nginx/conf.d/discourse.conf - sed -i 's#listen 80;##g' /etc/nginx/conf.d/discourse.conf
- |- - |-
if [ -f "/proc/net/if_inet6" ]; then if [ -f "/proc/net/if_inet6" ]; then
echo "listen 80;\nlisten [::]:80;" > /etc/nginx/conf.d/outlets/server/http.conf echo "listen 80;\nlisten [::]:80;" > /etc/nginx/conf.d/outlets/server/10-http.conf
else else
echo "listen 80;" > /etc/nginx/conf.d/outlets/server/http.conf echo "listen 80;" > /etc/nginx/conf.d/outlets/server/10-http.conf
fi fi
- exec: - exec: