-
Notifications
You must be signed in to change notification settings - Fork 108
/
init.sh
48 lines (37 loc) · 1.08 KB
/
init.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
#!/bin/bash
cd /usr/src/app/
if [[ ! $APP_DB_HOST ]]; then
echo "\$APP_DB_HOST is unset";
exit 1;
fi
if [[ ! $APP_DB_PORT ]]; then
echo "\$APP_DB_PORT is unset";
exit 1;
fi
if [[ ! $APP_DB_USER ]]; then
echo "\$APP_DB_USER is unset";
exit 1;
fi
if [[ ! $APP_DB_PASSWORD ]]; then
echo "\$APP_DB_PASSWORD is unset";
exit 1;
fi
if [[ ! $APP_DB_NAME ]]; then
echo "\$APP_DB_NAME is unset";
exit 1;
fi
if [[ ! $APP_DB_DRIVER ]]; then
export APP_DB_DRIVER="postgres";
echo "\$APP_DB_DRIVER is unset, assuming postgres";
fi
export DATABASE_URL="${APP_DB_DRIVER}://${APP_DB_USER}:${APP_DB_PASSWORD}@${APP_DB_HOST}:${APP_DB_PORT}/${APP_DB_NAME}"
./wait-for-it.sh -t 30 -s ${APP_DB_HOST}:${APP_DB_PORT}
sleep 10
if [ "$MODE" == "dev" ]
then
initialize_gengine_db development.ini admin_password=$ADMIN_PASSWORD admin_user=$ADMIN_USER
uwsgi --lazy-apps --ini-paste development.uwsgi --py-autoreload=1
else
initialize_gengine_db production.ini admin_password=$ADMIN_PASSWORD admin_user=$ADMIN_USER
uwsgi --lazy-apps --ini-paste production.uwsgi
fi