comparison prod/setup.sh @ 328:1f0ff7540734

USASR-4075 Forcing Unique Admin Password
author aldrich@ssdt-ohio.org
date Wed, 04 Dec 2019 11:57:48 +0000
parents 2ae65177f74e
children e36bf4191e25
comparison
equal deleted inserted replaced
325:389acfd7be9a 328:1f0ff7540734
5 # 5 #
6 # /data/preview/sampletown $ /ssdt/compose2/preview/setup.sh [usas,usps...] 6 # /data/preview/sampletown $ /ssdt/compose2/preview/setup.sh [usas,usps...]
7 # 7 #
8 # Will create a docker-compose.yml and .env file with default settings. 8 # Will create a docker-compose.yml and .env file with default settings.
9 # 9 #
10 # 10 # Updated December 2019 to generate random admin passwords
11 source "$(dirname "${BASH_SOURCE[0]}")/../scripts/.functions.sh" 11 source "$(dirname "${BASH_SOURCE[0]}")/../scripts/.functions.sh"
12 12
13 md5calc() { 13 md5calc() {
14 md5sum ${1} ; 14 md5sum ${1} ;
15 } 15 }
78 78
79 if [ ! "$usas" == "" ] 79 if [ ! "$usas" == "" ]
80 then 80 then
81 echo " usasdata:" >> ./docker-compose.yml 81 echo " usasdata:" >> ./docker-compose.yml
82 [ "$USAS_DB_PASSWORD" == "" ] && echo "USAS_DB_PASSWORD=$(genDBHash)" >> ./.env 82 [ "$USAS_DB_PASSWORD" == "" ] && echo "USAS_DB_PASSWORD=$(genDBHash)" >> ./.env
83 [ "$USAS_ADMIN_PASSWORD" == "" ] && echo "USAS_ADMIN_PASSWORD=$(genDBHash)" >> ./.env
83 fi 84 fi
84 85
85 if [ ! "$usps" == "" ] 86 if [ ! "$usps" == "" ]
86 then 87 then
87 echo " uspsdata:" >> ./docker-compose.yml 88 echo " uspsdata:" >> ./docker-compose.yml
88 [ "$USPS_DB_PASSWORD" == "" ] && echo "USPS_DB_PASSWORD=$(genDBHash)" >> ./.env 89 [ "$USPS_DB_PASSWORD" == "" ] && echo "USPS_DB_PASSWORD=$(genDBHash)" >> ./.env
90 [ "$USPS_ADMIN_PASSWORD" == "" ] && echo "USPS_ADMIN_PASSWORD=$(genDBHash)" >> ./.env
89 fi 91 fi
90 92
91 echo "" >> ./docker-compose.yml 93 echo "" >> ./docker-compose.yml
92 94
93 md5calc ./docker-compose.yml > .docker-compose.md5 95 md5calc ./docker-compose.yml > .docker-compose.md5
99 101
100 Error! docker-compose.yml file has been modified or checksum missing. Can not auto-apply update(s). 102 Error! docker-compose.yml file has been modified or checksum missing. Can not auto-apply update(s).
101 Move customizations to docker-compose.override.yml then delete the docker-compose.yml 103 Move customizations to docker-compose.override.yml then delete the docker-compose.yml
102 " 104 "
103 fi 105 fi
104 106 ##Only creates a docker-compose.override.yml if one does not already exist.
105 if [ ! -e "docker-compose.override.yml" ] 107 if [ ! -e "docker-compose.override.yml" ]
106 then 108 then
107 echo 'version: "3.3"' >> docker-compose.override.yml 109 echo 'version: "3.3"' >> docker-compose.override.yml
110 echo 'services:' >> docker-compose.override.yml
111 ##usas admin components
112 if [ ! "$usas" == "" ]
113 then
114 echo ' usasapp:' >> docker-compose.override.yml
115 echo ' environment:' >> docker-compose.override.yml
116 echo ' - APPLICATION_ADMIN_PASSWORD=${USAS_ADMIN_PASSWORD}' >> docker-compose.override.yml
117 echo ' - APPLICATION_ADMIN_RESET=true' >> docker-compose.override.yml
118
119 fi
120 ##usps admin components
121 if [ ! "$usps" == "" ]
122 then
123 echo ' uspsapp:' >> docker-compose.override.yml
124 echo ' environment:' >> docker-compose.override.yml
125 echo ' - APPLICATION_ADMIN_PASSWORD=${USPS_ADMIN_PASSWORD}' >> docker-compose.override.yml
126 echo ' - APPLICATION_ADMIN_RESET=true' >> docker-compose.override.yml
127
128 fi
129 ##end of entire if statments for docker-compose.override.yml
108 fi 130 fi
109 131
110 if [ "$USAS_APPLICATIONID" == "" ] 132 if [ "$USAS_APPLICATIONID" == "" ]
111 then 133 then
112 read -e -p "Generate USAS and USPS integration config? <Y/n> " answer 134 read -e -p "Generate USAS and USPS integration config? <Y/n> " answer