aboutsummaryrefslogtreecommitdiff
path: root/wait-for-postgres.sh
blob: 3f4e7067d0e8ee6215f638bd4483abe458368378 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

# Used for Docker.

set -e

shift

until (! command -v psql || PGPASSWORD=password psql -h db -U "postgres" -c '\q' )
do
  >&2 echo "Postgres is unavailable - sleeping"
  sleep 1
done

>&2 echo "Postgres is up - executing command"
export Newspipe_CONFIG=/newspipe/instance/config.py
poetry run ./manager.py db_create >/dev/null
poetry run pybabel compile -d newspipe/translations
poetry run ./runserver.py
bgstack15