annotate prod/install-ess-app.sh @ 537:ad36483ba0c2

Update scripts to add execute permission
author Matt Calmes <calmes@ssdt-ohio.org>
date Mon, 06 May 2024 10:59:39 -0400
parents e483148f5283
children
rev   line source
526
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
1 #!/bin/bash
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
2 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
3 # read required env variables
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
4 BASEDIR="$PWD"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
5 source $BASEDIR/.env/ess-shared.properties
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
6 source $BASEDIR/.env/ess-app.properties
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
7 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
8 # docker login
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
9 echo "Attempting to login to $artifactUrl"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
11 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
12 # docker pull app image
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
13 echo "Attempting to pull $artifactUrl/ess-app:$appVersion"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
14 docker pull $artifactUrl/ess-app:$appVersion
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
15 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
16 # Builder docker run command based on settings in env files
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
17 echo "Building docker run command"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
18 dockerRunCommand="docker run --name $entityId-ess-app
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
19 --restart=unless-stopped
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
20 --network $entityId-ess-net
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
21 -e SPRING_DATASOURCE_URL=jdbc:postgresql://$entityId-ess-db:5432/essdb
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
22 -e SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
23 -e SPRING_DATASOURCE_USERNAME=postgres
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
24 -e SPRING_DATASOURCE_PASSWORD=$dbPassword
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
25 -e SPRING_PROFILES_ACTIVE=prod
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
26 -e APPLICATION_ADMIN_PASSWORD=$adminPassword
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
27 -e APPLICATION_ADMIN_RESET=$resetAdminPassword
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
28 -e USPS_CONFIGURATION_HOST=$uspsHost
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
29 -e USPS_CONFIGURATION_PORT=$uspsPort
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
30 -e USPS_CONFIGURATION_APIKEY=$uspsApiKey
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
31 -e USPS_CONFIGURATION_REMOTEAPIKEY=$uspsRemoteApiKey
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
32 -e WORKFLOWS_CONFIGURATION_HOST=$workflowsHost
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
33 -e WORKFLOWS_CONFIGURATION_PORT=$workflowsPort
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
34 -e WORKFLOWS_CONFIGURATION_API_KEY=$workflowsApiKey
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
35 -e WORKFLOWS_CONFIGURATION_REMOTE_API_KEY=$workflowsRemoteApiKey
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
36 -e JAVA_OPTS=$java_opts"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
37 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
38 if [ ! -z "$virtualHost" ]; then
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
39 dockerRunCommand="$dockerRunCommand -e VIRTUAL_HOST=$virtualHost"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
40 fi
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
41 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
42 if [ ! -z "$virtualPort" ]; then
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
43 dockerRunCommand="$dockerRunCommand -e VIRTUAL_PORT=$virtualPort"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
44 fi
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
45 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
46 if [ ! -z "$letsencryptHost" ]; then
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
47 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_HOST=$letsencryptHost"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
48 fi
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
49 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
50 if [ ! -z "$letsencryptEmail" ]; then
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
51 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_EMAIL=$letsencryptEmail"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
52 fi
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
53 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
54 if [ ! -z "$hostPort" ]; then
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
55 dockerRunCommand="$dockerRunCommand -p $hostPort"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
56 fi
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
57 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
58 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
59 if [ ! -z "$duoEnabled" ]; then
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
60 echo "Adding Duo Configuration"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
61 dockerRunCommand="$dockerRunCommand
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
62 -e DUO_ENABLED=$duoEnabled
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
63 -e DUO_CLIENT_ID=$duoClientId
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
64 -e DUO_CLIENT_SECRET=$duoClientSecret
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
65 -e DUO_API_HOSTNAME=$duoApiHostname
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
66 -e DUO_FAIL_OPEN=$duoFailOpen
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
67 -e DUO_ESS_HOST=$duoEssHost
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
68 -e DUO_ESS_PORT=$duoEssPort
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
69 -e DUO_ESS_CONTEXT=$duoEssContext
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
70 -e DUO_MINUTES_UNTIL_EXPIRATION=$duoMinutesUntilExpiration"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
71 fi
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
72 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
73 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
74 if [ ! -z "$ads_config1_enabled" ]; then
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
75 echo "Add Window Active Director Configuration 1"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
76 dockerRunCommand="$dockerRunCommand
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
77 -e SSDT_ADS_CONFIG1_ENABLED=$ads_config1_enabled
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
78 -e SSDT_ADS_CONFIG1_DOMAIN=$ads_config1_domain
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
79 -e SSDT_ADS_CONFIG1_LDAP_URL=$ads_config1_ldap_url
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
80 -e SSDT_ADS_CONFIG1_ROOT_DN=$ads_config1_root_dn
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
81 -e SSDT_ADS_CONFIG1_SEARCH_FILTER=$ads_config1_search_filter"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
82 fi
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
83 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
84 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
85 if [ ! -z "$ads_config2_enabled" ]; then
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
86 echo "Add Window Active Director Configuration 2"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
87 dockerRunCommand="$dockerRunCommand
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
88 -e SSDT_ADS_CONFIG2_ENABLED=$ads_config2_enabled
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
89 -e SSDT_ADS_CONFIG2_DOMAIN=$ads_config2_domain
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
90 -e SSDT_ADS_CONFIG2_LDAP_URL=$ads_config2_ldap_url
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
91 -e SSDT_ADS_CONFIG2_ROOT_DN=$ads_config2_root_dn
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
92 -e SSDT_ADS_CONFIG2_SEARCH_FILTER=$ads_config2_search_filter"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
93 fi
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
94 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
95 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
96 if [ ! -z "$ads_config3_enabled" ]; then
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
97 echo "Add Window Active Director Configuration 3"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
98 dockerRunCommand="$dockerRunCommand
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
99 -e SSDT_ADS_CONFIG3_ENABLED=$ads_config3_enabled
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
100 -e SSDT_ADS_CONFIG3_DOMAIN=$ads_config3_domain
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
101 -e SSDT_ADS_CONFIG3_LDAP_URL=$ads_config3_ldap_url
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
102 -e SSDT_ADS_CONFIG3_ROOT_DN=$ads_config3_root_dn
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
103 -e SSDT_ADS_CONFIG3_SEARCH_FILTER=$ads_config3_search_filter"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
104 fi
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
105 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
106 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
107 dockerRunCommand="$dockerRunCommand -d $artifactUrl/ess-app:$appVersion"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
108 #
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
109 # Execute constructed docker run command to create $entityId-ess-app container connected to db and docker network
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
110 echo "Executing docker run command"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
111 $dockerRunCommand