Skip to content

Commit a5427bb

Browse files
committed
Fix script
1 parent df6601a commit a5427bb

File tree

2 files changed

+32
-13
lines changed

2 files changed

+32
-13
lines changed

develop.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
EMAIL="${EMAIL:-admin@coder.com}"
6+
USERNAME="${USERNAME:-admin}"
7+
ORGANIZATION="${ORGANIZATION:-ACME-Corp}"
8+
PASSWORD="${PASSWORD:-password}"
9+
PROJECT_ROOT="$(git rev-parse --show-toplevel)"
10+
cd "${PROJECT_ROOT}"
11+
12+
# Helper to create an initial user
13+
function create_initial_user() {
14+
# TODO: We need to wait for `coderd` to spin up -
15+
# need to replace with a deterministic strategy
16+
sleep 5s
17+
18+
curl -X POST \
19+
-d "{\"email\": \"$EMAIL\", \"username\": \"$USERNAME\", \"organization\": \"$ORGANIZATION\", \"password\": \"$PASSWORD\"}" \
20+
-H 'Content-Type:application/json' \
21+
http://localhost:3000/api/v2/users
22+
}
23+
24+
# Do initial build - a dev build for coderd.
25+
# It's OK that we don't build the front-end before - because the front-end
26+
# assets are handled by the `yarn dev` devserver.
27+
make bin/coderd
28+
29+
# This is a way to run multiple processes in parallel, and have Ctrl-C work correctly
30+
# to kill both at the same time. For more details, see:
31+
# https://stackoverflow.com/questions/3004811/how-do-you-run-multiple-programs-in-parallel-from-a-bash-script
32+
(trap 'kill 0' SIGINT; create_initial_user & CODERV2_HOST=http://127.0.0.1:3000 yarn dev & ./bin/coderd)

scripts/create_initial_user.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)