-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-entrypoint.sh
executable file
·56 lines (46 loc) · 1.16 KB
/
docker-entrypoint.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
#!/bin/sh
set -e
COMMANDS="qcluster cronjob"
if [ -z "$POSTGRES_ADDR" ]; then
export POSTGRES_ADDR="postgres"
fi
if [ -z "$UWSGI_PORT" ]; then
export UWSGI_PORT=12301
fi
while ! nc -z $POSTGRES_ADDR 5432; do
echo "Waiting for Postgres server at '$POSTGRES_ADDR' to accept connections on port 5432..."
sleep 1s
done
if [ $DEBUG = "True" ]; then
pip install -r requirements-dev.txt
fi
if [ "x$DJANGO_MIGRATE" = 'xyes' ]; then
python manage.py migrate
fi
if [ "x$DJANGO_COLLECT_STATIC" = "xyes" ]; then
python manage.py collectstatic --noinput
fi
if [ "x$DJANGO_LOAD_FIXTURES" = "xyes" ]; then
echo "Loading fixtures"
python manage.py loaddata notifications/fixtures/companiesgroups.json
fi
/usr/sbin/postconf relayhost=$MAIL_HOST
case "$1" in
qcluster)
/usr/sbin/postfix start
exec python manage.py qcluster
;;
cronjob)
if [[ ! -z "$CRONTAB" ]]; then
echo "$CRONTAB" > /tmp/crontab
nc -lkp $UWSGI_PORT -e echo -e 'HTTP/1.1 200 OK\r\n' &>/dev/null &
crontab /tmp/crontab
crond -f -L -
else
exit 1
fi
;;
*)
uwsgi uwsgi.ini
;;
esac