annotate prod/update-itcm-app.sh @ 605:46a67e7afd98 release/2.23.0 tip

flow: Created branch 'release/2.23.0'.
author Marc Davis <marc.davis@mcoecn.org>
date Wed, 18 Sep 2024 20:38:06 -0400
parents f5c4bb536604
children
rev   line source
408
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
1 #!/bin/bash
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
2 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
3 # read required env variables
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
4 BASEDIR="$PWD"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
5 source $BASEDIR/.env/itcm-shared.properties
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
6 source $BASEDIR/.env/itcm-app.properties
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
7 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
8 # docker login
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
9 echo "Attempting to login to $artifactUrl"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
11 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
12 # docker pull app image
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
13 echo "Attempting to pull $artifactUrl/itcm-app:$appVersion"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
14 docker pull $artifactUrl/itcm-app:$appVersion
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
15 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
16 # docker stop itcm app container
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
17 echo "Attempting to stop $entityId-itcm-app container"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
18 docker stop $entityId-itcm-app
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
19 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
20 # docker rm itcm app container
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
21 echo "Attempting to remove $entityId-itcm-app container"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
22 docker rm $entityId-itcm-app
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
23 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
24 # Builder docker run command based on settings in env files
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
25 echo "Building docker run command"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
26 dockerRunCommand="docker run --name $entityId-itcm-app
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
27 --restart=unless-stopped
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
28 --network $entityId-itcm-net
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
29 -e SPRING_DATASOURCE_URL=jdbc:postgresql://$entityId-itcm-db:5432/itcmdb
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
30 -e SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
31 -e SPRING_DATASOURCE_USERNAME=postgres
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
32 -e SPRING_DATASOURCE_PASSWORD=$dbPassword
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
33 -e SPRING_PROFILES_ACTIVE=prod
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
34 -e APPLICATION_ADMIN_PASSWORD=$adminPassword
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
35 -e APPLICATION_ADMIN_RESET=$resetAdminPassword
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
36 -e JAVA_OPTS=$java_opts"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
37 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
38 if [ ! -z "$virtualHost" ]; then
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
39 dockerRunCommand="$dockerRunCommand -e VIRTUAL_HOST=$virtualHost"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
40 fi
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
41 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
42 if [ ! -z "$virtualPort" ]; then
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
43 dockerRunCommand="$dockerRunCommand -e VIRTUAL_PORT=$virtualPort"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
44 fi
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
45 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
46 if [ ! -z "$letsencryptHost" ]; then
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
47 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_HOST=$letsencryptHost"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
48 fi
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
49 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
50 if [ ! -z "$letsencryptEmail" ]; then
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
51 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_EMAIL=$letsencryptEmail"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
52 fi
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
53 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
54 if [ ! -z "$hostPort" ]; then
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
55 dockerRunCommand="$dockerRunCommand -p $hostPort"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
56 fi
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
57 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
58 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
59 if [ ! -z "$duoEnabled" ]; then
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
60 echo "Adding Duo Configuration"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
61 dockerRunCommand="$dockerRunCommand
415
edf477197f1b Remove SSDT_ prefix
Marc Davis <marc.davis@mcoecn.org>
parents: 408
diff changeset
62 -e DUO_ENABLED=$duoEnabled
edf477197f1b Remove SSDT_ prefix
Marc Davis <marc.davis@mcoecn.org>
parents: 408
diff changeset
63 -e DUO_CLIENT_ID=$duoClientId
edf477197f1b Remove SSDT_ prefix
Marc Davis <marc.davis@mcoecn.org>
parents: 408
diff changeset
64 -e DUO_CLIENT_SECRET=$duoClientSecret
edf477197f1b Remove SSDT_ prefix
Marc Davis <marc.davis@mcoecn.org>
parents: 408
diff changeset
65 -e DUO_API_HOSTNAME=$duoApiHostname
edf477197f1b Remove SSDT_ prefix
Marc Davis <marc.davis@mcoecn.org>
parents: 408
diff changeset
66 -e DUO_FAIL_OPEN=$duoFailOpen
edf477197f1b Remove SSDT_ prefix
Marc Davis <marc.davis@mcoecn.org>
parents: 408
diff changeset
67 -e DUO_ITCM_HOST=$duoItcmHost
edf477197f1b Remove SSDT_ prefix
Marc Davis <marc.davis@mcoecn.org>
parents: 408
diff changeset
68 -e DUO_ITCM_PORT=$duoItcmPort
edf477197f1b Remove SSDT_ prefix
Marc Davis <marc.davis@mcoecn.org>
parents: 408
diff changeset
69 -e DUO_ITCM_CONTEXT=$duoItcmContext
edf477197f1b Remove SSDT_ prefix
Marc Davis <marc.davis@mcoecn.org>
parents: 408
diff changeset
70 -e DUO_MINUTES_UNTIL_EXPIRATION=$duoMinutesUntilExpiration"
408
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
71 fi
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
72 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
73 #
603
f5c4bb536604 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 415
diff changeset
74 if [ ! -z "$miniOrangeEnabled" ]; then
f5c4bb536604 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 415
diff changeset
75 echo "Adding MiniOrange Configuration"
f5c4bb536604 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 415
diff changeset
76 dockerRunCommand="$dockerRunCommand
f5c4bb536604 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 415
diff changeset
77 -e MINI_ORANGE_ENABLED=$miniOrangeEnabled
f5c4bb536604 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 415
diff changeset
78 -e MINI_ORANGE_CLIENT_ID=$miniOrangeClientId
f5c4bb536604 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 415
diff changeset
79 -e MINI_ORANGE_CLIENT_SECRET=$miniOrangeClientSecret
f5c4bb536604 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 415
diff changeset
80 -e MINI_ORANGE_API_HOSTNAME=$miniOrangeApiHostname
f5c4bb536604 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 415
diff changeset
81 -e MINI_ORANGE_FAIL_OPEN=$miniOrangeFailOpen
f5c4bb536604 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 415
diff changeset
82 -e MINI_ORANGE_APP_HOST=$miniOrangeEssHost
f5c4bb536604 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 415
diff changeset
83 -e MINI_ORANGE_MINUTES_UNTIL_EXPIRATION=$miniOrangeMinutesUntilExpiration"
f5c4bb536604 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 415
diff changeset
84 fi
f5c4bb536604 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 415
diff changeset
85 #
f5c4bb536604 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 415
diff changeset
86 #
408
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
87 if [ ! -z "$ads_config1_enabled" ]; then
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
88 echo "Add Window Active Director Configuration 1"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
89 dockerRunCommand="$dockerRunCommand
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
90 -e SSDT_ADS_CONFIG1_ENABLED=$ads_config1_enabled
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
91 -e SSDT_ADS_CONFIG1_DOMAIN=$ads_config1_domain
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
92 -e SSDT_ADS_CONFIG1_LDAP_URL=$ads_config1_ldap_url
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
93 -e SSDT_ADS_CONFIG1_ROOT_DN=$ads_config1_root_dn
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
94 -e SSDT_ADS_CONFIG1_SEARCH_FILTER=$ads_config1_search_filter"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
95 fi
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
96 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
97 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
98 if [ ! -z "$ads_config2_enabled" ]; then
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
99 echo "Add Window Active Director Configuration 2"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
100 dockerRunCommand="$dockerRunCommand
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
101 -e SSDT_ADS_CONFIG2_ENABLED=$ads_config2_enabled
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
102 -e SSDT_ADS_CONFIG2_DOMAIN=$ads_config2_domain
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
103 -e SSDT_ADS_CONFIG2_LDAP_URL=$ads_config2_ldap_url
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
104 -e SSDT_ADS_CONFIG2_ROOT_DN=$ads_config2_root_dn
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
105 -e SSDT_ADS_CONFIG2_SEARCH_FILTER=$ads_config2_search_filter"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
106 fi
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
107 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
108 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
109 if [ ! -z "$ads_config3_enabled" ]; then
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
110 echo "Add Window Active Director Configuration 3"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
111 dockerRunCommand="$dockerRunCommand
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
112 -e SSDT_ADS_CONFIG3_ENABLED=$ads_config3_enabled
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
113 -e SSDT_ADS_CONFIG3_DOMAIN=$ads_config3_domain
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
114 -e SSDT_ADS_CONFIG3_LDAP_URL=$ads_config3_ldap_url
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
115 -e SSDT_ADS_CONFIG3_ROOT_DN=$ads_config3_root_dn
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
116 -e SSDT_ADS_CONFIG3_SEARCH_FILTER=$ads_config3_search_filter"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
117 fi
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
118 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
119 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
120 dockerRunCommand="$dockerRunCommand -d $artifactUrl/itcm-app:$appVersion"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
121 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
122 # Execute constructed docker run command to create $entityId-itcm-app container connected to db and docker network
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
123 echo "Executing docker run command"
415
edf477197f1b Remove SSDT_ prefix
Marc Davis <marc.davis@mcoecn.org>
parents: 408
diff changeset
124 $dockerRunCommand