aboutsummaryrefslogtreecommitdiff
path: root/wait-for-postgres.sh
blob: e6bbd619c6c64f04e3d3425935a6ae46f84d9e99 (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 >/dev/null
poetry run pybabel compile -d newspipe/translations
poetry run ./runserver.py
bgstack15