Skip to content

Commit 4c33f00

Browse files
committed
Add a USE_FASTBOOT=staging-experimental mode
1 parent 6e373b6 commit 4c33f00

File tree

2 files changed

+43
-14
lines changed

2 files changed

+43
-14
lines changed

config/nginx.conf.erb

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,44 @@ http {
6060
rewrite ^ https://$host$request_uri? permanent;
6161
}
6262

63-
location / {
64-
proxy_pass http://app_server;
65-
}
66-
67-
<% if ENV['USE_FASTBOOT'] %>
68-
# Just in case, only forward "/policies" to Ember for a moment
69-
location = /policies {
70-
proxy_pass http://localhost:9000;
71-
}
63+
<% if ENV['USE_FASTBOOT'] == "staging-experimental" %>
64+
# Experimentally send all non-backend requests to FastBoot
65+
66+
location /api/ {
67+
proxy_pass http://app_server;
68+
}
69+
70+
# Hacks to deal with backend paths that are not under /api/
71+
location /authorize {
72+
proxy_pass http://app_server;
73+
}
74+
location /authorize_url {
75+
proxy_pass http://app_server;
76+
}
77+
location /logout {
78+
proxy_pass http://app_server;
79+
}
80+
81+
# FastBoot
82+
location / {
83+
proxy_pass http://localhost:9000;
84+
}
85+
<% elsif ['USE_FASTBOOT'] %>
86+
# Fastboot is enabled only for allowed paths
87+
88+
location = /policies {
89+
proxy_pass http://localhost:9000;
90+
}
91+
92+
location / {
93+
proxy_pass http://app_server;
94+
}
95+
<% else %>
96+
# FastBoot is disabled, backend sends the static Ember index HTML for non-backend paths
97+
98+
location / {
99+
proxy_pass http://app_server;
100+
}
72101
<% end %>
73102

74103
location ~ ^/api/v./crates/new$ {

script/start-web.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#! /bin/bash
22
set -ue
33

4-
if [[ "${USE_FASTBOOT:-0}" = 1 ]]; then
5-
export USE_FASTBOOT=1
4+
if [[ -z "${USE_FASTBOOT}" ]]; then
5+
unset USE_FASTBOOT
6+
bin/start-nginx ./target/release/server
7+
else
8+
export USE_FASTBOOT
69
node --optimize_for_size --max_old_space_size=200 fastboot.js &
710
bin/start-nginx ./target/release/server &
811
wait -n
9-
else
10-
unset USE_FASTBOOT
11-
bin/start-nginx ./target/release/server
1212
fi

0 commit comments

Comments
 (0)