# HG changeset patch # User smith@nwoca.org # Date 1500403178 -3600 # Node ID ab4effbe8d43a71028de9479f1a515f92dd2b7de # Parent d20c6ff9a821b5869833c66d02ee1035c85b904f DEP-12: generate unique DB passwords for application databases diff -r d20c6ff9a821 -r ab4effbe8d43 pilot/setup.sh --- a/pilot/setup.sh Mon Jul 10 18:24:40 2017 +0100 +++ b/pilot/setup.sh Tue Jul 18 19:39:38 2017 +0100 @@ -18,6 +18,10 @@ md5sum -c --status ${1} ; } +genDBHash() { + echo $(date +%s%N | sha256sum | base64 | head -c 32 ; echo) +} + base=$(dirname "${BASH_SOURCE[0]}") default_name=$(basename $PWD) @@ -59,7 +63,9 @@ if [ "$create" == "OK" ] then - echo "version: \"3.3\"" > ./docker-compose.yml + echo "# **** DO NOT MODIFY THIS FILE. ****" > ./docker-compose.yml + echo "# Place customizations in docker-compose.override.yml and .env" >> ./docker-compose.yml + echo "version: \"3.3\"" >> ./docker-compose.yml echo "services:" >> ./docker-compose.yml [ ! "$usas" == "" ] && cat $base/usas-services.yml >> ./docker-compose.yml @@ -68,12 +74,21 @@ echo "volumes:" >> ./docker-compose.yml - [ ! "$usas" == "" ] && echo " usasdata:" >> ./docker-compose.yml - [ ! "$usps" == "" ] && echo " uspsdata:" >> ./docker-compose.yml - + if [ ! "$usas" == "" ] + then + echo " usasdata:" >> ./docker-compose.yml + [ "$USAS_DB_PASSWORD" == "" ] && echo "USAS_DB_PASSWORD=$(genDBHash)" >> ./.env + fi + + if [ ! "$usps" == "" ] + then + echo " uspsdata:" >> ./docker-compose.yml + [ "$USPS_DB_PASSWORD" == "" ] && echo "USPS_DB_PASSWORD=$(genDBHash)" >> ./.env + fi + echo "" >> ./docker-compose.yml - md5calc ./docker-compose.yml > .docker-compose.md5 + md5calc ./docker-compose.yml > .docker-compose.md5 echo "created docker-compose.yml"