annotate prod/install-workflows-app.sh @ 596:652e0b0552b1 production v2.21.0

flow: Merged <release> '2.21.0' to <master> ('production').
author Marc Davis <marc.davis@mcoecn.org>
date Tue, 17 Sep 2024 08:22:06 -0400
parents cb688221b17b
children
rev   line source
383
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
1 #!/bin/bash
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
2 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
3 # read required env variables
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
4 BASEDIR="$PWD"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
5 source $BASEDIR/.env/ssdt-workflows-shared.properties
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
6 source $BASEDIR/.env/ssdt-workflows-app.properties
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
7 # docker login
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
8 echo "Attempting to login to $artifactUrl"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
9 docker login $artifactUrl -u $artifactUser -p $artifactPassword
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
10 # docker pull db image
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
11 echo "Attempting to pull $artifactUrl/ssdt-workflows-app:$appVersion"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
12 docker pull $artifactUrl/ssdt-workflows-app:$appVersion
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
13 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
14 # Builder docker run command based on settings in env files
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
15 echo "Building docker run command"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
16 dockerRunCommand="docker run --name $entityId-workflows-app
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
17 --restart=unless-stopped
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
18 --network $entityId-workflows-net
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
19 -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: 376
diff changeset
20 -e SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
21 -e SPRING_DATASOURCE_USERNAME=postgres
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
22 -e SPRING_DATASOURCE_PASSWORD=$dbPassword
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
23 -e SPRING_PROFILES_ACTIVE=prod
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
24 -e CAMUNDA_BPM_ADMINUSER_ID=admin
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
25 -e CAMUNDA_BPM_ADMINUSER_PASSWORD=$adminPassword
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
26 -e USAS_CONFIGURATION_HOST=$usasHost
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
27 -e USAS_CONFIGURATION_PORT=$usasPort
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
28 -e USAS_CONFIGURATION_APIKEY=$usasApiKey
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
29 -e USAS_CONFIGURATION_REMOTEAPIKEY=$usasRemoteApiKey
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
30 -e USPS_CONFIGURATION_HOST=$uspsHost
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
31 -e USPS_CONFIGURATION_PORT=$uspsPort
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
32 -e USPS_CONFIGURATION_APIKEY=$uspsApiKey
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
33 -e USPS_CONFIGURATION_REMOTEAPIKEY=$uspsRemoteApiKey
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
34 -e JAVA_OPTS=$java_opts"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
35 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
36 if [ ! -z "$usasContext" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
37 dockerRunCommand="$dockerRunCommand -e USAS_CONFIGURATION_CONTEXT=$usasContext"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
38 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
39 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
40 if [ ! -z "$uspsContext" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
41 dockerRunCommand="$dockerRunCommand -e USPS_CONFIGURATION_CONTEXT=$uspsContext"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
42 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
43 #
526
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
44 # If ESS Host is provided, assuming ESS connection needs configured.
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
45 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
46 if [ ! -z "$essHost" ]; then
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
47 echo "configuring employee self-service environment variables"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
48 dockerRunCommand="$dockerRunCommand
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
49 -e ESS_HOST=$essHost
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
50 -e ESS_PORT=$essPort
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
51 -e ESS_API_KEY=$essApiKey
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
52 -e ESS_REMOTE_API_KEY=$essRemoteApiKey"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
53 fi
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
54 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
55 if [ ! -z "$essContext" ]; then
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
56 dockerRunCommand="$dockerRunCommand -e ESS_CONTEXT=$essContext"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
57 fi
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
58 #
383
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
59 if [ ! -z "$virtualHost" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
60 dockerRunCommand="$dockerRunCommand -e VIRTUAL_HOST=$virtualHost"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
61 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
62 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
63 if [ ! -z "$virtualPort" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
64 dockerRunCommand="$dockerRunCommand -e VIRTUAL_PORT=$virtualPort"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
65 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
66 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
67 if [ ! -z "$letsencryptHost" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
68 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_HOST=$letsencryptHost"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
69 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
70 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
71 if [ ! -z "$letsencryptEmail" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
72 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_EMAIL=$letsencryptEmail"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
73 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
74 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
75 if [ ! -z "$hostPort" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
76 dockerRunCommand="$dockerRunCommand -p $hostPort"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
77 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
78 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
79 dockerRunCommand="$dockerRunCommand -d $artifactUrl/ssdt-workflows-app:$appVersion"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
80 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
81 # 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: 376
diff changeset
82 echo "Executing docker run command"
526
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 383
diff changeset
83 $dockerRunCommand