forked from City-of-Turku/linkedevents
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
43 lines (32 loc) · 834 Bytes
/
Copy pathdocker-entrypoint.sh
File metadata and controls
43 lines (32 loc) · 834 Bytes
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
set -e
function _log(){
echo $(date "+%F_%T %Z"): $@
}
if [ -n "$DATABASE_HOST" ]; then
until nc -z -v -w30 "$DATABASE_HOST" 5432
do
_log "Waiting for postgres database connection..."
sleep 1
done
_log "Database is up!"
fi
_log "Running Linked Events entrypoint..."
if [ "$1" = "dev_server" ]; then
_log "Starting dev server..."
python ./manage.py runserver 0.0.0.0:8000
elif [ "$1" = "apply_migrations" ]; then
_log "Applying database migrations..."
python manage.py migrate
elif [ "$1" = "run_tests" ]; then
_log "Running tests..."
pytest --cov , --doctest-modules
elif [ "$1" = "e" ]; then
shift
_log "Executing $@"
exec "$@"
else
_log "Starting production server..."
uwsgi --ini deploy/uwsgi.ini --check-static /var/www
fi
_log "Linked Events entrypoint completed..."