#!/bin/bash
|
|
|
|
echo "####################################################################"
|
|
echo "# docker_typo3_setup_script #"
|
|
echo "# Dennis Buchhorn - bucde@b-eit.de #"
|
|
echo "####################################################################"
|
|
echo "# WARNING: password is plain text input! #"
|
|
echo "# #"
|
|
echo "# Config will be saved in 'config' file. #"
|
|
echo "# (everything in plain text, even the password) #"
|
|
#echo "# #"
|
|
echo "####################################################################"
|
|
echo ""
|
|
|
|
DATE=$(date +'%y%m%d%H%M%S')
|
|
|
|
CONFIG_EXISTS="false"
|
|
USE_EXISTING_CONFIG=""
|
|
DELETE_CONFIG=""
|
|
|
|
TYPO3_PROJECT_NAME="typo3_${DATE}"
|
|
TYPO3_PROJECT_NAME_SUFFIX=""
|
|
TYPO3_CONTAINER_NAME="${TYPO3_PROJECT_NAME}_core"
|
|
TYPO3_IMAGE="martinhelmich/typo3"
|
|
TYPO3_VERSION=""
|
|
TYPO3_HOST_IP_ADDRESS=""
|
|
TYPO3_HOST_PORT=""
|
|
|
|
read -p "Enter typo3 project name suffix (leave empty for none): " TYPO3_PROJECT_NAME_SUFFIX
|
|
|
|
if [ -n "$TYPO3_PROJECT_NAME_SUFFIX" ]; then
|
|
TYPO3_PROJECT_NAME="${TYPO3_PROJECT_NAME}_${TYPO3_PROJECT_NAME_SUFFIX}"
|
|
TYPO3_CONTAINER_NAME="${TYPO3_CONTAINER_NAME}_${TYPO3_PROJECT_NAME_SUFFIX}"
|
|
fi
|
|
|
|
rm -f .env
|
|
touch .env
|
|
echo "COMPOSE_PROJECT_NAME="$TYPO3_PROJECT_NAME >> .env
|
|
echo "TYPO3_CONTAINER_NAME="$TYPO3_CONTAINER_NAME >> .env
|
|
|
|
if [ -f "config" ]; then
|
|
CONFIG_EXISTS="true"
|
|
read -p "Config file 'config' already exists! Would you like to use this? (y/n)" USE_EXISTING_CONFIG
|
|
fi
|
|
|
|
if [ $CONFIG_EXISTS == "false" ] || [ $USE_EXISTING_CONFIG == "n" ]; then
|
|
read -p "Would you like to use custom image 'b-eit/typo3'? (y/n)" USE_CUSTOM_IMAGE
|
|
if [ $USE_CUSTOM_IMAGE == "y" ]; then
|
|
echo "You have to build this image (with correct version you want to use) befor manualy with the build script!"
|
|
read -p "Have you done this? (ENTER)"
|
|
TYPO3_IMAGE="b-eit/typo3"
|
|
fi
|
|
read -p "Enter typo3 version which should be used: " TYPO3_VERSION
|
|
read -p "Enter host (vm) ip address on which typo3 should be accessible: " TYPO3_HOST_IP_ADDRESS
|
|
read -p "Enter host (vm) port on which typo3 should be accessible: " TYPO3_HOST_PORT
|
|
|
|
rm -f config
|
|
touch config
|
|
echo "TYPO3_IMAGE="$TYPO3_IMAGE >> config
|
|
echo "TYPO3_VERSION="$TYPO3_VERSION >> config
|
|
echo "TYPO3_HOST_IP_ADDRESS="$TYPO3_HOST_IP_ADDRESS >> config
|
|
echo "TYPO3_HOST_PORT="$TYPO3_HOST_PORT >> config
|
|
|
|
echo "Config file 'config' created!"
|
|
else
|
|
echo "Use existing config file 'config'!"
|
|
fi
|
|
|
|
cat "config" >> ".env"
|
|
|
|
read -p "Should the config file 'config' be deleted after creating the container? (y/n)" DELETE_CONFIG
|
|
|
|
mkdir -p fileadmin typo3conf uploads
|
|
|
|
docker-compose up -d
|
|
|
|
echo -n "Wait until typo3 is ready ..."
|
|
|
|
#while [ "`docker inspect -f {{.State.Health.Status}} $KIMAI_CONTAINER_NAME`" != "healthy" ]; do
|
|
#echo -n "."
|
|
#sleep 1
|
|
#done
|
|
|
|
echo -e "\nTypo3 is ready!"
|
|
|
|
if [ $DELETE_CONFIG == "y" ]; then
|
|
rm -f config
|
|
|
|
echo "Config file 'config' deleted!"
|
|
fi
|
|
|
|
rm -f .env
|
|
|
|
echo "Done!"
|