forked from koding/koding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap-container
More file actions
executable file
·68 lines (60 loc) · 1.04 KB
/
Copy pathbootstrap-container
File metadata and controls
executable file
·68 lines (60 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
set -o errexit
pushd $(dirname $0)/..
function configure() {
[ ! -d node_modules ] && npm install --unsafe-perm
./configure $*
}
function build() {
go/build.sh
make -C client dist
}
function run_backend() {
go/build.sh
./run exec scripts/check-service-connectivity.sh || exit 255
./run migrate up
nginx -c $(pwd)/nginx.conf
./run exec supervisord -c supervisord.conf
sleep 2
tail --follow --lines +0 --quiet .logs/*.log
}
function is_ready() {
until [ -x ./run ] && ./run is_ready; do
sleep 10
done
}
function run() {
case "$1" in
backend)
run_backend
;;
*)
echo 'error: unknown service'
exit 1
;;
esac
}
if [[ -z "$*" ]]; then
run_backend
elif [[ "${1:0:1}" = '-' ]]; then
configure $*
run_backend
elif [ "$1" = "configure" ]; then
shift
configure $*
elif [ "$1" = "build" ]; then
shift
configure $*
build
run_backend
elif [ "$1" = "run" ]; then
shift
is_ready
run $*
elif [ "$1" = "is_ready" ]; then
shift
is_ready
exec "$@"
else
exec "$@"
fi