-
Notifications
You must be signed in to change notification settings - Fork 14
/
dev.sh
executable file
·103 lines (84 loc) · 2.67 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
set -ex
###################################################################
#
# preflight checks
#
#check files that developers should provide
if [ ! -f warehouse/api/config/github.access_token ]; then
echo "Please create warehouse/api/config.github.access_token from https://github.com/settings/tokens"
exit 1
fi
if [ ! -f amaretti/config/github.access_token ]; then
echo "Please create amaretti/config/github.access_token from https://github.com/settings/tokens"
exit 1
fi
# install dev config
if [ ! -f auth/ui/config.js ]; then
echo "installing dev config for auth/ui"
cp auth/ui/config.js.dev auth/ui/config.js
fi
if [ ! -f auth/api/config/index.js ]; then
echo "installing dev config for auth"
cp auth/api/config/index.js.dev auth/api/config/index.js
fi
if [ ! -f event/api/config/index.js ]; then
echo "installing dev config for event"
cp event/api/config/index.js.dev event/api/config/index.js
fi
if [ ! -f amaretti/config/index.js ]; then
echo "installing dev config for amaretti"
cp amaretti/config/index.js.dev amaretti/config/index.js
fi
if [ ! -f warehouse/api/config/index.js ]; then
echo "installing dev config for warehouse/api"
cp warehouse/api/config/index.js.dev warehouse/api/config/index.js
fi
#setup volume directories that needs to be non-root
for path in archive stage secondary upload singularity compute
do
if [ ! -d volumes/$path ]; then
mkdir -p volumes/$path
#sudo chown 1000:1000 volumes/$path
fi
done
#make sure needed commands exists
hash docker
hash docker-compose
if [ ! -d /tmp/.X11-unix ]; then
echo "Can't find /tmp/.X11-unix - vis server needs X server (like Xquartz)."
exit
fi
###################################################################
#
# install ui packages
#
for ui in $(ls ui); do
if [ ! -d ui/$ui/node_modules ]; then
(cd ui/$ui && npm install && npm update)
fi
done
#build tractview dist
if [ ! -d ui/tractview/dist ]; then
(cd ui/tractview && npm run build)
fi
###################################################################
#
# install all npm packages
#
#authentication service api
[ ! -d auth/node_modules ] && (cd auth && npm install)
#authentication service web ui
[ ! -d auth/ui/node_modules ] && (cd auth/ui && npm install)
#amaretti service api
[ ! -d amaretti/node_modules ] && (cd amaretti && npm install)
#event service
[ ! -d event/node_modules ] && (cd event && npm install)
#warehouse service api
[ ! -d warehouse/node_modules ] && (cd warehouse && npm install)
#warehouse web ui
[ ! -d warehouse/ui/node_modules ] && (cd warehouse/ui && npm install)
###################################################################
#
# now ready to start it up!
docker-compose up --build