Skip to content

Commit c2fb04f

Browse files
committed
chore(deploy): Better dev mode for setup script
1 parent fda3fda commit c2fb04f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

deploy/setup/setup.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,23 @@ done
4949

5050
PUBLIC_IP=$(curl --silent --show-error --fail https://api.ipify.org)
5151
SETUP_PORT=8888
52-
# Random suffix keeps Let's Encrypt from rate limiting
53-
# but not in CLOUD_INIT so that the setup webserver address
54-
# remains known (https://<SERVER-IP>.nip.io:8888) in that case.
55-
if [[ "$CLOUD_INIT" = "true" ]]; then
56-
SETUP_HOST=$PUBLIC_IP.nip.io
57-
else
58-
SETUP_SUBDOMAIN=wbs-setup-$(LC_ALL=C tr -dc 'a-z0-9' </dev/urandom | head -c 6)
59-
SETUP_HOST=$SETUP_SUBDOMAIN.$PUBLIC_IP.nip.io
52+
if [[ -z "$SETUP_HOST" ]]; then
53+
# Random suffix keeps Let's Encrypt from rate limiting
54+
# but not in CLOUD_INIT so that the setup webserver address
55+
# remains known (https://<SERVER-IP>.nip.io:8888) in that case.
56+
if [[ "$CLOUD_INIT" = "true" ]]; then
57+
SETUP_HOST=$PUBLIC_IP.nip.io
58+
else
59+
SETUP_SUBDOMAIN=wbs-setup-$(LC_ALL=C tr -dc 'a-z0-9' </dev/urandom | head -c 6)
60+
SETUP_HOST=$SETUP_SUBDOMAIN.$PUBLIC_IP.nip.io
61+
fi
6062
fi
6163

6264
# -- Setup logging --
6365

6466
mkdir -p "$WBS_DIR"
6567
touch "$LOG_PATH"
6668

67-
6869
log() {
6970
if $VERBOSE; then
7071
echo "$@"
@@ -184,6 +185,7 @@ if ! $LAUNCH_MODE; then
184185
log_cmd "docker run -d \
185186
-p $SETUP_PORT:443 \
186187
-v $DEPLOY_DIR:/app/deploy \
188+
-v $DEPLOY_DIR/setup/views:/app/views \
187189
-v $SETUP_DIR/certs:/app/certs \
188190
-v $LOG_PATH:/app/setup.log \
189191
wikibase/deploy-setup-webserver"

0 commit comments

Comments
 (0)