-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.sh
executable file
·54 lines (45 loc) · 1.41 KB
/
dev.sh
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
#!/bin/bash
function isCommand () {
#
local _arg=" $(type -t "$1") "
local _executables=' file alias keyword function builtin '
#
[[ "${_executables#*$_arg}" != "$_executables" ]] && return 0
### if $_arg is NOT in $_executables, the two strings will be identical
#
return 1
}
showLoading() {
mypid=$!
loadingText=$1
dot=$2
echo -ne "$loadingText\r"
while kill -0 $mypid 2>/dev/null; do
echo -ne "$loadingText $dot\r"
sleep 0.5
echo -ne "$loadingText $dot $dot\r"
sleep 0.5
echo -ne "$loadingText $dot $dot $dot\r"
sleep 0.5
echo -ne "\r\033[K"
echo -ne "$loadingText\r"
sleep 0.5
done
echo "$loadingText $dot $dot $dot"
}
echo "🐳 Checking if Docker is set up 🐳"
isCommand docker || ( printf "Docker does not seem to be installed. Install at: \nhttps://docs.docker.com/install/ \n" && exit )
docker=$(docker ps )
if [[ !($docker =~ .*kville-scheduler_app.*) && !($docker =~ .*kville-scheduler_db.*) ]]
then
echo "📦 Building containers 📦"
docker-compose build
docker-compose up -d
echo "💾 POSTGRES 💾"
docker-compose run app ./bin/db-setup.sh
fi
printf "🖥️ Starting app 🖥️ \n"
export OAUTH_CLIENT=gthc-dev
export OAUTH_KEY=NTfThB6aP34KyN08Ut63AmLV32QcnQu8YxZYMGTdD85T3j-IjSp2U_z6lH7ljwola7tn6HVX7f89PZBBkDU3gw
export OAUTH_REDIRECT=http://localhost:5000/auth2/callback
docker-compose run -p '5000:5000' -p '3035:3035' app yarn start