-
Notifications
You must be signed in to change notification settings - Fork 747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Nginx config with outlets #913
Open
nbianca
wants to merge
1
commit into
main
Choose a base branch
from
dev-nginx-conf
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
# This file is deprecated; you can remove it from your app.yml | ||
# TODO(2026-01-01): Remove this file | ||
run: | ||
- exec: |- | ||
echo "Deprecation warning: sshd is no longer supported" | ||
echo "Remove templates/sshd.template.yml from your containers/*.yml files" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
# This file is deprecated; you can remove it from your app.yml | ||
# TODO(2026-01-01): Remove this file | ||
run: | ||
- exec: echo "Enabling IPv6 listener" | ||
- replace: | ||
filename: "/etc/nginx/conf.d/discourse.conf" | ||
from: listen 80; | ||
to: | | ||
listen 80; | ||
listen [::]:80; | ||
- exec: |- | ||
echo "Deprecation warning: IPv6 is enabled by default when possible" | ||
echo "Remove templates/web.ipv6.template.yml from your containers/*.yml files" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,14 +12,14 @@ run: | |
#!/bin/bash | ||
rm -rf /shared/nginx.http*.sock | ||
- replace: | ||
filename: "/etc/nginx/conf.d/discourse.conf" | ||
from: /listen 80;/ | ||
filename: "/etc/nginx/conf.d/outlets/server/http.conf" | ||
from: /listen 80;(\nlisten \[::\]:80;)?/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still need to use a |
||
to: | | ||
listen unix:/shared/nginx.http.sock; | ||
set_real_ip_from unix:; | ||
- replace: | ||
filename: "/etc/nginx/conf.d/discourse.conf" | ||
from: /listen 443 ssl http2;/ | ||
filename: "/etc/nginx/conf.d/outlets/server/https.conf" | ||
from: /listen 443 ssl;(\nlisten \[::\]:443 ssl;)?/ | ||
to: | | ||
listen unix:/shared/nginx.https.sock ssl http2; | ||
listen unix:/shared/nginx.https.sock ssl; | ||
set_real_ip_from unix:; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,51 @@ | ||
run: | ||
- exec: | ||
cmd: | ||
- "mkdir -p /shared/ssl/" | ||
- replace: | ||
filename: "/etc/nginx/conf.d/discourse.conf" | ||
from: /server.+{/ | ||
to: | | ||
server { | ||
listen 80; | ||
return 301 https://$$ENV_DISCOURSE_HOSTNAME$request_uri; | ||
} | ||
server { | ||
- replace: | ||
filename: "/etc/nginx/conf.d/discourse.conf" | ||
from: /listen 80;\s+gzip on;/m | ||
to: | | ||
listen 443 ssl; | ||
http2 on; | ||
SSL_TEMPLATE_SSL_BLOCK | ||
- replace: | ||
filename: "/etc/nginx/conf.d/discourse.conf" | ||
from: /listen 80;\s+listen \[::\]:80;\s+gzip on;/m | ||
to: | | ||
listen 443 ssl; | ||
listen [::]:443 ssl; | ||
http2 on; | ||
SSL_TEMPLATE_SSL_BLOCK | ||
- replace: | ||
hook: ssl | ||
filename: "/etc/nginx/conf.d/discourse.conf" | ||
from: /SSL_TEMPLATE_SSL_BLOCK/ | ||
to: | | ||
|
||
ssl_protocols TLSv1.2 TLSv1.3; | ||
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; | ||
ssl_prefer_server_ciphers off; | ||
|
||
ssl_certificate /shared/ssl/ssl.crt; | ||
ssl_certificate_key /shared/ssl/ssl.key; | ||
|
||
ssl_session_tickets off; | ||
ssl_session_timeout 1d; | ||
ssl_session_cache shared:SSL:1m; | ||
|
||
gzip on; | ||
|
||
add_header Strict-Transport-Security 'max-age=31536000'; # remember the certificate for a year and automatically connect to HTTPS for this domain | ||
|
||
if ($http_host != $$ENV_DISCOURSE_HOSTNAME) { | ||
rewrite (.*) https://$$ENV_DISCOURSE_HOSTNAME$1 permanent; | ||
} | ||
- replace: | ||
filename: "/etc/nginx/conf.d/discourse.conf" | ||
from: "location @discourse {" | ||
to: | | ||
location @discourse { | ||
add_header Strict-Transport-Security 'max-age=31536000'; # remember the certificate for a year and automatically connect to HTTPS for this domain | ||
cmd: | ||
- "mkdir -p /shared/ssl/" | ||
|
||
- file: | ||
path: "/etc/nginx/conf.d/outlets/before-server/redirect-http-to-https.conf" | ||
contents: | | ||
server { | ||
listen 80; | ||
return 301 https://$$ENV_DISCOURSE_HOSTNAME$request_uri; | ||
} | ||
|
||
- exec: rm /etc/nginx/conf.d/outlets/server/http.conf | ||
|
||
- file: | ||
hook: ssl | ||
path: "/etc/nginx/conf.d/outlets/server/https.conf" | ||
contents: | | ||
listen 443 ssl; | ||
http2 on; | ||
|
||
ssl_protocols TLSv1.2 TLSv1.3; | ||
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; | ||
ssl_prefer_server_ciphers off; | ||
|
||
ssl_certificate /shared/ssl/ssl.crt; | ||
ssl_certificate_key /shared/ssl/ssl.key; | ||
|
||
ssl_session_tickets off; | ||
ssl_session_timeout 1d; | ||
ssl_session_cache shared:SSL:1m; | ||
|
||
add_header Strict-Transport-Security 'max-age=31536000'; | ||
|
||
if ($http_host != $$ENV_DISCOURSE_HOSTNAME) { | ||
rewrite (.*) https://$$ENV_DISCOURSE_HOSTNAME$1 permanent; | ||
} | ||
|
||
- file: | ||
path: "/etc/nginx/conf.d/outlets/discourse/https.conf" | ||
contents: | | ||
add_header Strict-Transport-Security 'max-age=31536000'; | ||
|
||
- exec: | ||
cmd: | ||
- |- | ||
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 443 ssl;/listen 443 ssl;\nlisten [::]:443 ssl;/g' /etc/nginx/conf.d/outlets/server/https.conf | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to consider deployments that have Discourse pinned to the
stable
branch. The outlets will not be present untilstable
is bumped to include the new nginx configuration.