entrypoint_production.sh 872 Bytes
Newer Older
Thom Wiggers's avatar
Thom Wiggers committed
1 2 3 4
#!/bin/bash

set -e

5
chown -R www-data:www-data /concrexit/
6

7
until psql -h "$DJANGO_POSTGRES_HOST" -U "postgres" -c '\l' "$POSTGRES_DB"; do
Thom Wiggers's avatar
Thom Wiggers committed
8 9 10 11 12
    >&2 echo "PostgreSQL is unavailable: Sleeping"
    sleep 5
done
>&2 echo "PostgreSQL is up"

13
cd /usr/src/app/website/
14 15 16 17 18

./manage.py collectstatic --no-input
./manage.py migrate --no-input
./manage.py compress --force

Thom Wiggers's avatar
Thom Wiggers committed
19
>&2 echo "Running site with uwsgi"
20
exec uwsgi --chdir /usr/src/app/website \
Thom Wiggers's avatar
Thom Wiggers committed
21
    --socket :8000 \
Thom Wiggers's avatar
Thom Wiggers committed
22
    --socket-timeout 1800 \
23 24 25 26
    --uid 33 \
    --gid 33 \
    --threads 5 \
    --processes 5 \
Thom Wiggers's avatar
Thom Wiggers committed
27
    --module thaliawebsite.wsgi:application \
Thom Wiggers's avatar
Thom Wiggers committed
28
    --harakiri 1800 \
29
    --master \
Thom Wiggers's avatar
Thom Wiggers committed
30 31
    --max-requests 5000 \
    --vacuum \
Thom Wiggers's avatar
Thom Wiggers committed
32 33
    --limit-post 0 \
    --post-buffering 16384 \
34
    --thunder-lock \
35 36 37 38
    --logto '/concrexit/log/uwsgi.log' \
    --ignore-sigpipe \
    --ignore-write-errors \
    --disable-write-exception