feature: initial commit for all new image changes
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash -e -o pipefail
|
||||
################################################################################
|
||||
## File: install-postgresql.sh
|
||||
## Desc: Install PostgreSQL
|
||||
################################################################################
|
||||
|
||||
source ~/utils/utils.sh
|
||||
|
||||
# Fetch PostgreSQL version to install from the toolset
|
||||
toolsetVersion=$(get_toolset_value '.postgresql.version')
|
||||
|
||||
# Install latest version of PostgreSQL
|
||||
brew_smart_install postgresql@$toolsetVersion
|
||||
|
||||
# Service PostgreSQL should be started before use
|
||||
postgreService=$(brew services list | grep -oe "postgresql\S*")
|
||||
brew services start $postgreService
|
||||
|
||||
# Verify PostgreSQL is ready for accept incoming connections
|
||||
echo "Check PostgreSQL service is running"
|
||||
i=10
|
||||
COMMAND='pg_isready'
|
||||
while [[ $i -gt 0 ]]; do
|
||||
echo "Check PostgreSQL service status"
|
||||
eval $COMMAND && break
|
||||
((i--))
|
||||
if [[ $i == 0 ]]; then
|
||||
echo "PostgreSQL service not ready, all attempts exhausted"
|
||||
exit 1
|
||||
fi
|
||||
echo "PostgreSQL service not ready, wait 10 more sec, attempts left: $i"
|
||||
sleep 10
|
||||
done
|
||||
|
||||
# Stop PostgreSQL
|
||||
brew services stop $postgreService
|
||||
|
||||
invoke_tests "Databases" "PostgreSQL"
|
||||
Reference in New Issue
Block a user