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

set -e

5
6
tar --extract --xz --file=/usr/src/app/docs.tar.xz --directory=/concrexit/docs/
chown -R www-data:www-data /concrexit/
7

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

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

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

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