aboutsummaryrefslogtreecommitdiff
path: root/wait-for-postgres.sh
blob: 4cace9bd41a10954085f3bd620ee00e37b506771 (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/production.py
poetry run ./manager.py db_create
poetry run pybabel compile -d newspipe/translations
poetry run ./runserver.py
bgstack15