annotate prod/update-workflows-app.sh @ 556:425041c5f79e

dearmor keys
author belknapSSDT <zach.belknap@mcoecn.org>
date Thu, 23 May 2024 12:13:27 -0400
parents e483148f5283
children
rev   line source
383
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
1 #!/bin/bash
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
2 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
3 # read required env variables
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
4 BASEDIR="$PWD"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
5 source $BASEDIR/.env/ssdt-workflows-shared.properties
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
6 source $BASEDIR/.env/ssdt-workflows-app.properties
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
7 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
8 # docker login
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
9 echo "Attempting to login to $artifactUrl"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
11 # docker pull app image
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
12 echo "Attempting to pull $artifactUrl/ssdt-workflows-app:$appVersion"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
13 docker pull $artifactUrl/ssdt-workflows-app:$appVersion
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
14 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
15 # docker stop workflows app container
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
16 echo "Attempting to stop $entityId-workflows-app container"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
17 docker stop $entityId-workflows-app
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
18 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
19 # docker rm workflows app container
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
20 echo "Attempting to remove $entityId-workflows-app container"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
21 docker rm $entityId-workflows-app
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
22 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
23 # docker run ssdt-workflows app container based on a new image
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
24 echo "Building docker run command"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
25 dockerRunCommand="docker run --name $entityId-workflows-app
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
26 --restart=unless-stopped
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
27 --network $entityId-workflows-net
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
28 -e SPRING_DATASOURCE_URL=jdbc:postgresql://$entityId-workflows-db:5432/workflowsdb
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
29 -e SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
30 -e SPRING_DATASOURCE_USERNAME=postgres
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
31 -e SPRING_DATASOURCE_PASSWORD=$dbPassword
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
32 -e SPRING_PROFILES_ACTIVE=prod
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
33 -e CAMUNDA_BPM_ADMINUSER_ID=admin
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
34 -e CAMUNDA_BPM_ADMINUSER_PASSWORD=$adminPassword
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
35 -e USAS_CONFIGURATION_HOST=$usasHost
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
36 -e USAS_CONFIGURATION_PORT=$usasPort
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
37 -e USAS_CONFIGURATION_APIKEY=$usasApiKey
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
38 -e USAS_CONFIGURATION_REMOTEAPIKEY=$usasRemoteApiKey
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
39 -e USPS_CONFIGURATION_HOST=$uspsHost
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
40 -e USPS_CONFIGURATION_PORT=$uspsPort
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
41 -e USPS_CONFIGURATION_APIKEY=$uspsApiKey
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
42 -e USPS_CONFIGURATION_REMOTEAPIKEY=$uspsRemoteApiKey
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
43 -e JAVA_OPTS=$java_opts"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
44 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
45 if [ ! -z "$usasContext" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
46 dockerRunCommand="$dockerRunCommand -e USAS_CONFIGURATION_CONTEXT=$usasContext"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
47 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
48 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
49 if [ ! -z "$uspsContext" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
50 dockerRunCommand="$dockerRunCommand -e USPS_CONFIGURATION_CONTEXT=$uspsContext"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
51 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
52 #
528
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
53 # If ESS Host is provided, assuming ESS connection needs configured.
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
54 #
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
55 if [ ! -z "$essHost" ]; then
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
56 echo "configuring employee self-service environment variables"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
57 dockerRunCommand="$dockerRunCommand
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
58 -e ESS_HOST=$essHost
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
59 -e ESS_PORT=$essPort
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
60 -e ESS_API_KEY=$essApiKey
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
61 -e ESS_REMOTE_API_KEY=$essRemoteApiKey"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
62 fi
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
63 #
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
64 if [ ! -z "$essContext" ]; then
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
65 dockerRunCommand="$dockerRunCommand -e ESS_CONTEXT=$essContext"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
66 fi
383
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
67 if [ ! -z "$virtualHost" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
68 dockerRunCommand="$dockerRunCommand -e VIRTUAL_HOST=$virtualHost"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
69 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
70 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
71 if [ ! -z "$virtualPort" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
72 dockerRunCommand="$dockerRunCommand -e VIRTUAL_PORT=$virtualPort"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
73 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
74 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
75 if [ ! -z "$letsencryptHost" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
76 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_HOST=$letsencryptHost"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
77 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
78 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
79 if [ ! -z "$letsencryptEmail" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
80 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_EMAIL=$letsencryptEmail"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
81 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
82 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
83 if [ ! -z "$hostPort" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
84 dockerRunCommand="$dockerRunCommand -p $hostPort"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
85 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
86 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
87 dockerRunCommand="$dockerRunCommand -d $artifactUrl/ssdt-workflows-app:$appVersion"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
88 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
89 # Execute constructed docker run command to create $entityId-workflows-app container connected to db and docker network
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
90 echo "Executing docker run command"
528
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
91 $dockerRunCommand