Skip to content

Instantly share code, notes, and snippets.

@augustogoulart
Created June 9, 2018 21:20
Show Gist options
  • Save augustogoulart/6bb539d09bea33bb22949e988f9cf241 to your computer and use it in GitHub Desktop.
Save augustogoulart/6bb539d09bea33bb22949e988f9cf241 to your computer and use it in GitHub Desktop.
#!/bin/bash
#sleep 999999
set -e
host="$1"
shift
cmd="$@"
until PGPASSWORD=$POSTGRES_PASSWORD psql -h "$host" -U "postgres" -c '\q'; do
>&2 echo "Postgres is unavailable - sleeping"
sleep 1
done
>&2 echo "Postgres is up - executing command"
exec $cmd
./manage.py collectstatic --noinput
./manage.py migrate --noinput
cd /app/frontend
NODE_ENV=development PORT=3001 HOST=0.0.0.0 API_MOCK=1 npm run dev &
NODE_ENV=development PORT=3000 HOST=0.0.0.0 API_MOCK=0 npm run dev &
cd /app
DJANGO_DEBUG=1 ./manage.py runserver 0.0.0.0:8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment