-
Notifications
You must be signed in to change notification settings - Fork 895
improve develop.sh #2572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
improve develop.sh #2572
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
51e7e5c
improve develop.sh
johnstcn a6dcabf
deprecate makefile target, add optional verbose output, check for dep…
johnstcn c1c4404
Address SC2236
johnstcn 52b2589
add suggestion from mafredri
johnstcn 0305587
fix process group kill invocation
johnstcn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Allow toggling verbose output | ||
[[ ! -z ${VERBOSE:-""} ]] && set -x | ||
set -euo pipefail | ||
set -x | ||
|
||
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
source "${SCRIPT_DIR}/lib.sh" | ||
PROJECT_ROOT=$(cd "$SCRIPT_DIR" && git rev-parse --show-toplevel) | ||
set +u | ||
CODER_DEV_ADMIN_PASSWORD="${CODER_DEV_ADMIN_PASSWORD:-password}" | ||
set -u | ||
|
||
# Preflight checks: ensure we have our required dependencies, and make sure nothing is listening on port 3000 or 8080 | ||
dependencies git make nc go yarn | ||
nc -z 127.0.0.1 3000 && echo '== ERROR: something is listening on port 3000. Kill it and re-run this script.' && exit 1 | ||
nc -z 127.0.0.1 8080 && echo '== ERROR: something is listening on port 8080. Kill it and re-run this script.' && exit 1 | ||
|
||
echo '== Run "make build" before running this command to build binaries.' | ||
echo '== Without these binaries, workspaces will fail to start!' | ||
|
@@ -17,18 +27,19 @@ echo '== Without these binaries, workspaces will fail to start!' | |
# https://stackoverflow.com/questions/3004811/how-do-you-run-multiple-programs-in-parallel-from-a-bash-script | ||
( | ||
cd "${PROJECT_ROOT}" | ||
|
||
trap 'kill 0' SIGINT | ||
# Send an interrupt signal to all processes in this subshell on exit | ||
CODERV2_HOST=http://127.0.0.1:3000 INSPECT_XSTATE=true yarn --cwd=./site dev & | ||
go run -tags embed cmd/coder/main.go server --in-memory --tunnel & | ||
|
||
# Just a minor sleep to ensure the first user was created to make the member. | ||
sleep 2 | ||
echo '== Waiting for Coder to become ready' | ||
timeout 60s bash -c 'until nc -z 127.0.0.1 3000 > /dev/null 2>&1; do sleep 1; done' | ||
johnstcn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# create the first user, the admin | ||
go run cmd/coder/main.go login http://127.0.0.1:3000 --username=admin [email protected] --password=password || true | ||
go run cmd/coder/main.go login http://127.0.0.1:3000 --username=admin [email protected] --password=password \ | ||
johnstcn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|| echo 'Failed to create admin user. To troubleshoot, try running this command manually.' | ||
|
||
# || yes to always exit code 0. If this fails, whelp. | ||
go run cmd/coder/main.go users create [email protected] --username=member --password="${CODER_DEV_ADMIN_PASSWORD}" || true | ||
# || true to always exit code 0. If this fails, whelp. | ||
go run cmd/coder/main.go users create [email protected] --username=member --password="${CODER_DEV_ADMIN_PASSWORD}" \ | ||
|| echo 'Failed to create regular user. To troubleshoot, try running this command manually.' | ||
wait | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.