@@ -16,6 +16,8 @@ set -euo pipefail
16
16
DEFAULT_PASSWORD=" SomeSecurePassword!"
17
17
password=" ${CODER_DEV_ADMIN_PASSWORD:- ${DEFAULT_PASSWORD} } "
18
18
use_proxy=0
19
+ # Hard coded app security key for the proxy to also use.
20
+ app_security_key=bea458bcfb31990fb70f14a7003c0aad4f371f19653f3a632bc9d3492004cd95e0e542c30e5f158f26728373190bfc802b1c1549f52c149af8ad7f5b12ea1ee0995b95de3b86ae78f021c17437649224cd2dcf1b298d180811cf36f4dcb8f33e
19
21
20
22
args=" $( getopt -o " " -l use-proxy,agpl,password: -- " $@ " ) "
21
23
eval set -- " $args "
@@ -131,7 +133,7 @@ fatal() {
131
133
trap ' fatal "Script encountered an error"' ERR
132
134
133
135
cdroot
134
- start_cmd API " " " ${CODER_DEV_SHIM} " server --http-address 0.0.0.0:3000 --swagger-enable --access-url " http://127.0.0.1:3000" --experiments " *" " $@ "
136
+ start_cmd API " " " ${CODER_DEV_SHIM} " server --http-address 0.0.0.0:3000 --swagger-enable --access-url " http://127.0.0.1:3000" --dangerous-dev-app-security-key ${app_security_key} -- experiments " *" " $@ "
135
137
136
138
echo ' == Waiting for Coder to become ready'
137
139
# Start the timeout in the background so interrupting this script
@@ -178,10 +180,15 @@ fatal() {
178
180
fi
179
181
180
182
if [ " ${use_proxy} " -gt " 0" ]; then
181
- # Create the proxy
182
- " ${CODER_DEV_SHIM} " proxy register --name=local-proxy --display-name=" Local Proxy" --icon=" /emojis/1f4bb.png" --access-url=http://localhost:3010 --only-token
183
- # Start the proxy
184
- start_cmd PROXY proxy " " " ${CODER_DEV_SHIM} " proxy --listen-addr
183
+ log " Using external workspace proxy"
184
+ (
185
+ # Attempt to delete the proxy first, in case it already exists.
186
+ " ${CODER_DEV_SHIM} " proxy delete name=local-proxy
187
+ # Create the proxy
188
+ proxy_session_token=$( " ${CODER_DEV_SHIM} " proxy register --name=local-proxy --display-name=" Local Proxy" --icon=" /emojis/1f4bb.png" --access-url=http://localhost:3010 --only-token)
189
+ # Start the proxy
190
+ start_cmd PROXY " " " ${CODER_DEV_SHIM} " proxy server --http-address=localhost:3010 --proxy-session-token=${proxy_session_token} --primary-access-url=http://localhost:3000 --app-security-key=${app_security_key}
191
+ ) || echo " Failed to create workspace proxy. No workspace proxy created."
185
192
fi
186
193
187
194
# Start the frontend once we have a template up and running
@@ -208,6 +215,11 @@ fatal() {
208
215
for iface in " ${interfaces[@]} " ; do
209
216
log " $( printf " == Web UI: http://%s:8080%$(( space_padding - ${# iface} )) s==" " $iface " " " ) "
210
217
done
218
+ if [ " ${use_proxy} " -gt " 0" ]; then
219
+ for iface in " ${interfaces[@]} " ; do
220
+ log " $( printf " == Proxy: http://%s:3010%$(( space_padding - ${# iface} )) s==" " $iface " " " ) "
221
+ done
222
+ fi
211
223
log " == =="
212
224
log " == Use ./scripts/coder-dev.sh to talk to this instance! =="
213
225
log " $( printf " == alias cdr=%s/scripts/coder-dev.sh%$(( space_padding - ${# PWD} )) s==" " $PWD " " " ) "
0 commit comments