comparison prod/update-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 c3e22e61d5a1
children 5909f75b4f13
comparison
equal deleted inserted replaced
372:173b41c77349 377:c1e8c755bce2
1 #!/bin/bash
2 #
3 # read required env variables
4 BASEDIR="$PWD"
5 source $BASEDIR/.env/ssdt-workflows-shared.properties
6 source $BASEDIR/.env/ssdt-workflows-app.properties
7 #
8 # docker login
9 echo "Attempting to login to $artifactUrl"
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword
11 # docker pull app image
12 echo "Attempting to pull $artifactUrl/ssdt-workflows-app:$appVersion"
13 docker pull $artifactUrl/ssdt-workflows-app:$appVersion
14 #
15 # docker stop workflows app container
16 echo "Attempting to stop $entityId-workflows-app container"
17 docker stop $entityId-workflows-app
18 #
19 # docker rm workflows app container
20 echo "Attempting to remove $entityId-workflows-app container"
21 docker rm $entityId-workflows-app
22 #
23 # docker run ssdt-workflows app container based on a new image
24 echo "Building docker run command"
25 dockerRunCommand="docker run --name $entityId-workflows-app
26 --restart=unless-stopped
27 --network $entityId-workflows-net
28 -e SPRING_DATASOURCE_URL=jdbc:postgresql://$entityId-workflows-db:5432/workflowsdb
29 -e SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver
30 -e SPRING_DATASOURCE_USERNAME=postgres
31 -e SPRING_DATASOURCE_PASSWORD=$dbPassword
32 -e SPRING_PROFILES_ACTIVE=prod
33 -e CAMUNDA_BPM_ADMINUSER_ID=admin
34 -e CAMUNDA_BPM_ADMINUSER_PASSWORD=$adminPassword
35 -e USAS_CONFIGURATION_HOST=$usasHost
36 -e USAS_CONFIGURATION_PORT=$usasPort
37 -e USAS_CONFIGURATION_APIKEY=$usasApiKey
38 -e USAS_CONFIGURATION_REMOTEAPIKEY=$usasRemoteApiKey
39 -e USPS_CONFIGURATION_HOST=$uspsHost
40 -e USPS_CONFIGURATION_PORT=$uspsPort
41 -e USPS_CONFIGURATION_APIKEY=$uspsApiKey
42 -e USPS_CONFIGURATION_REMOTEAPIKEY=$uspsRemoteApiKey
43 -e JAVA_OPTS=$java_opts"
44 #
45 if [ ! -z "$usasContext" ]; then
46 dockerRunCommand="$dockerRunCommand -e USAS_CONFIGURATION_CONTEXT=$usasContext"
47 fi
48 #
49 if [ ! -z "$uspsContext" ]; then
50 dockerRunCommand="$dockerRunCommand -e USPS_CONFIGURATION_CONTEXT=$uspsContext"
51 fi
52 #
53 if [ ! -z "$virtualHost" ]; then
54 dockerRunCommand="$dockerRunCommand -e VIRTUAL_HOST=$virtualHost"
55 fi
56 #
57 if [ ! -z "$virtualPort" ]; then
58 dockerRunCommand="$dockerRunCommand -e VIRTUAL_PORT=$virtualPort"
59 fi
60 #
61 if [ ! -z "$letsencryptHost" ]; then
62 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_HOST=$letsencryptHost"
63 fi
64 #
65 if [ ! -z "$letsencryptEmail" ]; then
66 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_EMAIL=$letsencryptEmail"
67 fi
68 #
69 if [ ! -z "$hostPort" ]; then
70 dockerRunCommand="$dockerRunCommand -p $hostPort"
71 fi
72 #
73 dockerRunCommand="$dockerRunCommand -d $artifactUrl/ssdt-workflows-app:$appVersion"
74 #
75 # Execute constructed docker run command to create $entityId-workflows-app container connected to db and docker network
76 echo "Executing docker run command"
77 $dockerRunCommand