-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentyrpoint.sh
44 lines (36 loc) · 880 Bytes
/
entyrpoint.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
#!/bin/bash
# if any of the commands in your code fails for any reason, the entire script fails
set -o errexit
# fail exit if one of your pipe command fails
set -o pipefail
# exits if any of your variables is not set
set -o nounset
postgres_ready() {
python << END
import sys
import psycopg2
try:
psycopg2.connect(
dbname="${DB_NAME}",
user="${DB_USER}",
password="${DB_PASSWORD}",
host="${DB_HOST}",
port="${DB_PORT}",
)
except psycopg2.OperationalError:
sys.exit(-1)
sys.exit(0)
END
}
until postgres_ready; do
>&2 echo 'Waiting for PostgreSQL to become available...'
sleep 1
done
>&2 echo 'PostgreSQL is available'
exec "$@"
#
#python manage.py makemigrations
#python manage.py migrate
#python manage.py collectstatic --noinput
#python manage.py runserver 0:8042
#gunicorn root.wsgi:application --bind 0.0.0.0:8001