view prod/install-workflows-app.sh @ 377:c1e8c755bce2 production

flow: Promoted <release> 'v2.11.0' (c6b2a1abecb8) to 'production'.
author Marc Davis <davis@ssdt-ohio.org>
date Fri, 10 Sep 2021 07:47:54 -0400
parents c6b2a1abecb8
children 5909f75b4f13
line wrap: on
line source
#!/bin/bash
#
# read required env variables
BASEDIR="$PWD"
source $BASEDIR/.env/ssdt-workflows-shared.properties
source $BASEDIR/.env/ssdt-workflows-app.properties
# docker login
echo "Attempting to login to $artifactUrl"
docker login $artifactUrl -u $artifactUser -p $artifactPassword
# docker pull db image
echo "Attempting to pull $artifactUrl/ssdt-workflows-app:$appVersion"
docker pull $artifactUrl/ssdt-workflows-app:$appVersion
#
# Builder docker run command based on settings in env files
echo "Building docker run command"
dockerRunCommand="docker run --name $entityId-workflows-app
  --restart=unless-stopped
  --network $entityId-workflows-net
  -e SPRING_DATASOURCE_URL=jdbc:postgresql://$entityId-workflows-db:5432/workflowsdb
  -e SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver
  -e SPRING_DATASOURCE_USERNAME=postgres
  -e SPRING_DATASOURCE_PASSWORD=$dbPassword
  -e SPRING_PROFILES_ACTIVE=prod
  -e CAMUNDA_BPM_ADMINUSER_ID=admin
  -e CAMUNDA_BPM_ADMINUSER_PASSWORD=$adminPassword
  -e USAS_CONFIGURATION_HOST=$usasHost
  -e USAS_CONFIGURATION_PORT=$usasPort
  -e USAS_CONFIGURATION_APIKEY=$usasApiKey
  -e USAS_CONFIGURATION_REMOTEAPIKEY=$usasRemoteApiKey
  -e USPS_CONFIGURATION_HOST=$uspsHost
  -e USPS_CONFIGURATION_PORT=$uspsPort
  -e USPS_CONFIGURATION_APIKEY=$uspsApiKey
  -e USPS_CONFIGURATION_REMOTEAPIKEY=$uspsRemoteApiKey
  -e JAVA_OPTS=$java_opts"
#
if [ ! -z "$usasContext" ]; then
    dockerRunCommand="$dockerRunCommand -e USAS_CONFIGURATION_CONTEXT=$usasContext"
fi
#
if [ ! -z "$uspsContext" ]; then
    dockerRunCommand="$dockerRunCommand -e USPS_CONFIGURATION_CONTEXT=$uspsContext"
fi
#
if [ ! -z "$virtualHost" ]; then
    dockerRunCommand="$dockerRunCommand -e VIRTUAL_HOST=$virtualHost"
fi
#
if [ ! -z "$virtualPort" ]; then
    dockerRunCommand="$dockerRunCommand -e VIRTUAL_PORT=$virtualPort"
fi
#
if [ ! -z "$letsencryptHost" ]; then
    dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_HOST=$letsencryptHost"
fi
#
if [ ! -z "$letsencryptEmail" ]; then
    dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_EMAIL=$letsencryptEmail"
fi
#
if [ ! -z "$hostPort" ]; then
    dockerRunCommand="$dockerRunCommand -p $hostPort"
fi
#
dockerRunCommand="$dockerRunCommand -d $artifactUrl/ssdt-workflows-app:$appVersion"
#
# Execute constructed docker run command to create $entityId-workflows-app container connected to db and docker network
echo "Executing docker run command"
$dockerRunCommand