annotate prod/update-workflows-app.sh @ 408:e49038cbb14c

Add scripts for ITC Management application
author Marc Davis <marc.davis@mcoecn.org>
date Mon, 10 Oct 2022 14:32:06 -0400
parents 5909f75b4f13
children e483148f5283
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 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
53 if [ ! -z "$virtualHost" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
54 dockerRunCommand="$dockerRunCommand -e VIRTUAL_HOST=$virtualHost"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
55 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
56 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
57 if [ ! -z "$virtualPort" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
58 dockerRunCommand="$dockerRunCommand -e VIRTUAL_PORT=$virtualPort"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
59 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
60 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
61 if [ ! -z "$letsencryptHost" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
62 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_HOST=$letsencryptHost"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
63 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
64 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
65 if [ ! -z "$letsencryptEmail" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
66 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_EMAIL=$letsencryptEmail"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
67 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
68 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
69 if [ ! -z "$hostPort" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
70 dockerRunCommand="$dockerRunCommand -p $hostPort"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
71 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
72 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
73 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
74 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 375
diff changeset
75 # 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
76 echo "Executing docker run command"
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
77 $dockerRunCommand