aboutsummaryrefslogtreecommitdiff
path: root/wait-for-postgres.sh
blob: be5e8afe8edb0fe24ab94dbcac6d0c6c59c31b71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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
export FLASK_APP=runserver.py
export FLASK_ENV=development
poetry run flask db_create >/dev/null
poetry run flask create_admin --nickname admin --password password >/dev/null
poetry run pybabel compile -d newspipe/translations
poetry run flask run
bgstack15