#!/bin/bash
|
|
RUN_PORT="8000"
|
|
SQL_HOST=postgresql
|
|
SQL_PORT=5432
|
|
|
|
if [ "$DATABASE" = "postgres" ]
|
|
then
|
|
echo "Waiting for postgres..."
|
|
|
|
while ! nc -z $SQL_HOST $SQL_PORT; do
|
|
sleep 0.1
|
|
done
|
|
|
|
echo "PostgreSQL started"
|
|
|
|
/opt/venv/bin/python manage.py migrate --no-input
|
|
/opt/venv/bin/python manage.py collectstatic --no-input
|
|
|
|
/opt/venv/bin/gunicorn gestion_reservas.wsgi:application --bind "0.0.0.0:${RUN_PORT}" --daemon
|
|
|
|
nginx -g 'daemon off;'
|
|
else
|
|
echo "la base de datos no es postgres: '$DATABASE'"
|
|
fi
|