mirror of
https://github.com/MatthewL246/pretendo-docker.git
synced 2026-09-13 13:55:10 -05:00
Create internal directory for scripts
This commit is contained in:
26
scripts/internal/update-postgres-password.sh
Executable file
26
scripts/internal/update-postgres-password.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#! /bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
git_base=$(git rev-parse --show-toplevel)
|
||||
. "$git_base/scripts/internal/function-lib.sh"
|
||||
if [ ! -f "$git_base/environment/postgres.local.env" ]; then
|
||||
error "Missing environment file postgres.local.env. Did you run setup-environment.sh?"
|
||||
exit 1
|
||||
fi
|
||||
. "$git_base/environment/postgres.env"
|
||||
. "$git_base/environment/postgres.local.env"
|
||||
|
||||
docker compose up -d postgres
|
||||
|
||||
while ! docker compose exec postgres psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -c "\l" >/dev/null 2>&1; do
|
||||
info "Waiting for PostgreSQL to start..."
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# During the first run, this sometimes fails because the entrypoint script
|
||||
# restarts the server after running the initdb scripts
|
||||
while ! docker compose exec postgres psql -U "$POSTGRES_USER" -c "ALTER USER $POSTGRES_USER PASSWORD '$POSTGRES_PASSWORD';"; do
|
||||
warning "Failed to change Postgres password, retrying..."
|
||||
sleep 2
|
||||
done
|
||||
Reference in New Issue
Block a user