view prod/training.sh @ 343:b8373a99ad4d production

testbench updates
author aldrich@ssdt-ohio.org
date Wed, 20 May 2020 13:58:02 +0100
parents 61b1d93977cd
children
line wrap: on
line source
#!/bin/bash
# Sets up a new Training project based on SSDT default configuration in the current working directory.
#
# Usage:
#
#  /data/preview/training-01 $   /ssdt/compose2/prod/training.sh
#
# Will create a docker-compose.yml and .env file with default settings using the SSDT 
# supplied training database
#
# These are special database images which recreates the database each time the container is started.
# Therefore, it is very easy to reset the training database simply deleting and restarting the containers. 
# For example:
#     
#    docker-compose down
#    docker-compose up -d
#
source "$(dirname "${BASH_SOURCE[0]}")/../scripts/.functions.sh"

md5calc() {
   md5sum ${1} ;
}

md5verify() {
   md5sum -c --status ${1} ;
}

genDBHash() {
 echo $(date +%s%N | sha256sum | base64 | head -c 32 ; echo)
}

base=$(dirname "${BASH_SOURCE[0]}")
default_name=$(basename $PWD)

args="$1$2"

usas=""
usps=""

if [ "$args" == "" ] || [ -z "${args##*usas*}" ]
then
   usas=1
fi

if [ "$args" == "" ] || [ -z "${args##*usps*}" ]
then
   usps=1
fi

echo "Preparing training project '$(basename $PWD)' with default USxS configuration" 

touch .env
source .env

project_name=${default_name}

if [ "$COMPOSE_PROJECT_NAME" == "" ]