view prod/install-ipdp-db.sh @ 608:5cb80996e4d5

fix name of ipdp install, add backup/restore/update scripts
author Justin Kleinknecht <justin.kleinknecht@mcoecn.org>
date Tue, 01 Jul 2025 21:00:04 +0100
parents 2aebef3e31bf
children
line wrap: on
line source
#!/bin/bash
#
# read required env variables
BASEDIR="$PWD"
source $BASEDIR/.env/ipdp-shared.properties
source $BASEDIR/.env/ipdp-db.properties
#
# docker login
echo "attempting to login to $artifactoryUrl"
docker login $artifactoryUrl -u $artifactoryUser -p $artifactoryPassword
# docker pull db image
echo "attempting to pull $artifactoryUrl/ipdp-db:$dbVersion"
docker pull $artifactoryUrl/ipdp-db:$dbVersion
#
# create employee self service specific docker network for $entityId
echo "attempting to create $entityId-ipdp-net docker network"
docker network create $entityId-ipdp-net
# docker run ipdp-db (data mounted as volume) connected to $entityId-ipdp-net docker network
echo "attempting to execute docker run command"
docker run --name $entityId-ipdp-db \
           --restart=unlipdp-stopped \
           --mount source=$entityId-ipdp-db,target=/var/lib/postgresql/data \
           --network $entityId-ipdp-net \
           -e POSTGRES_DB=ipdpdb \
           -e POSTGRES_PASSWORD=$dbPassword \
           -d $artifactUrl/ipdp-db:$dbVersion