aboutsummaryrefslogtreecommitdiff
path: root/wait-for-postgres.sh
diff options
context:
space:
mode:
Diffstat (limited to 'wait-for-postgres.sh')
-rwxr-xr-xwait-for-postgres.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/wait-for-postgres.sh b/wait-for-postgres.sh
new file mode 100755
index 00000000..4cace9bd
--- /dev/null
+++ b/wait-for-postgres.sh
@@ -0,0 +1,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