aboutsummaryrefslogtreecommitdiff
path: root/wait-for-postgres.sh
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2020-03-20 18:12:57 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2020-03-20 18:12:57 +0100
commit966f40d591d6fc95068fc22c5b283b9ab54c3d8e (patch)
tree91d949d700e58bf89917f5e0cbb34ea97e54bea2 /wait-for-postgres.sh
parentadded files for docker (diff)
downloadnewspipe-966f40d591d6fc95068fc22c5b283b9ab54c3d8e.tar.gz
newspipe-966f40d591d6fc95068fc22c5b283b9ab54c3d8e.tar.bz2
newspipe-966f40d591d6fc95068fc22c5b283b9ab54c3d8e.zip
Added Dockerfile, images: python3.8-alpine and postgres.
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