annotate prod/install-ess-app.sh @ 607:3ec3180d23a4

merge
author Justin Kleinknecht <justin.kleinknecht@mcoecn.org>
date Tue, 01 Jul 2025 20:51:22 +0100
parents d69f39c55332
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 #
602
d69f39c55332 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 580
diff changeset
74 if [ ! -z "$miniOrangeEnabled" ]; then
d69f39c55332 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 580
diff changeset
75 echo "Adding MiniOrange Configuration"
d69f39c55332 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 580
diff changeset
76 dockerRunCommand="$dockerRunCommand
d69f39c55332 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 580
diff changeset
77 -e MINI_ORANGE_ENABLED=$miniOrangeEnabled
d69f39c55332 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 580
diff changeset
78 -e MINI_ORANGE_CLIENT_ID=$miniOrangeClientId
d69f39c55332 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 580
diff changeset
79 -e MINI_ORANGE_CLIENT_SECRET=$miniOrangeClientSecret
d69f39c55332 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 580
diff changeset
80 -e MINI_ORANGE_API_HOSTNAME=$miniOrangeApiHostname
d69f39c55332 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 580
diff changeset
81 -e MINI_ORANGE_FAIL_OPEN=$miniOrangeFailOpen
d69f39c55332 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: 580
diff changeset
82 -e MINI_ORANGE_APP_HOST=$miniOrangeEssHost
d69f39c55332 Add mini orange envars
Marc Davis <marc.davis@mcoecn.org>
parents: