comparison prod/update-ess-app.sh @ 533:2e67cfae1533 production v2.17.0

flow: Merged <release> '2.17.0' to <master> ('production').
author Marc Davis <marc.davis@mcoecn.org>
date Thu, 02 May 2024 22:46:24 -0400
parents e483148f5283
children b6f03eb10850
comparison
equal deleted inserted replaced
524:6ddfd364a52a 533:2e67cfae1533
1 #!/bin/bash
2 #
3 # read required env variables
4 BASEDIR="$PWD"
5 source $BASEDIR/.env/ess-shared.properties
6 source $BASEDIR/.env/ess-app.properties
7 #
8 # docker login
9 echo "Attempting to login to $artifactUrl"
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword
11 #
12 # docker pull app image
13 echo "Attempting to pull $artifactUrl/ess-app:$appVersion"
14 docker pull $artifactUrl/ess-app:$appVersion
15 #
16 # docker stop ess app container
17 echo "Attempting to stop $entityId-ess-app container"
18 docker stop $entityId-ess-app
19 #
20 # docker rm ess app container
21 echo "Attempting to remove $entityId-ess-app container"
22 docker rm $entityId-ess-app
23 #
24 # Builder docker run command based on settings in env files
25 echo "Building docker run command"
26 dockerRunCommand="docker run --name $entityId-ess-app
27 --restart=unless-stopped
28 --network $entityId-ess-net
29 -e SPRING_DATASOURCE_URL=jdbc:postgresql://$entityId-ess-db:5432/essdb
30 -e SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver
31 -e SPRING_DATASOURCE_USERNAME=postgres
32 -e SPRING_DATASOURCE_PASSWORD=$dbPassword
33 -e SPRING_PROFILES_ACTIVE=prod
34 -e APPLICATION_ADMIN_PASSWORD=$adminPassword
35 -e APPLICATION_ADMIN_RESET=$resetAdminPassword
36 -e USPS_CONFIGURATION_HOST=$uspsHost
37 -e USPS_CONFIGURATION_PORT=$uspsPort
38 -e USPS_CONFIGURATION_APIKEY=$uspsApiKey
39 -e USPS_CONFIGURATION_REMOTEAPIKEY=$uspsRemoteApiKey
40 -e WORKFLOWS_CONFIGURATION_HOST=$workflowsHost
41 -e WORKFLOWS_CONFIGURATION_PORT=$workflowsPort
42 -e WORKFLOWS_CONFIGURATION_API_KEY=$workflowsApiKey
43 -e WORKFLOWS_CONFIGURATION_REMOTE_API_KEY=$workflowsRemoteApiKey
44 -e JAVA_OPTS=$java_opts"
45 #
46 if [ ! -z "$virtualHost" ]; then
47 dockerRunCommand="$dockerRunCommand -e VIRTUAL_HOST=$virtualHost"
48 fi
49 #
50 if [ ! -z "$virtualPort" ]; then
51 dockerRunCommand="$dockerRunCommand -e VIRTUAL_PORT=$virtualPort"
52 fi
53 #
54 if [ ! -z "$letsencryptHost" ]; then
55 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_HOST=$letsencryptHost"
56 fi
57 #
58 if [ ! -z "$letsencryptEmail" ]; then
59 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_EMAIL=$letsencryptEmail"
60 fi
61 #
62 if [ ! -z "$hostPort" ]; then
63 dockerRunCommand="$dockerRunCommand -p $hostPort"
64 fi
65 #
66 #
67 if [ ! -z "$duoEnabled" ]; then
68 echo "Adding Duo Configuration"
69 dockerRunCommand="$dockerRunCommand
70 -e DUO_ENABLED=$duoEnabled
71 -e DUO_CLIENT_ID=$duoClientId
72 -e DUO_CLIENT_SECRET=$duoClientSecret
73 -e DUO_API_HOSTNAME=$duoApiHostname
74 -e DUO_FAIL_OPEN=$duoFailOpen
75 -e DUO_ESS_HOST=$duoEssHost
76 -e DUO_ESS_PORT=$duoEssPort
77 -e DUO_ESS_CONTEXT=$duoEssContext
78 -e DUO_MINUTES_UNTIL_EXPIRATION=$duoMinutesUntilExpiration"
79 fi
80 #
81 #
82 if [ ! -z "$ads_config1_enabled" ]; then
83 echo "Add Window Active Director Configuration 1"
84 dockerRunCommand="$dockerRunCommand
85 -e SSDT_ADS_CONFIG1_ENABLED=$ads_config1_enabled
86 -e SSDT_ADS_CONFIG1_DOMAIN=$ads_config1_domain
87 -e SSDT_ADS_CONFIG1_LDAP_URL=$ads_config1_ldap_url
88 -e SSDT_ADS_CONFIG1_ROOT_DN=$ads_config1_root_dn
89 -e SSDT_ADS_CONFIG1_SEARCH_FILTER=$ads_config1_search_filter"
90 fi
91 #
92 #
93 if [ ! -z "$ads_config2_enabled" ]; then
94 echo "Add Window Active Director Configuration 2"
95 dockerRunCommand="$dockerRunCommand
96 -e SSDT_ADS_CONFIG2_ENABLED=$ads_config2_enabled
97 -e SSDT_ADS_CONFIG2_DOMAIN=$ads_config2_domain
98 -e SSDT_ADS_CONFIG2_LDAP_URL=$ads_config2_ldap_url
99 -e SSDT_ADS_CONFIG2_ROOT_DN=$ads_config2_root_dn
100 -e SSDT_ADS_CONFIG2_SEARCH_FILTER=$ads_config2_search_filter"
101 fi
102 #
103 #
104 if [ ! -z "$ads_config3_enabled" ]; then
105 echo "Add Window Active Director Configuration 3"
106 dockerRunCommand="$dockerRunCommand
107 -e SSDT_ADS_CONFIG3_ENABLED=$ads_config3_enabled
108 -e SSDT_ADS_CONFIG3_DOMAIN=$ads_config3_domain
109 -e SSDT_ADS_CONFIG3_LDAP_URL=$ads_config3_ldap_url
110 -e SSDT_ADS_CONFIG3_ROOT_DN=$ads_config3_root_dn
111 -e SSDT_ADS_CONFIG3_SEARCH_FILTER=$ads_config3_search_filter"
112 fi
113 #
114 #
115 dockerRunCommand="$dockerRunCommand -d $artifactUrl/ess-app:$appVersion"
116 #
117 # Execute constructed docker run command to create $entityId-ess-app container connected to db and docker network
118 echo "Executing docker run command"
119 $dockerRunCommand