annotate prod/update-ess-app.sh @ 586:f897ce55c610 production v2.19.0

flow: Merged <release> '2.19.0' to <master> ('production').
author Marc Davis <marc.davis@mcoecn.org>
date Thu, 05 Sep 2024 14:09:51 -0400
parents b6f03eb10850
children d69f39c55332
rev   line source
528
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
1 #!/bin/bash
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
2 #
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
3 # read required env variables
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
4 BASEDIR="$PWD"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
5 source $BASEDIR/.env/ess-shared.properties
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
6 source $BASEDIR/.env/ess-app.properties
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
7 #
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
8 # docker login
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
9 echo "Attempting to login to $artifactUrl"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
11 #
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
12 # docker pull app image
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
13 echo "Attempting to pull $artifactUrl/ess-app:$appVersion"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
14 docker pull $artifactUrl/ess-app:$appVersion
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
15 #
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
16 # docker stop ess app container
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
17 echo "Attempting to stop $entityId-ess-app container"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
18 docker stop $entityId-ess-app
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
19 #
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
20 # docker rm ess app container
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
21 echo "Attempting to remove $entityId-ess-app container"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
22 docker rm $entityId-ess-app
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
23 #
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
24 # Builder docker run command based on settings in env files
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
25 echo "Building docker run command"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
26 dockerRunCommand="docker run --name $entityId-ess-app
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
27 --restart=unless-stopped
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
28 --network $entityId-ess-net
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
29 -e SPRING_DATASOURCE_URL=jdbc:postgresql://$entityId-ess-db:5432/essdb
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
30 -e SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
31 -e SPRING_DATASOURCE_USERNAME=postgres
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
32 -e SPRING_DATASOURCE_PASSWORD=$dbPassword
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
33 -e SPRING_PROFILES_ACTIVE=prod
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
34 -e APPLICATION_ADMIN_PASSWORD=$adminPassword