view prod/install-ess-db.sh @ 596:652e0b0552b1 production v2.21.0

flow: Merged <release> '2.21.0' to <master> ('production').
author Marc Davis <marc.davis@mcoecn.org>
date Tue, 17 Sep 2024 08:22:06 -0400
parents cb688221b17b
children
line wrap: on
line source
#!/bin/bash
#
# read required env variables
BASEDIR="$PWD"
source $BASEDIR/.env/ess-shared.properties
source $BASEDIR/.env/ess-db.properties
#
# docker login
echo "attempting to login to $artifactUrl"
docker login $artifactUrl -u $artifactUser -p $artifactPassword
# docker pull db image
echo "attempting to pull $artifactUrl/ess-db:$dbVersion"
docker pull $artifactUrl/ess-db:$dbVersion
#
# create employee self service specific docker network for $entityId
echo "attempting to create $entityId-ess-net docker network"
docker network create $entityId-ess-net
# docker run ess-db (data mounted as volume) connected to $entityId-ess-net docker network
echo "attempting to execute docker run command"
docker run --name $entityId-ess-db \
           --restart=unless-stopped \
           --mount source=$entityId-ess-db,target=/var/lib/postgresql/data \
           --network $entityId-ess-net \
           -e POSTGRES_DB=essdb \
           -e POSTGRES_PASSWORD=$dbPassword \
           -d $artifactUrl/ess-db:$dbVersion