Create cache table on start

This commit is contained in:
Joakim Hellsén 2024-03-15 14:15:51 +01:00
commit 951d534489
No known key found for this signature in database
GPG key ID: D196AE66FEBE1DC9

View file

@ -6,18 +6,16 @@ set -e
# Debug # Debug
set -x set -x
# Wait for database
echo "Waiting for database"
while ! nc -z "$POSTGRES_HOST" "$POSTGRES_PORT"; do
sleep 0.1
done
echo "Database started"
# 2. Apply database migrations # 2. Apply database migrations
echo "Apply database migrations" echo "Apply database migrations"
python manage.py migrate python manage.py migrate
echo "Apply database migrations done" echo "Apply database migrations done"
# 3. Create cache table
echo "Create cache table"
python manage.py createcachetable
echo "Create cache table done"
# https://docs.gunicorn.org/en/stable/design.html#how-many-workers # https://docs.gunicorn.org/en/stable/design.html#how-many-workers
num_cores=$(nproc --all) num_cores=$(nproc --all)
workers=$((2 * num_cores + 1)) workers=$((2 * num_cores + 1))