- 
                Notifications
    You must be signed in to change notification settings 
- Fork 796
FEATURE: Move letsencrypt scripts to work on boot #977
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,21 +1,31 @@ | ||
| run: | ||
| - exec: | ||
| cmd: | ||
| - "mkdir -p /shared/ssl/" | ||
| - file: | ||
| path: "/etc/nginx/conf.d/outlets/before-server/20-redirect-http-to-https.conf" | ||
| path: /etc/runit/1.d/install-ssl | ||
| hook: ssl | ||
| chmod: "+x" | ||
| contents: | | ||
| #!/bin/bash | ||
| if [ -z "$DISCOURSE_HOSTNAME" ]; then echo "DISCOURSE_HOSTNAME expected"; exit 1; fi | ||
| if [ ! -z "$ENABLE_SSL" ]; then | ||
|         
                  featheredtoast marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved         
                  featheredtoast marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| exec /usr/local/bin/configure-ssl | ||
| fi | ||
|  | ||
| - file: | ||
| path: "/usr/local/bin/configure-ssl" | ||
| chmod: "+x" | ||
| contents: | | ||
| #!/bin/bash | ||
| mkdir -p /shared/ssl/ | ||
| cat << EOF > /etc/nginx/conf.d/outlets/before-server/20-redirect-http-to-https.conf | ||
|         
                  featheredtoast marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| server { | ||
| listen 80; | ||
| return 301 https://$$ENV_DISCOURSE_HOSTNAME$request_uri; | ||
| return 301 https://${DISCOURSE_HOSTNAME}$request_uri; | ||
| } | ||
| - file: | ||
| path: "/etc/nginx/conf.d/outlets/server/10-http.conf" | ||
| contents: "" | ||
| - file: | ||
| hook: ssl | ||
| path: "/etc/nginx/conf.d/outlets/server/20-https.conf" | ||
| contents: | | ||
| EOF | ||
|  | ||
| > /etc/nginx/conf.d/outlets/server/10-http.conf | ||
|          | ||
|  | ||
| cat << EOF > /etc/nginx/conf.d/outlets/server/20-https.conf | ||
| listen 443 ssl; | ||
| http2 on; | ||
|  | ||
|  | @@ -32,17 +42,15 @@ run: | |
|  | ||
| add_header Strict-Transport-Security 'max-age=31536000'; | ||
|  | ||
| if ($http_host != $$ENV_DISCOURSE_HOSTNAME) { | ||
| rewrite (.*) https://$$ENV_DISCOURSE_HOSTNAME$1 permanent; | ||
| if (\$http_host != ${DISCOURSE_HOSTNAME}) { | ||
| rewrite (.*) https://${DISCOURSE_HOSTNAME}\$1 permanent; | ||
| } | ||
| - file: | ||
| path: "/etc/nginx/conf.d/outlets/discourse/20-https.conf" | ||
| contents: | | ||
| EOF | ||
|  | ||
| cat << EOF > /etc/nginx/conf.d/outlets/discourse/20-https.conf | ||
| 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/20-redirect-http-to-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 | ||
| EOF | ||
|         
                  featheredtoast marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| if [ -f "/proc/net/if_inet6" ] ; then | ||
| sed -i 's/listen 80;/listen 80;\nlisten [::]:80;/g' /etc/nginx/conf.d/outlets/before-server/20-redirect-http-to-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 | ||
Uh oh!
There was an error while loading. Please reload this page.