Use Motech IP in install script instead of hostname

This commit is contained in:
Disassembler 2018-03-27 16:27:09 +02:00
parent 6cc27f7e48
commit c42c59d9ac
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499

View File

@ -31,13 +31,14 @@ service motech start
# Configure Motech admin
echo `date` '- Waiting for database to be populated. This should take about a minute.'
until curl -s "http://motech:8080/motech/module/server/startup/" | grep -q adminLogin; do
MOTECH_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' motech)
until curl -s "http://${MOTECH_IP}:8080/motech/module/server/startup/" | grep -q adminLogin; do
sleep 1
done
export MOTECH_ADMIN_USER="admin"
export MOTECH_ADMIN_EMAIL="admin@example.com"
export MOTECH_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
curl -H "Content-Type: application/json" -X POST -d "{\"adminLogin\":\"${MOTECH_ADMIN_USER}\",\"adminEmail\":\"${MOTECH_ADMIN_EMAIL}\",\"adminPassword\":\"${MOTECH_ADMIN_PWD}\",\"adminConfirmPassword\":\"${MOTECH_ADMIN_PWD}\",\"language\":\"cs\",\"providerName\":\"\",\"providerUrl\":\"\",\"schedulerUrl\":\"\"}" http://motech:8080/motech/module/server/startup/
curl -H "Content-Type: application/json" -X POST -d "{\"adminLogin\":\"${MOTECH_ADMIN_USER}\",\"adminEmail\":\"${MOTECH_ADMIN_EMAIL}\",\"adminPassword\":\"${MOTECH_ADMIN_PWD}\",\"adminConfirmPassword\":\"${MOTECH_ADMIN_PWD}\",\"language\":\"cs\",\"providerName\":\"\",\"providerUrl\":\"\",\"schedulerUrl\":\"\"}" http://${MOTECH_IP}:8080/motech/module/server/startup/
# Add application definition
spotter-appmgr add-app motech "https://motech.{host}/motech/" "${MOTECH_ADMIN_USER}" "${MOTECH_ADMIN_PWD}"