annotate prod/install-ess-db.sh @ 535:bd42d00aa1f1

Update protections on update-ess-app.sh to allow execution
author Matt Calmes <calmes@ssdt-ohio.org>
date Mon, 06 May 2024 10:20:41 -0400
parents cb688221b17b
children
rev   line source
519
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
1 #!/bin/bash
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
2 #
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
3 # read required env variables
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
4 BASEDIR="$PWD"
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
5 source $BASEDIR/.env/ess-shared.properties
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
6 source $BASEDIR/.env/ess-db.properties
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
7 #
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
8 # docker login
526
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 519
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: 519
diff changeset
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword
519
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
11 # docker pull db image
526
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 519
diff changeset
12 echo "attempting to pull $artifactUrl/ess-db:$dbVersion"
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 519
diff changeset
13 docker pull $artifactUrl/ess-db:$dbVersion
519
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
14 #
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
15 # create employee self service specific docker network for $entityId
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
16 echo "attempting to create $entityId-ess-net docker network"
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
17 docker network create $entityId-ess-net
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
18 # docker run ess-db (data mounted as volume) connected to $entityId-ess-net docker network
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
19 echo "attempting to execute docker run command"
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
20 docker run --name $entityId-ess-db \
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
21 --restart=unless-stopped \
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
22 --mount source=$entityId-ess-db,target=/var/lib/postgresql/data \
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
23 --network $entityId-ess-net \
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
24 -e POSTGRES_DB=essdb \
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
25 -e POSTGRES_PASSWORD=$dbPassword \
526
cb688221b17b Add ESS scripts and update workflows to connect to employee self service.
Marc Davis <marc.davis@mcoecn.org>
parents: 519
diff changeset
26 -d $artifactUrl/ess-db:$dbVersion