-
Notifications
You must be signed in to change notification settings - Fork 24
/
docker-entrypoint.sh
executable file
·48 lines (40 loc) · 1 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
#!/usr/bin/env bash
# Copyright (C) 2019 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GNU Affero GPL v3 or later
set -e
set -u
PS4='# '
set -x
id
ip addr
cd ~/.local/lib/python*/site-packages/jawanndenn
wait_for_it_args=(
--service "${JAWANNDENN_REDIS_HOST}:${JAWANNDENN_REDIS_PORT}"
--service "${JAWANNDENN_POSTGRES_HOST}:${JAWANNDENN_POSTGRES_PORT}"
--parallel
)
wait-for-it "${wait_for_it_args[@]}"
if [[ $# -gt 0 ]]; then
case "$1" in
test)
coverage run -m django test "${@:2}"
coverage report
exit 0
;;
*)
exec "$@"
;;
esac
fi
python3 -m django migrate
gunicorn_args=(
--name=jawanndenn
--bind=0.0.0.0:54080
--workers="$(( $(nproc --ignore=1) + 1 ))" # i.e. always >=2
--timeout 5
--access-logfile=-
--access-logformat '%({x-forwarded-for}i)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
--logger-class=gunicorn_color.Logger
jawanndenn.wsgi
)
exec gunicorn "${gunicorn_args[@]}"