annotate prod/install-ess-db.sh @ 519:cb672d0888c6

add install script for ess database
author davis@ssdt-ohio.org
date Wed, 08 Nov 2023 09:49:17 -0500
parents
children cb688221b17b
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
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
9 echo "attempting to login to $artifactoryUrl"
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
10 docker login $artifactoryUrl -u $artifactoryUser -p $artifactoryPassword
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
11 # docker pull db image
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
12 echo "attempting to pull $artifactoryUrl/ess-db:$dbVersion"
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
13 docker pull $artifactoryUrl/ess-db:$dbVersion
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 \
cb672d0888c6 add install script for ess database
davis@ssdt-ohio.org
parents:
diff changeset
26 -d $artifactUrl/ess-db:$dbVersion