Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec48b37

Browse files
committed
fix: Misc improvements toscripts/develop.sh
* Use new `/healthz` endpoint for checking API liveness* Improved credential handling/retrying in failure scenarios* Separate site (`vite`) logs with prefix and date, additionally this method also disables the `vite` clearing of the screen* Show all interfaces coder API is listening on (due to `0.0.0.0`)
1 parentd64c73d commitec48b37

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

‎scripts/develop.sh

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Coder enterprise features).
77

88
SCRIPT_DIR=$(dirname"${BASH_SOURCE[0]}")
9-
# shellcheckdisable=SC1091,SC1090
9+
# shellchecksource=scripts/lib.sh
1010
source"${SCRIPT_DIR}/lib.sh"
1111

1212
# Allow toggling verbose output
@@ -62,18 +62,24 @@ CODER_DEV_SHIM="${PROJECT_ROOT}/scripts/coder-dev.sh"
6262
"${CODER_DEV_SHIM}" server --address 0.0.0.0:3000||kill -INT -$$&
6363

6464
echo'== Waiting for Coder to become ready'
65-
timeout 60s bash -c'until curl -s --fail http://localhost:3000 > /dev/null 2>&1; do sleep 0.5; done'
65+
timeout 60s bash -c'until curl -s --fail http://localhost:3000/healthz > /dev/null 2>&1; do sleep 0.5; done'
66+
67+
# Check if credentials are already set up to avoid setting up again.
68+
"${CODER_DEV_SHIM}" list>/dev/null2>&1&& touch"${PROJECT_ROOT}/.coderv2/developsh-did-first-setup"
6669

6770
if [!-f"${PROJECT_ROOT}/.coderv2/developsh-did-first-setup" ];then
6871
# Try to create the initial admin user.
69-
"${CODER_DEV_SHIM}" login http://127.0.0.1:3000 --first-user-username=admin --first-user-email=admin@coder.com --first-user-password="${password}"||
72+
if"${CODER_DEV_SHIM}" login http://127.0.0.1:3000 --first-user-username=admin --first-user-email=admin@coder.com --first-user-password="${password}";then
73+
# Only create this file if an admin user was successfully
74+
# created, otherwise we won't retry on a later attempt.
75+
touch"${PROJECT_ROOT}/.coderv2/developsh-did-first-setup"
76+
else
7077
echo'Failed to create admin user. To troubleshoot, try running this command manually.'
78+
fi
7179

7280
# Try to create a regular user.
7381
"${CODER_DEV_SHIM}" users create --email=member@coder.com --username=member --password="${password}"||
7482
echo'Failed to create regular user. To troubleshoot, try running this command manually.'
75-
76-
touch"${PROJECT_ROOT}/.coderv2/developsh-did-first-setup"
7783
fi
7884

7985
# If we have docker available and the "docker" template doesn't already
@@ -97,14 +103,31 @@ CODER_DEV_SHIM="${PROJECT_ROOT}/scripts/coder-dev.sh"
97103
fi
98104

99105
# Start the frontend once we have a template up and running
100-
CODER_HOST=http://127.0.0.1:3000 yarn --cwd=./site dev||kill -INT -$$&
106+
CODER_HOST=http://127.0.0.1:3000 yarn --cwd=./site dev| {
107+
whileread -r line;do
108+
echo"[SITE]$(date -Iseconds):$line"
109+
done
110+
}||kill -INT -$$&
111+
112+
interfaces=(localhost)
113+
if which ip>/dev/null2>&1;then
114+
# shellcheck disable=SC2207
115+
interfaces+=($(ip a| awk'/inet / {print $2}'| cut -d/ -f1))
116+
elif which ifconfig>/dev/null2>&1;then
117+
# shellcheck disable=SC2207
118+
interfaces+=($(ifconfig| awk'/inet / {print $2}'))
119+
fi
101120

102121
log
103122
log"===================================================================="
104123
log"== =="
105124
log"== Coder is now running in development mode. =="
106-
log"== API: http://localhost:3000 =="
107-
log"== Web UI: http://localhost:8080 =="
125+
forifacein"${interfaces[@]}";do
126+
log"$(printf"== API: http://%s:3000%$((26-${#iface}))s==""$iface""")"
127+
done
128+
forifacein"${interfaces[@]}";do
129+
log"$(printf"== Web UI: http://%s:3000%$((26-${#iface}))s==""$iface""")"
130+
done
108131
log"== =="
109132
log"== Use ./scripts/coder-dev.sh to talk to this instance! =="
110133
log"===================================================================="

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp