-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdockerSetup.sh
executable file
·48 lines (34 loc) · 1.8 KB
/
dockerSetup.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
# This script setups docker containers for the postgres database and conductor service, on your local machine.
# Hence you should have docker app downloaded and running on your machine before running this script.
# It is also adviced to increase available memory for the docker app more than the default setting, to speed up performance.
#!/bin/bash
set -e
PINK='\033[0;35m'
NC='\033[0m' # No Color
./checkOAuthEnv.sh
OAUTH_CLIENT_ID="${CONDUCTOR_OAUTH_CLIENT_ID}"
if [ ! -f "frontend/envfile" ]; then
echo -e "${PINK}creating frontend/envfile ...${NC}"
echo -e "OAUTH_PROVIDER=Github \nOAUTH_ENDPOINT=https://github.com/login/oauth/authorize \nOAUTH_PAYLOAD='{\"client_id\": \"${OAUTH_CLIENT_ID}\", \"redirect_uri\": \"http://localhost/api/auth/login\", \"scope\": \"user repo\"}'" > frontend/envfile
fi
echo -e "${PINK}checking install of package management tools..${NC}"
if which brew && ! brew ls --versions yarn; then brew install yarn; fi;
echo -e "${PINK}stop all existing containers to avoid attached port conflicts..${NC}"
docker container stop $(docker container ls -aq)
echo -e "${PINK}bringing up new postgres docker container for conductor...${NC}"
make postgres
echo -e "${PINK}sleeping for 5 seconds before connecting with new postgres instance...${NC}"
sleep 5
echo -e "${PINK}filling postgres instance with test data...${NC}"
make test-data
echo -e "${PINK}building react.js and frontend static files webpack into resources/frontend...${NC}"
make prod-compile -C frontend
if pgrep nginx; then
echo -e "${PINK} Stop potential running ngnix (from nativeMacSetup) to avoid port conflict...${NC}"
sudo nginx -s stop
fi
echo -e "${PINK}building backend conductor service...${NC}"
export POSTGRES_HOST=conductor-postgres
make docker-build
echo -e "${PINK}starting conductor service${NC}"
make docker-run