view compose2/preview/setup.sh @ 131:70ec01165f8e

DEP-12: fix permissions
author Dave smith <smith@nwoca.org>
date Mon, 08 May 2017 14:43:56 -0400
parents bf5f8acc35f2
children a095257a342b
line wrap: on
line source
#!/bin/bash
# Sets up a new district project based on SSDT default configuration in the current working directory.
#
# Usage:
#
#  /data/preview/sampletown $   /ssdt/compose2/preview/setup.sh
#
# Will create a docker-compose.yml and .env file with default settings.
#
# 
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/.functions.sh"

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

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

if [ ! -e "docker-compose.yml" ] ; then
    cp $base/usxs-template.yml ./docker-compose.yml
    echo "created docker-compose.yml"
fi

touch .env

source .env

if [ "$COMPOSE_PROJECT_NAME" == "" ]
then
   echo "COMPOSE_PROJECT_NAME=$(basename $PWD)" >> .env
   echo "set project name in .env file"
   source .env
fi

echo "project '$COMPOSE_PROJECT_NAME' ready with default values.  Review or create a docker-compose.override.yml for custom settings."