#!/bin/bash
|
|
|
|
echo "####################################################################"
|
|
echo "# docker_mariadb_setup_script #"
|
|
echo "# Dennis Buchhorn - bucde@b-eit.de #"
|
|
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 ""
|
|
|
|
CONFIG_EXISTS="false"
|
|
KEEP_CONFIG=""
|
|
|
|
MARIADB_VERSION=""
|
|
MARIADB_HOST_IP_ADDRESS=""
|
|
MARIADB_HOST_PORT=""
|
|
MARIADB_ROOT_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
|
|
|
|
if [ $CONFIG_EXISTS == "false" ] || [ $KEEP_CONFIG == "n" ]; then
|
|
read -p "Enter mariadb version which should be used: " MARIADB_VERSION
|
|
read -p "Enter host (vm) ip address on which mariadb should be accessible: " MARIADB_HOST_IP_ADDRESS
|
|
read -p "Enter host (vm) port on which mariadb should be accessible: " MARIADB_HOST_PORT
|
|
read -p "Enter root password for mariadb: " MARIADB_ROOT_PASSWORD
|
|
|
|
rm -f .env
|
|
touch .env
|
|
echo "MARIADB_VERSION="$MARIADB_VERSION >> .env
|
|
echo "MARIADB_HOST_IP_ADDRESS="$MARIADB_HOST_IP_ADDRESS >> .env
|
|
echo "MARIADB_HOST_PORT="$MARIADB_HOST_PORT >> .env
|
|
echo "MARIADB_ROOT_PASSWORD="$MARIADB_ROOT_PASSWORD >> .env
|
|
fi
|
|
|
|
docker-compose up -d
|
|
|
|
echo "Wait a few seconds for the container to spin up ..."
|
|
|
|
sleep 5
|
|
|
|
echo "Done!"
|