From 7b6d6ca9b992fd610494ad0087a5cfb252dcf2b1 Mon Sep 17 00:00:00 2001 From: Dennis Buchhorn Date: Fri, 15 Oct 2021 15:00:41 +0200 Subject: [PATCH] feat: add compose file and setup script --- docker-compose.yml | 12 +++++++ setup | 80 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 docker-compose.yml create mode 100644 setup diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b9a51cf --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: "3.5" +services: + kimai: + container_name: ${TYPO3_CONTAINER_NAME:-typo3} + image: martinhelmich/typo3:${TYPO3_VERSION:-latest} + restart: unless-stopped + ports: + - ${TYPO3_HOST_IP_ADDRESS:-127.0.0.1}:${TYPO3_HOST_PORT:-8001}:8001 + volumes: + - .fileadmin:/var/www/html/fileadmin + - .typo3conf:/var/www/html/typo3conf + - .uploads:/var/www/html/uploads diff --git a/setup b/setup new file mode 100644 index 0000000..92f3b98 --- /dev/null +++ b/setup @@ -0,0 +1,80 @@ +#!/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_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 "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_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!" + +rm -f .env + +echo "Done!"