Skip to content

Commit be6d682

Browse files
committed
Simplify plugin outlets
1 parent 507c29f commit be6d682

File tree

9 files changed

+41
-24
lines changed

9 files changed

+41
-24
lines changed

templates/files/nginx/outlets/http/.gitkeep

Whitespace-only changes.

templates/files/nginx/outlets/http/http.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

templates/files/nginx/outlets/https/.gitkeep

Whitespace-only changes.

templates/files/nginx/outlets/https/https.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include conf.d/outlets/http/*.conf;
1+
listen 80;

templates/web.ipv6.template.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

templates/web.letsencrypt.ssl.template.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ hooks:
113113
ACCOUNT_EMAIL=$$ENV_LETSENCRYPT_ACCOUNT_EMAIL
114114
115115
- replace:
116-
filename: "/etc/nginx/conf.d/outlets/https/ssl.conf"
116+
filename: "/etc/nginx/conf.d/outlets/server/https.conf"
117117
from: /ssl_certificate.+/
118118
to: |
119119
ssl_certificate /shared/ssl/$$ENV_DISCOURSE_HOSTNAME.cer;
120120
ssl_certificate /shared/ssl/$$ENV_DISCOURSE_HOSTNAME_ecc.cer;
121121
122122
- replace:
123-
filename: "/etc/nginx/conf.d/outlets/https/ssl.conf"
123+
filename: "/etc/nginx/conf.d/outlets/server/https.conf"
124124
from: /ssl_certificate_key.+/
125125
to: |
126126
ssl_certificate_key /shared/ssl/$$ENV_DISCOURSE_HOSTNAME.key;

templates/web.ssl.template.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ run:
77
path: "/etc/nginx/conf.d/outlets/before-server/redirect-http-to-https.conf"
88
contents: |
99
server {
10-
include conf.d/outlets/http/*.conf;
10+
listen 80;
1111
return 301 https://$$ENV_DISCOURSE_HOSTNAME$request_uri;
1212
}
1313
@@ -16,14 +16,11 @@ run:
1616
contents: ""
1717

1818
- file:
19+
hook: ssl
1920
path: "/etc/nginx/conf.d/outlets/server/https.conf"
2021
contents: |
21-
include conf.d/outlets/https/*.conf;
22+
listen 443 ssl;
2223
23-
- file:
24-
hook: ssl
25-
path: "/etc/nginx/conf.d/outlets/https/ssl.conf"
26-
contents: |
2724
ssl_protocols TLSv1.2 TLSv1.3;
2825
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;
2926
ssl_prefer_server_ciphers off;
@@ -42,6 +39,14 @@ run:
4239
}
4340
4441
- file:
45-
path: "/etc/nginx/conf.d/outlets/discourse/ssl.conf"
42+
path: "/etc/nginx/conf.d/outlets/discourse/https.conf"
4643
contents: |
4744
add_header Strict-Transport-Security 'max-age=31536000';
45+
46+
- exec:
47+
cmd:
48+
- |-
49+
if [ -f "/proc/net/if_inet6" ] ; then
50+
sed -i 's/listen 80;/listen 80;\nlisten [::]:80;/g' /etc/nginx/conf.d/outlets/before-server/redirect-http-to-https.conf
51+
sed -i 's/listen 443 ssl;/listen 443 ssl;\nlisten [::]:443 ssl;/g' /etc/nginx/conf.d/outlets/server/https.conf
52+
fi

templates/web.template.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,13 @@ run:
152152
from: /client_max_body_size.+$/
153153
to: client_max_body_size $upload_size;
154154

155+
- exec:
156+
cmd:
157+
- |-
158+
if [ -f "/proc/net/if_inet6" ]; then
159+
sed -i 's/listen 80;/listen 80;\nlisten [::]:80;/g' /etc/nginx/conf.d/outlets/server/http.conf
160+
fi
161+
155162
- exec:
156163
cmd: echo "done configuring web"
157164
hook: web_config
@@ -192,6 +199,25 @@ run:
192199
hook: plugin_compatibility
193200
raise_on_fail: false
194201

202+
- exec:
203+
cd: $home
204+
tag: migrate
205+
hook: db_migrate
206+
cmd:
207+
- su discourse -c 'bundle exec rake db:migrate'
208+
- exec:
209+
cd: $home
210+
tag: build
211+
hook: assets_precompile_build
212+
cmd:
213+
- su discourse -c 'bundle exec rake assets:precompile:build'
214+
- exec:
215+
cd: $home
216+
tag: precompile
217+
hook: assets_precompile
218+
cmd:
219+
- su discourse -c 'SKIP_EMBER_CLI_COMPILE=1 bundle exec rake themes:update assets:precompile'
220+
195221
- replace:
196222
tag: precompile
197223
filename: /etc/service/unicorn/run

0 commit comments

Comments
 (0)