Mercurial > public > ssdt-docker
comparison prod/update-itcm-app.sh @ 413:4b0c2c7e213b production v2.15.0
flow: Merged <release> '2.15.0' to <master> ('production').
author | Marc Davis <marc.davis@mcoecn.org> |
---|---|
date | Fri, 14 Oct 2022 10:20:38 -0400 |
parents | e49038cbb14c |
children | edf477197f1b |
comparison
equal
deleted
inserted
replaced
407:cc2ef015d7e1 | 413:4b0c2c7e213b |
---|---|
1 #!/bin/bash | |
2 # | |
3 # read required env variables | |
4 BASEDIR="$PWD" | |
5 source $BASEDIR/.env/itcm-shared.properties | |
6 source $BASEDIR/.env/itcm-app.properties | |
7 # | |
8 # docker login | |
9 echo "Attempting to login to $artifactUrl" | |
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword | |
11 # | |
12 # docker pull app image | |
13 echo "Attempting to pull $artifactUrl/itcm-app:$appVersion" | |
14 docker pull $artifactUrl/itcm-app:$appVersion | |
15 # | |
16 # docker stop itcm app container | |
17 echo "Attempting to stop $entityId-itcm-app container" | |
18 docker stop $entityId-itcm-app | |
19 # | |
20 # docker rm itcm app container | |
21 echo "Attempting to remove $entityId-itcm-app container" | |
22 docker rm $entityId-itcm-app | |
23 # | |
24 # Builder docker run command based on settings in env files | |
25 echo "Building docker run command" | |
26 dockerRunCommand="docker run --name $entityId-itcm-app | |
27 --restart=unless-stopped | |
28 --network $entityId-itcm-net | |
29 -e SPRING_DATASOURCE_URL=jdbc:postgresql://$entityId-itcm-db:5432/itcmdb | |
30 -e SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver | |
31 -e SPRING_DATASOURCE_USERNAME=postgres | |
32 -e SPRING_DATASOURCE_PASSWORD=$dbPassword | |
33 -e SPRING_PROFILES_ACTIVE=prod | |
34 -e APPLICATION_ADMIN_PASSWORD=$adminPassword | |
35 -e APPLICATION_ADMIN_RESET=$resetAdminPassword | |
36 -e JAVA_OPTS=$java_opts" | |
37 # | |
38 if [ ! -z "$virtualHost" ]; then | |
39 dockerRunCommand="$dockerRunCommand -e VIRTUAL_HOST=$virtualHost" | |
40 fi | |
41 # | |
42 if [ ! -z "$virtualPort" ]; then | |
43 dockerRunCommand="$dockerRunCommand -e VIRTUAL_PORT=$virtualPort" | |
44 fi | |
45 # | |
46 if [ ! -z "$letsencryptHost" ]; then | |
47 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_HOST=$letsencryptHost" | |
48 fi | |
49 # | |
50 if [ ! -z "$letsencryptEmail" ]; then | |
51 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_EMAIL=$letsencryptEmail" | |
52 fi | |
53 # | |
54 if [ ! -z "$hostPort" ]; then | |
55 dockerRunCommand="$dockerRunCommand -p $hostPort" | |
56 fi | |
57 # | |
58 # | |
59 if [ ! -z "$duoEnabled" ]; then | |
60 echo "Adding Duo Configuration" | |
61 dockerRunCommand="$dockerRunCommand | |
62 -e SSDT_DUO_ENABLED=$duoEnabled | |
63 -e SSDT_DUO_CLIENT_ID=$duoClientId | |
64 -e SSDT_DUO_CLIENT_SECRET=$duoClientSecret | |
65 -e SSDT_DUO_API_HOSTNAME=$duoApiHostname | |
66 -e SSDT_DUO_FAIL_OPEN=$duoFailOpen | |
67 -e SSDT_DUO_ITCM_HOST=$duoItcmHost | |
68 -e SSDT_DUO_ITCM_PORT=$duoItcmPort | |
69 -e SSDT_DUO_ITCM_CONTEXT=$duoItcmContext | |
70 -e SSDT_DUO_MINUTES_UNTIL_EXPIRATION=$duoMinutesUntilExpiration" | |
71 fi | |
72 # | |
73 # | |
74 if [ ! -z "$ads_config1_enabled" ]; then | |
75 echo "Add Window Active Director Configuration 1" | |
76 dockerRunCommand="$dockerRunCommand | |
77 -e SSDT_ADS_CONFIG1_ENABLED=$ads_config1_enabled | |
78 -e SSDT_ADS_CONFIG1_DOMAIN=$ads_config1_domain | |
79 -e SSDT_ADS_CONFIG1_LDAP_URL=$ads_config1_ldap_url | |
80 -e SSDT_ADS_CONFIG1_ROOT_DN=$ads_config1_root_dn | |
81 -e SSDT_ADS_CONFIG1_SEARCH_FILTER=$ads_config1_search_filter" | |
82 fi | |
83 # | |
84 # | |
85 if [ ! -z "$ads_config2_enabled" ]; then | |
86 echo "Add Window Active Director Configuration 2" | |
87 dockerRunCommand="$dockerRunCommand | |
88 -e SSDT_ADS_CONFIG2_ENABLED=$ads_config2_enabled | |
89 -e SSDT_ADS_CONFIG2_DOMAIN=$ads_config2_domain | |
90 -e SSDT_ADS_CONFIG2_LDAP_URL=$ads_config2_ldap_url | |
91 -e SSDT_ADS_CONFIG2_ROOT_DN=$ads_config2_root_dn | |
92 -e SSDT_ADS_CONFIG2_SEARCH_FILTER=$ads_config2_search_filter" | |
93 fi | |
94 # | |
95 # | |
96 if [ ! -z "$ads_config3_enabled" ]; then | |
97 echo "Add Window Active Director Configuration 3" | |
98 dockerRunCommand="$dockerRunCommand | |
99 -e SSDT_ADS_CONFIG3_ENABLED=$ads_config3_enabled | |
100 -e SSDT_ADS_CONFIG3_DOMAIN=$ads_config3_domain | |
101 -e SSDT_ADS_CONFIG3_LDAP_URL=$ads_config3_ldap_url | |
102 -e SSDT_ADS_CONFIG3_ROOT_DN=$ads_config3_root_dn | |
103 -e SSDT_ADS_CONFIG3_SEARCH_FILTER=$ads_config3_search_filter" | |
104 fi | |
105 # | |
106 # | |
107 dockerRunCommand="$dockerRunCommand -d $artifactUrl/itcm-app:$appVersion" | |
108 # | |
109 # Execute constructed docker run command to create $entityId-itcm-app container connected to db and docker network | |
110 echo "Executing docker run command" | |
111 $dockerRunCommand |