annotate prod/install-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 cb688221b17b
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 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
44 if [ ! -z "$virtualHost" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
45 dockerRunCommand="$dockerRunCommand -e VIRTUAL_HOST=$virtualHost"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
46 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
47 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
48 if [ ! -z "$virtualPort" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
49 dockerRunCommand="$dockerRunCommand -e VIRTUAL_PORT=$virtualPort"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
50 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
51 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
52 if [ ! -z "$letsencryptHost" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
53 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_HOST=$letsencryptHost"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
54 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
55 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
56 if [ ! -z "$letsencryptEmail" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
57 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_EMAIL=$letsencryptEmail"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
58 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
59 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
60 if [ ! -z "$hostPort" ]; then
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
61 dockerRunCommand="$dockerRunCommand -p $hostPort"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
62 fi
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
63 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
64 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
65 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
66 # 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
67 echo "Executing docker run command"
376
c6b2a1abecb8 SW-262: Move install-workflows-db.sh and install-workflows-app.sh to ssdt-docker project
Marc Davis <davis@ssdt-ohio.org>
parents:
diff changeset
68 $dockerRunCommand