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