-
Notifications
You must be signed in to change notification settings - Fork 3
/
run_genocrowd_docker.sh
executable file
·43 lines (35 loc) · 1.46 KB
/
run_genocrowd_docker.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
#! /bin/bash
echo "Removing python cache ..."
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
# Create config file
dir_genocrowd="/genocrowd"
config_template_path="$dir_genocrowd/config/genocrowd.ini.template"
config_path="$dir_genocrowd/config/genocrowd.ini"
if [[ ! -f $config_path ]]; then
# If the file exists it probably means it was mounted -> don't touch it
cp $config_template_path $config_path
# Convert env to ini entry
printenv | egrep "GENOCROWD_" | while read setting
do
section=$(echo $setting | egrep -o "^GENOCROWD[^=]+" | sed 's/^.\{5\}//g' | cut -d "_" -f 1)
key=$(echo $setting | egrep -o "^GENOCROWD[^=]+" | sed 's/^.\{5\}//g' | sed "s/$section\_//g")
value=$(echo $setting | egrep -o "=.*$" | sed 's/^=//g')
# crudini --set ${config_path} "${section}" "${key}" "${value}"
python3 config_updater.py -p $config_path -s "${section}" -k "${key}" -v "${value}"
$cmd
done
fi
if [[ "$GENOCROWD_MODE" == "dev" ]]; then
echo "Rebuilding js in dev mode (background)..."
npm run -d dev &
cp docker/uwsgi_dev.ini /etc/uwsgi/uwsgi.ini
else
cp docker/uwsgi.ini /etc/uwsgi/uwsgi.ini
fi
echo "Waiting for Apollo startup"
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' apollo:8080/annotator/index)" != "200" ]]; do sleep 5; done
# We want to make sure bootstrap is finished
echo "Apollo started, waiting a bit more"
sleep 30
echo "Starting genocrowd ..."
/usr/bin/supervisord