From 186ce6c5af403329695a193f2a2bf93a02b016dc Mon Sep 17 00:00:00 2001 From: "Nathan.fooo" <86001920+appflowy@users.noreply.github.com> Date: Fri, 8 Sep 2023 20:35:06 +0800 Subject: [PATCH] fix: run_local_server script (#21) --- build/run_local_server.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build/run_local_server.sh b/build/run_local_server.sh index 5da925b8..af1f8407 100755 --- a/build/run_local_server.sh +++ b/build/run_local_server.sh @@ -4,7 +4,18 @@ set -eo pipefail cd "$(dirname "$0")/.." +DB_USER="${POSTGRES_USER:=postgres}" +DB_PASSWORD="${POSTGRES_PASSWORD:=password}" +DB_PORT="${POSTGRES_PORT:=5433}" +DB_HOST="${POSTGRES_HOST:=localhost}" + docker-compose --file ./docker-compose-dev.yml up -d --build + +# Keep pinging Postgres until it's ready to accept commands +until PGPASSWORD="${DB_PASSWORD}" psql -h "${DB_HOST}" -U "${DB_USER}" -p "${DB_PORT}" -d "postgres" -c '\q'; do + >&2 echo "Postgres is still unavailable - sleeping" + sleep 1 +done sqlx database create sqlx migrate run cargo run