|
@ -4,34 +4,57 @@ echo '####################################################################' |
|
|
echo '# docker_postgres_setup_script #' |
|
|
echo '# docker_postgres_setup_script #' |
|
|
echo '# Dennis Buchhorn - bucde@b-eit.de #' |
|
|
echo '# Dennis Buchhorn - bucde@b-eit.de #' |
|
|
echo '####################################################################' |
|
|
echo '####################################################################' |
|
|
|
|
|
echo '# WARNING: password is plain text input! #' |
|
|
|
|
|
echo '# #' |
|
|
|
|
|
echo "# Config will be saved in '.env' file. #" |
|
|
|
|
|
echo '# (everything in plain text, even the password) #' |
|
|
|
|
|
#echo '# #' |
|
|
|
|
|
echo '####################################################################' |
|
|
echo '' |
|
|
echo '' |
|
|
|
|
|
|
|
|
|
|
|
CONFIG_EXISTS='false' |
|
|
|
|
|
KEEP_CONFIG='' |
|
|
|
|
|
|
|
|
POSTGRES_VERSION='' |
|
|
POSTGRES_VERSION='' |
|
|
POSTGRES_HOST_IP_ADDRESS='' |
|
|
POSTGRES_HOST_IP_ADDRESS='' |
|
|
POSTGRES_HOST_PORT='' |
|
|
POSTGRES_HOST_PORT='' |
|
|
POSTGRES_ADMIN_USER='' |
|
|
POSTGRES_ADMIN_USER='' |
|
|
POSTGRES_ADMIN_PASSWORD='' |
|
|
POSTGRES_ADMIN_PASSWORD='' |
|
|
|
|
|
|
|
|
POSTGRES_SHARED_HOSTING='y' |
|
|
|
|
|
|
|
|
POSTGRES_SHARED_HOSTING='' |
|
|
|
|
|
|
|
|
read -p 'Enter postgres version which should be used: ' POSTGRES_VERSION |
|
|
|
|
|
read -p 'Enter host (vm) ip address on which postgres should be accessible: ' POSTGRES_HOST_IP_ADDRESS |
|
|
|
|
|
read -p 'Enter host (vm) port on which postgres should be accessible: ' POSTGRES_HOST_PORT |
|
|
|
|
|
read -p 'Enter admin user name for postgres: ' POSTGRES_ADMIN_USER |
|
|
|
|
|
read -p 'Enter admin password for postgres: ' POSTGRES_ADMIN_PASSWORD |
|
|
|
|
|
|
|
|
if [ -f ".env" ]; then |
|
|
|
|
|
CONFIG_EXISTS='true' |
|
|
|
|
|
read -p "Config file '.env' already exists! Would you like to use this? (y/n)" KEEP_CONFIG |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
read -p 'Would you like to modify postgres rights for shared hosting? (y/n)' POSTGRES_SHARED_HOSTING |
|
|
|
|
|
|
|
|
if [ $CONFIG_EXISTS == 'false' ] || [ $KEEP_CONFIG == 'n' ]; then |
|
|
|
|
|
read -p 'Enter postgres version which should be used: ' POSTGRES_VERSION |
|
|
|
|
|
read -p 'Enter host (vm) ip address on which postgres should be accessible: ' POSTGRES_HOST_IP_ADDRESS |
|
|
|
|
|
read -p 'Enter host (vm) port on which postgres should be accessible: ' POSTGRES_HOST_PORT |
|
|
|
|
|
read -p 'Enter admin user name for postgres: ' POSTGRES_ADMIN_USER |
|
|
|
|
|
read -p 'Enter admin password for postgres: ' POSTGRES_ADMIN_PASSWORD |
|
|
|
|
|
|
|
|
touch .env |
|
|
|
|
|
echo "POSTGRES_VERSION="$POSTGRES_VERSION >> .env |
|
|
|
|
|
echo "POSTGRES_HOST_IP_ADDRESS="$POSTGRES_HOST_IP_ADDRESS >> .env |
|
|
|
|
|
echo "POSTGRES_HOST_PORT="$POSTGRES_HOST_PORT >> .env |
|
|
|
|
|
echo "POSTGRES_ADMIN_USER="$POSTGRES_ADMIN_USER >> .env |
|
|
|
|
|
echo "POSTGRES_ADMIN_PASSWORD="$POSTGRES_ADMIN_PASSWORD >> .env |
|
|
|
|
|
|
|
|
rm -f .env |
|
|
|
|
|
touch .env |
|
|
|
|
|
echo "POSTGRES_VERSION="$POSTGRES_VERSION >> .env |
|
|
|
|
|
echo "POSTGRES_HOST_IP_ADDRESS="$POSTGRES_HOST_IP_ADDRESS >> .env |
|
|
|
|
|
echo "POSTGRES_HOST_PORT="$POSTGRES_HOST_PORT >> .env |
|
|
|
|
|
echo "POSTGRES_ADMIN_USER="$POSTGRES_ADMIN_USER >> .env |
|
|
|
|
|
echo "POSTGRES_ADMIN_PASSWORD="$POSTGRES_ADMIN_PASSWORD >> .env |
|
|
|
|
|
else |
|
|
|
|
|
while read line; do |
|
|
|
|
|
if [[ $line == *"POSTGRES_ADMIN_USER="* ]]; then |
|
|
|
|
|
POSTGRES_ADMIN_USER=$(echo $line | cut -c 21-) |
|
|
|
|
|
fi |
|
|
|
|
|
done < ".env" |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
read -p 'Would you like to modify postgres rights for shared hosting? (y/n)' POSTGRES_SHARED_HOSTING |
|
|
|
|
|
|
|
|
docker-compose up -d |
|
|
docker-compose up -d |
|
|
|
|
|
|
|
|
echo 'Wait a few seconds ...' |
|
|
|
|
|
|
|
|
echo 'Wait a few seconds for the container to spin up ...' |
|
|
|
|
|
|
|
|
sleep 5 |
|
|
sleep 5 |
|
|
|
|
|
|
|
|