entrypoint.sh 798 B

12345678910111213141516
  1. #!/bin/bash
  2. # wait for api database to come up
  3. host=dbapi; port=3306; n=120; i=0; while ! (echo > /dev/tcp/$host/$port) 2> /dev/null; do [[ $i -eq $n ]] && >&2 echo "$host:$port not up after $n seconds, exiting" && exit 1; echo "waiting for $host:$port to come up"; sleep 1; i=$((i+1)); done
  4. # wait for pdns api to come up
  5. host=nslord; port=8081; n=120; i=0; while ! (echo > /dev/tcp/$host/$port) 2> /dev/null; do [[ $i -eq $n ]] && >&2 echo "$host:$port not up after $n seconds, exiting" && exit 1; echo "waiting for $host:$port to come up"; sleep 1; i=$((i+1)); done
  6. # make sure local settings are available
  7. ls -lh /usr/src/app/desecapi/settings_local.py || exit 1
  8. # migrate database
  9. python manage.py migrate || exit 1
  10. echo Finished migrations, starting API server ...
  11. uwsgi --ini uwsgi.ini